Skip to content

Commit

Permalink
Fixes for prod_test and SHA_SHORT
Browse files Browse the repository at this point in the history
  • Loading branch information
gsf committed Oct 5, 2024
1 parent 444d399 commit 7843040
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
- test
- sbx
- prod
- prod-test
- prod_test
module:
required: true
type: choice
Expand All @@ -35,7 +35,7 @@ jobs:
id-token: write
env:
DEPLOYMENT_ENV: ${{ vars[format('{0}_DEPLOYMENT_ENV', inputs.environment)] }}
ACCOUNT: ${{ inputs.environment == 'prod-test' && 'prod' || inputs.environment }}
ACCOUNT: ${{ inputs.environment == 'prod_test' && 'prod' || inputs.environment }}

steps:
- uses: aws-actions/configure-aws-credentials@v3
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/promote.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
options:
- sbx
- prod
- prod-test
- prod_test
module:
required: true
type: choice
Expand Down Expand Up @@ -47,25 +47,25 @@ jobs:
SHA_SHORT=82d2398 # TODO remove after testing
echo "Getting the manifest of the image pushed with the latest commit to main at sha $SHA_SHORT"
MANIFEST=$(aws ecr batch-get-image --repository-name "$REPO" --image-ids imageTag=main-$SHORT_SHA --output text --query 'images[].imageManifest')
MANIFEST=$(aws ecr batch-get-image --repository-name "$REPO" --image-ids imageTag=main-$SHA_SHORT --output text --query 'images[].imageManifest')
SHA_TAG="ab2d-$DEPLOYMENT_ENV-$SHA_SHORT"
echo "Adding the tag for $SHA_TAG to main-$SHORT_SHA image"
echo "Adding the tag for $SHA_TAG to main-$SHA_SHORT image"
# Avoid failure on existing image and tag
if ! OUT=$(2>&1 aws ecr put-image --repository-name "$REPO" --image-tag "$SHA_TAG" --image-manifest "$MANIFEST"); then
if echo "$OUT" | grep ImageAlreadyExistsException > /dev/null; then
echo "Image for main-$SHORT_SHA has already been tagged with $SHA_TAG"
echo "Image for main-$SHA_SHORT has already been tagged with $SHA_TAG"
else
>&2 echo "$OUT"
exit 1
fi
fi
LATEST_TAG="ab2d-$DEPLOYMENT_ENV-latest"
echo "Adding the tag for $LATEST_TAG to main-$SHORT_SHA image"
echo "Adding the tag for $LATEST_TAG to main-$SHA_SHORT image"
if ! OUT=$(2>&1 aws ecr put-image --repository-name "$REPO" --image-tag "$LATEST_TAG" --image-manifest "$MANIFEST"); then
if echo "$OUT" | grep ImageAlreadyExistsException > /dev/null; then
echo "Image for main-$SHORT_SHA has already been tagged with $LATEST_TAG"
echo "Image for main-$SHA_SHORT has already been tagged with $LATEST_TAG"
else
>&2 echo "$OUT"
exit 1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ jobs:
promote-prod-test-worker:
uses: ./.github/workflows/promote.yml
with:
environment: prod-test
environment: prod_test
module: worker
secrets: inherit

deploy-prod-test-worker:
needs: promote-prod-test-worker
uses: ./.github/workflows/deploy.yml
with:
environment: prod-test
environment: prod_test
module: worker
secrets: inherit

Expand Down

0 comments on commit 7843040

Please sign in to comment.