Skip to content

Commit

Permalink
Fix: [AEA-0000] - use new way for deployment (#45)
Browse files Browse the repository at this point in the history
## Summary

- Routine Change

### Details

- use new way for deployment
  • Loading branch information
anthony-nhs authored Oct 24, 2024
1 parent 76c5910 commit a54bad9
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 86 deletions.
18 changes: 11 additions & 7 deletions .github/workflows/cdk_package_code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,19 @@ jobs:
run: |
make install
- shell: bash
name: build docker image
- name: 'Tar files'
run: |
make build-deployment-container-image
docker save "eps-aws-dashboards" | gzip > eps-aws-dashboards.tar.gz
tar -rf artifact.tar \
.tool-versions \
packages \
node_modules \
package.json \
package-lock.json \
tsconfig.defaults.json \
cdk.json
- uses: actions/upload-artifact@v4
name: upload build artifact
with:
name: docker_artifact
path: |
eps-aws-dashboards.tar.gz
name: build_artifact
path: artifact.tar
62 changes: 50 additions & 12 deletions .github/workflows/cdk_release_code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,28 +83,63 @@ jobs:
DEV_CLOUD_FORMATION_EXECUTE_LAMBDA_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_EXECUTE_LAMBDA_ROLE }}

- name: Configure AWS Credentials
id: connect-aws
id: connect-aws-pull-image
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: eu-west-2
role-to-assume: ${{ secrets.CLOUD_FORMATION_DEPLOY_ROLE }}
role-session-name: eps-aws-dashboards-deployment
output-credentials: true
role-to-assume: ${{ secrets.CDK_PULL_IMAGE_ROLE }}
role-session-name: eps-aws-dashboards-pull-image

- name: docker_artifact download
- name: build_artifact download
uses: actions/download-artifact@v4
with:
name: docker_artifact
path: .
name: build_artifact

- name: extract build_artifact
run: |
mkdir -p .build
tar -xf artifact.tar -C .build
- name: Retrieve AWS Account ID
id: retrieve-account-id
run: echo "ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)" >> "$GITHUB_ENV"

- name: Login to Amazon ECR
id: login-ecr
run: |
aws ecr get-login-password --region eu-west-2 | docker login --username AWS --password-stdin ${{ env.ACCOUNT_ID }}.dkr.ecr.eu-west-2.amazonaws.com
- name: Pull cdk-utils-build from Amazon ECR
run: |
docker pull "${{ env.ACCOUNT_ID }}.dkr.ecr.eu-west-2.amazonaws.com/cdk-utils-build-repo:latest"
docker tag "${{ env.ACCOUNT_ID }}.dkr.ecr.eu-west-2.amazonaws.com/cdk-utils-build-repo:latest" cdk-utils-build-repo:latest
- name: Configure AWS Credentials
id: connect-aws
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: eu-west-2
role-to-assume: ${{ secrets.CLOUD_FORMATION_DEPLOY_ROLE }}
role-session-name: prescription-clinical-tracker-ui-deployment
output-credentials: true

- name: Extract eps-aws-dashboards docker image
id: extract-eps-aws-dashboards-image
- name: fix cdk.json for deployment
run: |
docker load < eps-aws-dashboards.tar.gz
jq \
--arg stackName "${{ inputs.stack_name }}" \
--arg VERSION_NUMBER "${{ inputs.VERSION_NUMBER }}" \
--arg COMMIT_ID "${{ inputs.COMMIT_ID }}" \
'.context += {
"stackName": $stackName,
"VERSION_NUMBER": $VERSION_NUMBER,
"COMMIT_ID": $COMMIT_ID}' \
.build/cdk.json > .build/cdk.new.json
mv .build/cdk.new.json .build/cdk.json
- name: Show diff
run: |
docker run \
-v "$(pwd)/.build":/home/cdkuser/workspace/ \
-e AWS_ACCESS_KEY_ID=${{ steps.connect-aws.outputs.aws-access-key-id }} \
-e AWS_SECRET_ACCESS_KEY=${{ steps.connect-aws.outputs.aws-secret-access-key }} \
-e AWS_SESSION_TOKEN=${{ steps.connect-aws.outputs.aws-session-token }} \
Expand All @@ -114,12 +149,14 @@ jobs:
-e COMMIT_ID="${{ inputs.COMMIT_ID}}" \
-e SHOW_DIFF="true" \
-e DEPLOY_CODE="false" \
eps-aws-dashboards
-e CDK_APP_PATH="packages/cdk/bin/DashboardsApp.ts" \
cdk-utils-build-repo:latest
shell: bash

- name: Deploy code
run: |
docker run \
-v "$(pwd)/.build":/home/cdkuser/workspace/ \
-e AWS_ACCESS_KEY_ID=${{ steps.connect-aws.outputs.aws-access-key-id }} \
-e AWS_SECRET_ACCESS_KEY=${{ steps.connect-aws.outputs.aws-secret-access-key }} \
-e AWS_SESSION_TOKEN=${{ steps.connect-aws.outputs.aws-session-token }} \
Expand All @@ -129,7 +166,8 @@ jobs:
-e COMMIT_ID="${{ inputs.COMMIT_ID}}" \
-e SHOW_DIFF="false" \
-e DEPLOY_CODE="true" \
eps-aws-dashboards
-e CDK_APP_PATH="packages/cdk/bin/DashboardsApp.ts" \
cdk-utils-build-repo:latest
shell: bash

- name: create_int_release_notes
Expand Down
49 changes: 0 additions & 49 deletions docker/Dockerfile

This file was deleted.

18 changes: 0 additions & 18 deletions docker/entrypoint.sh

This file was deleted.

0 comments on commit a54bad9

Please sign in to comment.