2525 name : deploy (stage-us-east)
2626 runs-on : ${{ format('codebuild-java-cdk-serverless-clamscan-stage-us-east-runner-{0}-{1}', github.run_id, github.run_attempt) }}
2727 environment : stage-us-east
28- outputs :
29- resolved_image_uri : ${{ steps.capture_image.outputs.resolved_image_uri }}
3028
3129 steps :
3230 - name : Checkout Code
@@ -117,7 +115,7 @@ jobs:
117115 echo "Running Virus Scan Validation Tests..."
118116 mvn --batch-mode --no-transfer-progress exec:java
119117
120- - name : Capture Tested Image Manifest For Promotion
118+ - name : Capture Tested Image URI For Promotion
121119 id : capture_image
122120 working-directory : ./cdk
123121 run : |
@@ -131,7 +129,14 @@ jobs:
131129 --query 'Code.ResolvedImageUri' \
132130 --output text)
133131
134- echo "resolved_image_uri=$RESOLVED_IMAGE_URI" >> "$GITHUB_OUTPUT"
132+ printf '%s' "$RESOLVED_IMAGE_URI" > "$RUNNER_TEMP/resolved-image-uri.txt"
133+
134+ - name : Upload Tested Image URI
135+ uses : actions/upload-artifact@v4
136+ with :
137+ name : tested-image-uri
138+ path : ${{ runner.temp }}/resolved-image-uri.txt
139+ if-no-files-found : error
135140
136141 - name : Rollback Lambda Alias if Tests Fail
137142 if : failure() && steps.scan-tests.outcome == 'failure'
@@ -205,13 +210,19 @@ jobs:
205210 echo "BUCKET_NAMES=${{ vars.S3_BUCKET_NAMES }}" >> $GITHUB_ENV
206211 echo "Final list of bucket names to deploy against: ${{ vars.S3_BUCKET_NAMES }}"
207212
213+ - name : Download Tested Image URI
214+ uses : actions/download-artifact@v4
215+ with :
216+ name : tested-image-uri
217+ path : ${{ runner.temp }}/tested-image-uri
218+
208219 - name : Ensure CDK is bootstraped and up to date
209220 working-directory : ./cdk
210221 run : cdk bootstrap --ci=true aws://${AWS_ACCOUNT_ID}/${{ vars.AWS_REGION || 'us-east-1' }}
211222
212223 - name : Promote Tested Image Into Production ECR
213224 run : |
214- SOURCE_IMAGE_URI="${{ needs.deploy-stage.outputs.resolved_image_uri }} "
225+ SOURCE_IMAGE_URI="$(cat "$RUNNER_TEMP/tested-image-uri/resolved-image-uri.txt") "
215226 if [ -z "$SOURCE_IMAGE_URI" ]; then
216227 echo "Stage job did not provide a resolved image URI for promotion." >&2
217228 exit 1
0 commit comments