Skip to content

Commit

Permalink
[PRMP-1355] Removed the questionable ssm parameter dependency and imp…
Browse files Browse the repository at this point in the history
…lemented a work around
  • Loading branch information
oliverbeumkes-nhs authored and abbas-khan10 committed Jan 23, 2025
1 parent 1a741db commit fa92043
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/base-deploy-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,22 @@ jobs:
role-skip-session-tagging: true
aws-region: ${{ vars.AWS_REGION }}
mask-aws-account-id: true

- name: Get SSM parameters from SSM
id: ssm-parameters
run: |
doc_store_api_endpoint=$(echo aws ssm get-parameter --name \"/ndr/${{ inputs.sandbox }}/api_endpoint\" --with-decryption)
echo "DOC_STORE_API_ENDPOINT=$doc_store_api_endpoint" >> $GITHUB_OUTPUT
container_port=$(echo aws ssm get-parameter --name \"ndr/${{ inputs.sandbox }}/container_port\" --with-decryption)
echo "CONTAINER_PORT=$container_port" >> $GITHUB_OUTPUT
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- uses: dkershner6/aws-ssm-getparameters-action@v2
with:
parameterPairs: '/ndr/${{ inputs.sandbox }}/api_endpoint = DOC_STORE_API_ENDPOINT,
/ndr/${{ inputs.sandbox }}/container_port = CONTAINER_PORT'
withDecryption: 'true' # defaults to true

- name: Configure React environment vars
env:
ENDPOINT_DOC_STORE_API: ${{ env.DOC_STORE_API_ENDPOINT }}
ENDPOINT_DOC_STORE_API: ${{ steps.ssm-parameters.outputs.DOC_STORE_API_ENDPOINT }}
AWS_REGION: ${{ vars.AWS_REGION }}
OIDC_PROVIDER_ID: not provided yet
BUILD_ENV: ${{ inputs.environment }}
Expand All @@ -75,9 +77,8 @@ jobs:
ECR_REPOSITORY: ndr-${{ inputs.sandbox }}-app
IMAGE_TAG: latest
IMAGE_TAG_SHA: ${{ github.sha }}
CONTAINER_PORT: ${{ env.CONTAINER_PORT }}
run: |
docker build --build-arg="CONTAINER_PORT=$CONTAINER_PORT" -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG_SHA .
docker build --build-arg="CONTAINER_PORT=${{ steps.ssm-parameters.outputs.CONTAINER_PORT }}" -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG_SHA .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG_SHA
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG_SHA" >> $GITHUB_OUTPUT
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/full-ui-dispatch-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,17 @@ jobs:
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- uses: dkershner6/aws-ssm-getparameters-action@v2
with:
parameterPairs: '/ndr/${{ github.event.client_payload.sandbox }}/api_endpoint = DOC_STORE_API_ENDPOINT,
/ndr/${{ github.event.client_payload.sandbox }}/container_port = CONTAINER_PORT'
withDecryption: 'true' # defaults to true
- name: Get SSM parameters from SSM
id: ssm-parameters
run: |
doc_store_api_endpoint=$(echo aws ssm get-parameter --name \"/ndr/$${{ github.event.client_payload.sandbox }}/api_endpoint\" --with-decryption)
echo "DOC_STORE_API_ENDPOINT=$doc_store_api_endpoint" >> $GITHUB_OUTPUT
container_port=$(echo aws ssm get-parameter --name \"ndr/${{ github.event.client_payload.sandbox }}/container_port\" --with-decryption)
echo "CONTAINER_PORT=$container_port" >> $GITHUB_OUTPUT
- name: Configure React environment vars
env:
ENDPOINT_DOC_STORE_API: ${{ env.DOC_STORE_API_ENDPOINT }}
ENDPOINT_DOC_STORE_API: ${{ steps.ssm-parameters.outputs.DOC_STORE_API_ENDPOINT }}
AWS_REGION: ${{ vars.AWS_REGION }}
OIDC_PROVIDER_ID: not provided yet
BUILD_ENV: ${{ github.event.client_payload.environment }}
Expand All @@ -98,9 +100,8 @@ jobs:
ECR_REPOSITORY: ndr-${{ github.event.client_payload.sandbox }}-app
IMAGE_TAG: latest
IMAGE_TAG_SHA: ${{ github.sha }}
CONTAINER_PORT: ${{ env.CONTAINER_PORT }}
run: |
docker build --build-arg="CONTAINER_PORT=$CONTAINER_PORT" -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG_SHA .
docker build --build-arg="CONTAINER_PORT=${{ steps.ssm-parameters.outputs.CONTAINER_PORT }}" -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG_SHA .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG_SHA
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG_SHA" >> $GITHUB_OUTPUT
Expand Down

0 comments on commit fa92043

Please sign in to comment.