Skip to content

Commit

Permalink
feat: support build_args in argus docker builder workflow (#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
hspitzley-czi authored Jul 3, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent a9e8928 commit 95e9d8d
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions .github/workflows/argus-docker-build.yaml
Original file line number Diff line number Diff line change
@@ -82,6 +82,17 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get build tag
id: build-tags
run: |
echo "IMAGE_TAG=sha-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Validate build tag
id: validate_image_tag
uses: actions/github-script@v7
with:
script: |
const imageTag = `${{ steps.build-tags.outputs.IMAGE_TAG }}`;
core.setOutput('image_tag_valid', imageTag !== '' && imageTag !== 'sha-');
- name: Parse inputs
id: parse_inputs
uses: actions/github-script@v7
@@ -92,6 +103,11 @@ jobs:
core.setOutput('filters', filtersStr);
const images = JSON.parse(`${{ inputs.images }}`);
images.forEach(image => {
const buildArgs = image.build_args || [];
image.build_args = ["IMAGE_TAG=${{ steps.build-tags.outputs.IMAGE_TAG }}", ...buildArgs].join("\n");
});
core.info(`Images to build: ${JSON.stringify(images, null, 2)}`);
core.setOutput('images', images);
const envs = `${{ inputs.envs }}`.split(',').map(env => env.trim()).filter(b => b.length > 0);
@@ -105,17 +121,6 @@ jobs:
${{ steps.parse_inputs.outputs.filters }}
base: ${{ inputs.path_filters_base }}
list-files: json
- name: Get build tag
id: build-tags
run: |
echo "IMAGE_TAG=sha-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Validate build tag
id: validate_image_tag
uses: actions/github-script@v7
with:
script: |
const imageTag = `${{ steps.build-tags.outputs.IMAGE_TAG }}`;
core.setOutput('image_tag_valid', imageTag !== '' && imageTag !== 'sha-');

build-docker:
name: Build Docker Image
@@ -172,8 +177,7 @@ jobs:
registry: 533267185808.dkr.ecr.us-west-2.amazonaws.com
custom_tag: ${{ env.IMAGE_TAG }}
platforms: ${{ matrix.image.platform == 'linux/amd64' && 'linux/amd64' || 'linux/arm64' }}
build_args: IMAGE_TAG=${{ env.IMAGE_TAG }}

build_args: ${{ matrix.image.build_args }}
update-manifests:
name: Update ArgoCD manifests
needs: [prep, build-docker]

0 comments on commit 95e9d8d

Please sign in to comment.