|
| 1 | +name: "LCM: Retag stable image to major version" |
| 2 | +run-name: "Retag stable lcm-bricks ${{ inputs.tag }} → M${{ inputs.tag }}" |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + tag: |
| 8 | + description: 'Stable image tag to retag (e.g. 3.7.106)' |
| 9 | + required: true |
| 10 | + type: string |
| 11 | + dry-run: |
| 12 | + description: 'Dry-run only — print crane commands without executing' |
| 13 | + required: true |
| 14 | + default: false |
| 15 | + type: boolean |
| 16 | + |
| 17 | +concurrency: |
| 18 | + group: ${{ github.workflow }} |
| 19 | + cancel-in-progress: false |
| 20 | + |
| 21 | +jobs: |
| 22 | + retag-stable: |
| 23 | + name: Retag stable/${{ inputs.tag }} to major version |
| 24 | + runs-on: |
| 25 | + group: infra1-runners-arc |
| 26 | + labels: runners-small |
| 27 | + permissions: |
| 28 | + id-token: write |
| 29 | + contents: read |
| 30 | + env: |
| 31 | + INFRA_REPO_URL: ${{ secrets.ECR_URL }} |
| 32 | + steps: |
| 33 | + - name: Get required Vault secrets |
| 34 | + uses: hashicorp/vault-action@v3 |
| 35 | + with: |
| 36 | + url: ${{ secrets.VAULT_ADDRESS }} |
| 37 | + method: jwt |
| 38 | + path: jwt/github |
| 39 | + role: ecr-push |
| 40 | + secrets: | |
| 41 | + secret/data/v3/int/ecr/infra1-user-ecr-rw aws_ecr_access_key | AWS_ACCESS_KEY ; |
| 42 | + secret/data/v3/int/ecr/infra1-user-ecr-rw aws_ecr_secret_key | AWS_SECRET_KEY ; |
| 43 | +
|
| 44 | + - name: Configure AWS credentials |
| 45 | + uses: aws-actions/configure-aws-credentials@v4 |
| 46 | + with: |
| 47 | + aws-access-key-id: ${{ env.AWS_ACCESS_KEY }} |
| 48 | + aws-secret-access-key: ${{ env.AWS_SECRET_KEY }} |
| 49 | + aws-region: us-east-1 |
| 50 | + |
| 51 | + - name: Login to Amazon ECR |
| 52 | + uses: aws-actions/amazon-ecr-login@v2 |
| 53 | + with: |
| 54 | + mask-password: 'true' |
| 55 | + |
| 56 | + - name: Retag images |
| 57 | + env: |
| 58 | + TAG: ${{ inputs.tag }} |
| 59 | + DRY_RUN: ${{ inputs.dry-run }} |
| 60 | + run: | |
| 61 | + set -euo pipefail |
| 62 | + major=$(echo "$TAG" | cut -d. -f1) |
| 63 | + images=(lcm-bricks lcm-bricks-nextversion) |
| 64 | + clusters=(na1 ca2 perf1 bom1 syd1 na3 eu1 fra1) |
| 65 | + for image in "${images[@]}"; do |
| 66 | + src="${INFRA_REPO_URL}/stable/${image}:${TAG}" |
| 67 | + for cluster in "${clusters[@]}"; do |
| 68 | + major_tag="M${major}-${cluster}" |
| 69 | + if [ "${DRY_RUN}" == 'true' ]; then |
| 70 | + echo "[dry-run] crane tag ${src} ${major_tag}" |
| 71 | + else |
| 72 | + crane tag "${src}" "${major_tag}" |
| 73 | + echo "Tagged ${image}:${TAG} → ${image}:${major_tag}" |
| 74 | + fi |
| 75 | + done |
| 76 | + done |
| 77 | +
|
| 78 | + - name: Summary |
| 79 | + env: |
| 80 | + TAG: ${{ inputs.tag }} |
| 81 | + run: | |
| 82 | + set -euo pipefail |
| 83 | + major=$(echo "$TAG" | cut -d. -f1) |
| 84 | + clusters=(na1 ca2 perf1 bom1 syd1 na3 eu1 fra1) |
| 85 | + { |
| 86 | + echo "## LCM stable retag" |
| 87 | + echo "" |
| 88 | + echo "| | |" |
| 89 | + echo "|---|---|" |
| 90 | + echo "| **Source tag** | \`${TAG}\` |" |
| 91 | + echo "| **Major tag pattern** | \`M${major}-<cluster>\` |" |
| 92 | + echo "| **Clusters** | \`${clusters[*]}\` |" |
| 93 | + echo "| **Dry-run** | \`${{ inputs.dry-run }}\` |" |
| 94 | + } >> "$GITHUB_STEP_SUMMARY" |
0 commit comments