Skip to content

Commit

Permalink
Update ecr rem pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
imnasnainaec committed Oct 18, 2024
1 parent e40c394 commit 806d9f1
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/deploy_qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ jobs:
build_component: ${{ matrix.component }}
clean_ecr_repo:
needs: build
env:
RM_PATTERN_1: v1\.\d+\.\d+-.*
RM_PATTERN_2: v2\.0\.\d+-.*
runs-on: ubuntu-latest
steps:
# See https://docs.stepsecurity.io/harden-runner/getting-started/ for instructions on
Expand All @@ -89,7 +86,15 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
- name: Remove old AWS ECR images
run: scripts/clean_aws_repo.py combine_frontend combine_backend combine_maint combine_database --keep ${{ needs.build.outputs.image_tag }} --remove "${{ env.RM_PATTERN_1 }}" "${{ env.RM_PATTERN_2 }}" --verbose
run: |
TAG=${{ needs.build.outputs.image_tag }}
if [[ $TAG =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)-.* ]]; then
VA=${BASH_REMATCH[1]}; VB=${BASH_REMATCH[2]}; VC=${BASH_REMATCH[3]}
if [[ $VC > 0 ]]; then REM="v${VA}\.${VB}\.$((VC - 1))-.*"
elif [[ $VB > 0 ]]; then REM="v${VA}\.$((VB - 1))\..*"
else REM="v$((VA - 1))\..*"; fi
scripts/clean_aws_repo.py combine_frontend combine_backend combine_maint combine_database --remove "${REM}" --verbose
fi
deploy_update:
needs: build
# Only push to the QA server when built on the master branch
Expand Down

0 comments on commit 806d9f1

Please sign in to comment.