Skip to content

Commit bc24cae

Browse files
authored
Merge pull request moby#3570 from crazy-max/ci-simplify
ci: create matrix for building frontend image
2 parents 75b4395 + 2762749 commit bc24cae

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

.github/workflows/build.yml

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,8 @@ jobs:
398398
if: github.event_name != 'schedule'
399399
outputs:
400400
typ: ${{ steps.prep.outputs.typ }}
401-
tag: ${{ steps.prep.outputs.tag }}
402401
push: ${{ steps.prep.outputs.push }}
402+
matrix: ${{ steps.prep.outputs.matrix }}
403403
steps:
404404
-
405405
name: Prepare
@@ -416,14 +416,30 @@ jobs:
416416
PUSH=push
417417
fi
418418
echo "typ=${TYP}" >>${GITHUB_OUTPUT}
419-
echo "tag=${TAG}" >>${GITHUB_OUTPUT}
420419
echo "push=${PUSH}" >>${GITHUB_OUTPUT}
420+
if [ "${TYP}" = "master" ]; then
421+
echo "matrix=$(jq -cn --arg tag "$TAG" '[$tag, "labs"]')" >>${GITHUB_OUTPUT}
422+
else
423+
echo "matrix=$(jq -cn --arg tag "$TAG" '[$tag]')" >>${GITHUB_OUTPUT}
424+
fi
421425
422426
frontend-image:
423427
runs-on: ubuntu-20.04
424428
if: github.event_name != 'schedule'
425429
needs: [frontend-base, test]
430+
strategy:
431+
fail-fast: false
432+
matrix:
433+
tag: ${{ fromJson(needs.frontend-base.outputs.matrix) }}
426434
steps:
435+
-
436+
name: Prepare
437+
run: |
438+
if [ "${{ matrix.tag }}" = "labs" ]; then
439+
echo "CACHE_SCOPE=frontend-labs" >>${GITHUB_ENV}
440+
else
441+
echo "CACHE_SCOPE=frontend-mainline" >>${GITHUB_ENV}
442+
fi
427443
-
428444
name: Checkout
429445
uses: actions/checkout@v3
@@ -448,18 +464,10 @@ jobs:
448464
username: ${{ secrets.DOCKERHUB_USERNAME }}
449465
password: ${{ secrets.DOCKERHUB_TOKEN }}
450466
-
451-
name: Build ${{ needs.frontend-base.outputs.typ }}/${{ needs.frontend-base.outputs.tag }}
452-
run: |
453-
./frontend/dockerfile/cmd/dockerfile-frontend/hack/release "${{ needs.frontend-base.outputs.typ }}" "${{ needs.frontend-base.outputs.tag }}" "$DF_REPO_SLUG_TARGET" "${{ needs.frontend-base.outputs.push }}"
454-
env:
455-
PLATFORMS: ${{ env.PLATFORMS }},linux/386,linux/mips,linux/mipsle,linux/mips64,linux/mips64le
456-
CACHE_FROM: type=gha,scope=frontend-${{ needs.frontend-base.outputs.typ }}
457-
CACHE_TO: type=gha,scope=frontend-${{ needs.frontend-base.outputs.typ }}
458-
-
459-
name: Build ${{ needs.frontend-base.outputs.typ }}/labs
460-
if: needs.frontend-base.outputs.typ == 'master'
467+
name: Build
461468
run: |
462-
./frontend/dockerfile/cmd/dockerfile-frontend/hack/release "${{ needs.frontend-base.outputs.typ }}" labs "$DF_REPO_SLUG_TARGET" "${{ needs.frontend-base.outputs.push }}"
469+
./frontend/dockerfile/cmd/dockerfile-frontend/hack/release "${{ needs.frontend-base.outputs.typ }}" "${{ matrix.tag }}" "$DF_REPO_SLUG_TARGET" "${{ needs.frontend-base.outputs.push }}"
463470
env:
464471
PLATFORMS: ${{ env.PLATFORMS }},linux/386,linux/mips,linux/mipsle,linux/mips64,linux/mips64le
465-
CACHE_FROM: type=gha,scope=frontend-${{ needs.frontend-base.outputs.typ }}
472+
CACHE_FROM: type=gha,scope=${{ env.CACHE_SCOPE }}
473+
CACHE_TO: type=gha,scope=${{ env.CACHE_SCOPE }}

0 commit comments

Comments
 (0)