Skip to content

Commit

Permalink
fix: [PLAT-262] Mirror release branches to us-west-2 (#3837)
Browse files Browse the repository at this point in the history
  • Loading branch information
liam-verta committed May 30, 2023
1 parent ce0162f commit 3914448
Showing 1 changed file with 30 additions and 7 deletions.
37 changes: 30 additions & 7 deletions .github/workflows/java-build-push-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

permissions:
id-token: write # This is required for requesting the JWT
contents: write # Read is is required for actions/checkout, write is required to comment on commits
contents: write # Read is required for actions/checkout, write is required to comment on commits
pull-requests: write # This is needed for the coverage plugin to write comments to the PR
packages: write
statuses: write
Expand All @@ -19,6 +19,10 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
VERTA_ECR_REGISTRY: "493416687123.dkr.ecr.us-east-1.amazonaws.com"
ECR_REPOSITORY: "493416687123.dkr.ecr.us-east-1.amazonaws.com/services/oss/modeldb/backend"

jobs:
build-push-test:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -89,7 +93,7 @@ jobs:
id: should_publish
run: |
TARGETS=""
docker manifest inspect 493416687123.dkr.ecr.us-east-1.amazonaws.com/services/oss/modeldb/backend:${{ steps.image_info.outputs.tag }} || TARGETS="modeldb"
docker manifest inspect $ECR_REPOSITORY:${{ steps.image_info.outputs.tag }} || TARGETS="modeldb"
echo "targets=${TARGETS}" >> $GITHUB_OUTPUT
- name: Build and push Docker image to ECR
Expand All @@ -99,11 +103,31 @@ jobs:
context: backend
push: true
build-args: |
BASE_IMAGE=493416687123.dkr.ecr.us-east-1.amazonaws.com/ops/containers/base/java:main-11-latest
BASE_IMAGE=${{ env.VERTA_ECR_REGISTRY }}/ops/containers/base/java:main-11-latest
tags: |
493416687123.dkr.ecr.us-east-1.amazonaws.com/services/oss/modeldb/backend:${{ steps.image_info.outputs.tag }}
env:
ECR_REGISTRY: 493416687123.dkr.ecr.us-east-1.amazonaws.com/services/oss/modeldb/backend
${{ env.ECR_REPOSITORY }}:${{ steps.image_info.outputs.tag }}
- name: Configure AWS credentials for us-west-2
if: startsWith( steps.branch_names.outputs.current_branch, 'release/' )
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::493416687123:role/github-actions
aws-region: us-west-2

- name: Login to Amazon ECR for us-west-2
id: login-ecr-release
if: startsWith( steps.branch_names.outputs.current_branch, 'release/' )
uses: aws-actions/amazon-ecr-login@v1

- name: Mirror Docker image to us-west-2
id: mirror-release
if: startsWith( steps.branch_names.outputs.current_branch, 'release/' )
shell: bash
run: |
export TARGET_REPOSITORY=${ECR_REPOSITORY/us-east-1/us-west-2}
docker manifest inspect ${TARGET_REPOSITORY}:${{ steps.image_info.outputs.tag }} || \
docker tag ${ECR_REPOSITORY}:${{ steps.image_info.outputs.tag }} ${TARGET_REPOSITORY}:${{ steps.image_info.outputs.tag }} && \
docker push ${TARGET_REPOSITORY}:${{ steps.image_info.outputs.tag }}
- name: Create commit comment
uses: peter-evans/commit-comment@v2
Expand Down Expand Up @@ -168,4 +192,3 @@ jobs:
Changed Files coverage (common): coverage ${{ steps.jacoco-common.outputs.coverage-changed-files }}
Changed Files coverage (server): ${{ steps.jacoco-server.outputs.coverage-changed-files }}

2 comments on commit 3914448

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docker Tag: main-2023-05-30T23-12-13--3914448

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Total coverage (common): 10.69
Total coverage (server): 33.71

Changed Files coverage (common): coverage 100
Changed Files coverage (server): 100

Please sign in to comment.