Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
6e8ff8d
Upgrade to Node.js version 20 (which will be depricated in June 2026)…
jonathan-cantu-icf Mar 25, 2026
d8c8c30
Update dependencies to latest compatible versions.
mianava Mar 27, 2026
aa6e2e9
Migrate Lint config to flat config structure
mianava Mar 27, 2026
37a90d5
Replace jest with typescript, add overrides, add node to support.
mianava Mar 27, 2026
656e051
Update tests for aws-sdk-client-mock compatability
mianava Mar 27, 2026
d1ec555
Make CommonJS bundler compatible
mianava Mar 27, 2026
488a01f
Switch bundler from ncc to esbuild, add license generation, support s…
mianava Mar 27, 2026
cce421b
Workflow must use updated Node version
mianava Mar 27, 2026
0d52896
Update to use Node20 and updated package versions.
mianava Mar 27, 2026
0c799d6
Merge branch 'main' into feature/GitHub-Actions-AWS-Params-Node-Upgra…
mianava Mar 27, 2026
31eb003
Use the codebuild runners to test github actions.
mianava Mar 27, 2026
5943d54
Modernize to Node 20
mianava Mar 27, 2026
4045eca
Add updated licenses
mianava Mar 27, 2026
483e440
Format with end file space.
mianava Mar 27, 2026
1b48bbd
Test github action retrieves secrets
mianava Mar 27, 2026
f3561bf
Build must occur on same system as CI runs
mianava Mar 27, 2026
ee40cd6
Test CI can pull ssm parameters when changes are made.
mianava Mar 27, 2026
909eb82
Improve understandability.
mianava Mar 27, 2026
ccf56c8
Improve understandability.
mianava Mar 27, 2026
381adb5
Ensure package.json is only json no comments.
mianava Mar 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .github/workflows/aws-params-env-action-check-dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# For our project, we generate this file through a build process from other source files.
# We need to make sure the checked-in `index.js` actually matches what we expect it to be.
name: Check dist/ for aws-params-env-action
description: 'Builds the artifact for aws-params-env-action and checks it against what is checked in to source control.'

on:
pull_request:
Expand All @@ -19,15 +20,15 @@ defaults:

jobs:
check-dist:
runs-on: ubuntu-latest
runs-on: codebuild-cdap-${{ github.ref_name =='main' && 'prod' || 'non-prod' }}-${{github.run_id}}-${{github.run_attempt}}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set Node.js 16.x
uses: actions/setup-node@v3.6.0
- name: Set Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 20.x

- name: Install dependencies
run: npm ci
Expand All @@ -51,4 +52,5 @@ jobs:
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/
path: actions/aws-params-env-action/dist/

48 changes: 37 additions & 11 deletions .github/workflows/aws-params-env-action-test.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,46 @@
name: Test aws-params-env-action
name: aws-params-env-action-test.yml
description: 'Tests that github actions roles can pull SSM parameters using the aws-params-env-action.'

on:
workflow_dispatch:
pull_request:
paths:
- 'actions/aws-params-env-action/**'
- '!actions/aws-params-env-action/**.md'
workflow_dispatch:
- 'services/github-actions-role/data.tf'

defaults:
run:
working-directory: actions/aws-params-env-action
permissions:
contents: read
id-token: write

jobs:
test-and-check-build:
runs-on: ubuntu-latest
test-get-params:
runs-on: codebuild-cdap-${{ contains(fromJSON('["prod", "sandbox"]'), matrix.env) && 'prod' || 'non-prod'}}-${{github.run_id}}-${{github.run_attempt}}
strategy:
fail-fast: false
matrix:
app: [ab2d, bcda, dpc]
env: [dev, test, sandbox, prod]
include:
- app: cdap
env: test
steps:
- uses: actions/checkout@v3
- run: npm ci
- run: npm run all
- uses: aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8 # v5.1.0
with:
role-to-assume: arn:aws:iam::${{ contains(fromJSON('["dev", "test"]'), matrix.env) && secrets.NON_PROD_ACCOUNT || secrets.PROD_ACCOUNT }}:role/delegatedadmin/developer/${{ matrix.app }}-${{ matrix.env }}-github-actions
aws-region: ${{ vars.AWS_REGION }}

- uses: cmsgov/cdap/actions/aws-params-env-action@main
env:
AWS_REGION: ${{ vars.AWS_REGION }}
with:
params: |
SONAR_HOST_URL=/sonarqube/url

- name: Verify env vars were set
run: |
if [ -z "$SONAR_HOST_URL" ]; then
echo "❌ SONAR_HOST_URL was not set"
exit 1
else
echo "✅ SONAR_HOST_URL is set"
fi
4 changes: 0 additions & 4 deletions actions/aws-params-env-action/.eslintignore

This file was deleted.

55 changes: 0 additions & 55 deletions actions/aws-params-env-action/.eslintrc.json

This file was deleted.

9 changes: 9 additions & 0 deletions actions/aws-params-env-action/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ The `aws-params-env-action` sets workflow environment variables from values in A
## Prerequisites

To use this action, you must have AWS credentials and region configured in the action environment. This can be done by using the [configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials) step, for example, or by running the action on a self-hosted runner in AWS with an instance profile.
This action requires @aws-sdk/client-ssm to be available in the runner environment. It is pre-installed on the project's CodeBuild runners. If using on standard GitHub-hosted runners, remove the --external flag from the package script to produce a fully self-contained bundle.

## Usage

Expand Down Expand Up @@ -38,3 +39,11 @@ All steps in the workflow following this will have VAR1, ENV_VAR2, and SECRET_X
echo "::add-mask::$secret_x"
echo "SECRET_X=$secret_x" >> "$GITHUB_ENV"
```

## Building
When making changes to this action, rebuild with
```
rm -rf dist/ &&
docker run --rm -v $(pwd):/app -w /app/actions/aws-params-env-action node:20-alpine sh -c "npm ci && npm run build && npm run package"
```

7 changes: 6 additions & 1 deletion actions/aws-params-env-action/__tests__/main.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {SSMClient, GetParametersCommand} from '@aws-sdk/client-ssm'
import {expect, test, jest} from '@jest/globals'
import {expect, test, jest, beforeEach} from '@jest/globals'
import {getValues} from '../src/get-values'
import {mockClient} from 'aws-sdk-client-mock'
import {parseParams} from '../src/parse-params'
Expand All @@ -11,6 +11,11 @@ const mockedExportVariable = jest.mocked(exportVariable)
const mockedSetFailed = jest.mocked(setFailed)
const mockedSetSecret = jest.mocked(setSecret)

beforeEach(() => {
client.reset()
jest.clearAllMocks()
})

test('parse input params', () => {
const params = `
VARIABLE1=/good/variable
Expand Down
2 changes: 1 addition & 1 deletion actions/aws-params-env-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ inputs:
required: true
description: 'Whitespace-separated parameters of the form ENV_VAR=/aws/parameter/name'
runs:
using: 'node16'
using: 'node20'
main: 'dist/index.js'
branding:
icon: dollar-sign
Expand Down
Loading
Loading