Skip to content

Commit

Permalink
feat: scope Argus ECR repo name with working directory (#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
hspitzley-czi authored Aug 8, 2024
1 parent 152a394 commit cdbe4f8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
28 changes: 19 additions & 9 deletions .github/actions/argus-builder/docker-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ inputs:
github_private_key:
description: 'GitHub App private key'
required: true
working_directory:
description: 'The Argus project root (parent directory that contains the .infra/ directory)'
required: false
default: '.'

outputs:
image_uri:
Expand Down Expand Up @@ -60,16 +64,22 @@ runs:
token: ${{ steps.generate_token.outputs.token }}
- name: ECR Metadata
id: ecr_metadata
shell: bash
run: |
ECR_REGISTRY="533267185808.dkr.ecr.us-west-2.amazonaws.com"
echo "ECR_REGISTRY=$ECR_REGISTRY" >> $GITHUB_OUTPUT
ECR_REPO_NAME="core-platform/${{ github.event.repository.name }}/${{ inputs.image_name }}"
echo "ECR_REPO_NAME=$ECR_REPO_NAME" >> $GITHUB_OUTPUT
uses: actions/github-script@v7
with:
script: |
const path = require('path');
const ECR_REGISTRY = "533267185808.dkr.ecr.us-west-2.amazonaws.com";
const ECR_REPO_NAME = path.join(
'core-platform',
'${{ github.event.repository.name }}',
'${{ inputs.working_directory }}',
'${{ inputs.image_name }}',
);
const IMAGE_URI = `${ECR_REGISTRY}/${ECR_REPO_NAME}:${{ inputs.image_tag }}`;
IMAGE_URI="$ECR_REGISTRY/$ECR_REPO_NAME:${{ inputs.image_tag }}"
echo "IMAGE_URI=$IMAGE_URI" >> $GITHUB_OUTPUT
core.setOutput('ECR_REGISTRY', ECR_REGISTRY);
core.setOutput('ECR_REPO_NAME', ECR_REPO_NAME);
core.setOutput('IMAGE_URI', IMAGE_URI);
- name: Create ECR repo if necessary
uses: int128/create-ecr-repository-action@v1
with:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/argus-docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
matrix:
image: ${{ fromJson(needs.prep.outputs.images) }}
steps:
- uses: chanzuckerberg/github-actions/.github/actions/argus-builder/docker-build@b7d8eaf3c08d100ded457432f9ce6be6d88932e3
- uses: chanzuckerberg/github-actions/.github/actions/argus-builder/docker-build@82b4571f2858a23e3c695ce48367f9497385e377
with:
image_name: ${{ matrix.image.name }}
dockerfile: ${{ matrix.image.dockerfile }}
Expand All @@ -99,6 +99,7 @@ jobs:
image_tag: ${{ needs.prep.outputs.image_tag }}
github_app_id: ${{ secrets.CZI_GITHUB_HELPER_APP_ID }}
github_private_key: ${{ secrets.CZI_GITHUB_HELPER_PK }}
working_directory: ${{ inputs.working_directory }}

update-manifests:
name: Update ArgoCD manifests
Expand Down

0 comments on commit cdbe4f8

Please sign in to comment.