Skip to content

Commit

Permalink
fix(workflows/docker-build-images): handle multi build-args
Browse files Browse the repository at this point in the history
Signed-off-by: Emilien Escalle <[email protected]>
  • Loading branch information
neilime committed Jan 27, 2025
1 parent b23ce52 commit 5b53f22
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ jobs:
"name": "test-prune-${{ github.run_number }}",
"context": ".",
"dockerfile": "./tests/application/Dockerfile",
"build-args": { "PROD_MODE": "true" },
"target": "prod",
"platforms": ["linux/amd64","linux/arm64"]
}
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/__test-workflow-docker-build-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ jobs:
secrets:
oci-registry-password: ${{ secrets.GITHUB_TOKEN }}
with:
# First image is multi arch, multi build-args
# Second image is mono arch, single build-args
images: |
[
{
"name": "application-multi-arch",
"context": ".",
"dockerfile": "./tests/application/Dockerfile",
"build-args": { "PROD_MODE": "true" },
"build-args": { "PROD_MODE": "true", "BUILD_ID": "${{ github.run_id }}" },
"target": "prod",
"platforms": ["linux/amd64","linux/arm64","linux/arm/v7"]
},
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/docker-build-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,12 @@ jobs:
uses: actions/[email protected]
with:
script: |
const images = JSON.parse(`${{ steps.validate-inputs.outputs.images }}`);
const imagesInput = `${{ steps.validate-inputs.outputs.images }}`;
const images = JSON.parse(imagesInput.replace(/\n/g, '\\n'));
const runsOnInput = `${{ inputs.runs-on }}`;
const isDefaultRunsOn = runsOnInput === '["ubuntu-latest"]';
runsOn = JSON.parse(runsOnInput);
const runsOn = JSON.parse(runsOnInput);
// See https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners
const standardHostedRunnerByPlatform = [
Expand Down

0 comments on commit 5b53f22

Please sign in to comment.