-
Notifications
You must be signed in to change notification settings - Fork 1
Build: [AEA-6516] - Move the stateless stack to a CDK deployment #2952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
wildjames
wants to merge
11
commits into
main
Choose a base branch
from
aea-6516-stateless-cdk
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7a52947
Attempt to deploy an empty stack
wildjames 93ae8cf
Merge branch 'main' into aea-6516-stateless-cdk
wildjames b0b7aa6
Zizimor ignore
wildjames 4e8db26
Reenable the grype scan
wildjames 1a42b7f
dont download get secrets layer yet
wildjames 0728630
move API gateway to stateless stack
wildjames 8d15827
Migrate lambda functions. There is a required reference to the SAM st…
wildjames 9ef5994
Migrate over state machine
wildjames f568a10
Fix permission issue
wildjames 0b4fbaa
Merge in main
wildjames 983cd09
Commit todo file for posterity
wildjames File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| name: "Install dependencies" | ||
| description: "Install dependencies defined in .tool-versions using asdf and npm packages" | ||
|
|
||
| inputs: | ||
| npm-required: | ||
| description: "Set to true if npm dependencies are already installed" | ||
| required: false | ||
| default: "true" | ||
| GITHUB_TOKEN: | ||
| description: "GitHub token to access private npm packages" | ||
| required: true | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Setting up .npmrc | ||
| shell: bash | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ inputs.GITHUB_TOKEN }} | ||
| run: | | ||
| echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> ~/.npmrc | ||
| echo "@nhsdigital:registry=https://npm.pkg.github.com" >> ~/.npmrc | ||
|
|
||
| - name: Run make install | ||
| if: inputs.npm-required == 'true' | ||
| shell: bash | ||
| run: | | ||
| make install-node | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| name: cdk package code | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| BRANCH_NAME: | ||
| required: true | ||
| type: string | ||
| VERSION_NUMBER: | ||
| required: true | ||
| type: string | ||
| COMMIT_ID: | ||
| required: true | ||
| type: string | ||
| pinned_image: | ||
| required: true | ||
| type: string | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| package_code: | ||
| runs-on: ubuntu-22.04 | ||
| container: | ||
| image: ${{ inputs.pinned_image }} | ||
| options: --user 1001:1001 --group-add 128 | ||
| defaults: | ||
| run: | ||
| shell: bash | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| packages: read | ||
| steps: | ||
| - name: copy .tool-versions | ||
| run: | | ||
| cp /home/vscode/.tool-versions "$HOME/.tool-versions" | ||
| - name: Checkout code | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | ||
| with: | ||
| ref: ${{ inputs.BRANCH_NAME }} | ||
| persist-credentials: false | ||
|
|
||
| - name: install dependencies | ||
| uses: ./.github/actions/install_dependencies | ||
| with: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: make compile | ||
| run: make compile | ||
|
|
||
| - name: download the get secrets lambda layer | ||
| run: | | ||
| make download-get-secrets-layer | ||
|
|
||
| - name: "Tar files" | ||
| run: | | ||
| tar -rf artifact.tar \ | ||
| .github \ | ||
| packages \ | ||
| node_modules \ | ||
| package.json \ | ||
| package-lock.json \ | ||
| tsconfig.defaults.json | ||
|
wildjames marked this conversation as resolved.
|
||
|
|
||
| - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f | ||
| name: upload build artifact | ||
| with: | ||
| name: build_artifact | ||
| path: artifact.tar | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| name: cdk release code | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| BRANCH_NAME: | ||
| required: true | ||
| type: string | ||
| STACK_NAME: | ||
| required: true | ||
| type: string | ||
| AWS_ENVIRONMENT: | ||
| required: true | ||
| type: string | ||
| VERSION_NUMBER: | ||
| required: true | ||
| type: string | ||
| COMMIT_ID: | ||
| required: true | ||
| type: string | ||
| CDK_APP_NAME: | ||
| required: true | ||
| type: string | ||
| LOG_RETENTION_IN_DAYS: | ||
| required: true | ||
| type: string | ||
| LOG_LEVEL: | ||
| type: string | ||
| IS_PULL_REQUEST: | ||
| type: boolean | ||
| required: true | ||
| pinned_image: | ||
| required: true | ||
| type: string | ||
| secrets: | ||
| CLOUD_FORMATION_DEPLOY_ROLE: | ||
| required: true | ||
| permissions: {} | ||
|
|
||
| jobs: | ||
| release_code: | ||
| runs-on: ubuntu-22.04 | ||
| environment: ${{ inputs.AWS_ENVIRONMENT }} | ||
| container: | ||
| image: ${{ inputs.pinned_image }} | ||
| options: --user 1001:1001 --group-add 128 | ||
| defaults: | ||
| run: | ||
| shell: bash | ||
| name: deploy cdk app ${{ inputs.CDK_APP_NAME }} | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
|
|
||
| steps: | ||
| - name: copy .tool-versions | ||
| run: | | ||
| cp /home/vscode/.tool-versions "$HOME/.tool-versions" | ||
|
|
||
| - name: build_artifact download | ||
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c | ||
| with: | ||
| name: build_artifact | ||
|
|
||
| - name: extract build_artifact | ||
| run: tar -xf artifact.tar | ||
|
|
||
| - name: install dependencies | ||
| uses: ./.github/actions/install_dependencies | ||
| with: | ||
| npm-required: false | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Configure AWS Credentials | ||
| id: connect-aws-deploy | ||
| uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 | ||
| with: | ||
| aws-region: eu-west-2 | ||
| role-to-assume: ${{ secrets.CLOUD_FORMATION_DEPLOY_ROLE }} | ||
| role-session-name: psu-deployment | ||
|
|
||
| - name: Deploy AWS infrastructure and code | ||
| run: npm run cdk-deploy --workspace packages/cdk | ||
| shell: bash | ||
| env: | ||
| CDK_APP_NAME: "${{ inputs.CDK_APP_NAME }}" | ||
| CDK_CONFIG_stackName: "${{ inputs.STACK_NAME }}" | ||
| CDK_CONFIG_versionNumber: "${{ inputs.VERSION_NUMBER }}" | ||
| CDK_CONFIG_commitId: "${{ inputs.COMMIT_ID }}" | ||
| CDK_CONFIG_isPullRequest: "${{ inputs.IS_PULL_REQUEST }}" | ||
| CDK_CONFIG_environment: "${{ inputs.AWS_ENVIRONMENT }}" | ||
| CDK_CONFIG_logRetentionInDays: "${{ inputs.LOG_RETENTION_IN_DAYS }}" | ||
| CDK_CONFIG_logLevel: "${{ inputs.LOG_LEVEL }}" | ||
| REQUIRE_APPROVAL: "never" | ||
|
|
||
| # later, there will be API deployment steps c.f. https://github.com/NHSDigital/electronic-prescription-service-clinical-prescription-tracker/blob/main/.github/workflows/cdk_release_code.yml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
npm-requiredinput description is inverted relative to how it’s used. The action runsmake install-nodewhennpm-required == 'true', so the description should indicate that setting it to true installs npm dependencies (or the condition should be flipped). As written, callers are likely to pass the wrong value.