Skip to content

Commit da2cd0d

Browse files
committed
Pass image URI as output/input
1 parent 11ce09a commit da2cd0d

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

.github/actions/build-push-artifacts/action.yml

+14-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ inputs:
1717
description: 'AWS role to assume'
1818
required: true
1919

20+
outputs:
21+
image-uri:
22+
description: 'The Docker image URI that was built/pushed'
23+
value: ${{ steps.rset-output.outputs.image-uri }}
24+
2025
runs:
2126
using: "composite"
2227
steps:
@@ -47,4 +52,12 @@ runs:
4752
file: ci/Dockerfile
4853
context: .
4954
push: true
50-
tags: ${{ steps.login-ecr-vaec.outputs.registry }}/va_enp_api:${{ inputs.ref }},${{ steps.login-ecr-vaec.outputs.registry }}/va_enp_api:${{ github.sha }} ## Tagging with branch/tag and SHA to maintain SHA record and human readability
55+
tags: ${{ steps.login-ecr-vaec.outputs.registry }}/va_enp_api:${{ inputs.ref }},${{ steps.login-ecr-vaec.outputs.registry }}/va_enp_api:${{ github.sha }} ## Tagging with branch/tag and SHA to maintain SHA record and human readability
56+
57+
# This step sets the Docker image URI as an output from the composite action
58+
- name: Set image output
59+
id: set-output
60+
shell: bash
61+
run: |
62+
# Using the ref tag as our main object to pass around
63+
echo "image-uri=${{ steps.login-ecr-vaec.outputs.registry }}/va_enp_api:${{ inputs.ref }}" >> $GITHUB_OUTPUT

.github/actions/ecs-task-render-deploy/action.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ runs:
7272
image: ${{ inputs.image }}
7373

7474
- name: Deploy API task definition to Fargate
75-
uses: aws-actions/amazon-ecs-deploy-task-definition@v2
76-
with:
77-
task-definition: ./task-definition.json
78-
service: ${{ inputs.environment }}-va-enp-api-service
79-
cluster: ${{ inputs.environment }}-notification-cluster
80-
wait-for-service-stability: true
75+
uses: aws-actions/amazon-ecs-deploy-task-definition@v2
76+
with:
77+
task-definition: ./task-definition.json
78+
service: ${{ inputs.environment }}-va-enp-api-service
79+
cluster: ${{ inputs.environment }}-notification-cluster
80+
wait-for-service-stability: true

.github/workflows/deploy.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
ref: ${{ inputs.ref }}
3232

3333
- name: Build and Push Artifacts
34+
id: build_and_push
3435
uses: ./.github/actions/build-push-artifacts
3536
with:
3637
ref: ${{ inputs.ref }}
@@ -44,11 +45,12 @@ jobs:
4445
with:
4546
task-definition-path: "./cd/va-enp-api-task-definition.json"
4647
container-name: "${{ inputs.environment }}-va-enp-api"
47-
image: nginx:latest ## using this for now because we don't have ENP images yet
48+
image: ${{ steps.build_and_push.outputs.image-uri }}
4849
aws-access-key-id: ${{ secrets.VAEC_AWS_ACCESS_KEY_ID }}
4950
aws-secret-access-key: ${{ secrets.VAEC_AWS_SECRET_ACCESS_KEY }}
5051
aws-region: ${{ secrets.AWS_REGION }}
5152
role-to-assume: ${{ secrets.VAEC_DEPLOY_ROLE }}
53+
environment: ${{ inputs.environment }}
5254
env:
5355
AWS_ARN_REGION: ${{ secrets.AWS_ARN_REGION }}
5456
AWS_ACCOUNT_NUMBER: ${{ secrets.AWS_ACCOUNT_NUMBER }}

0 commit comments

Comments
 (0)