From 7b477e31c41ecd31c35f1d3cb4d7d6c8bf31aa17 Mon Sep 17 00:00:00 2001 From: Leonard Jonathan Oh Date: Sun, 12 Sep 2021 18:01:32 +0000 Subject: [PATCH 1/2] Fix (ci): Fix publish-draft-release job to use tag from resolve-release-tag job --- .github/workflows/ci-master-pr.yml | 2 +- generate/templates/.github/workflows/ci-master-pr.yml.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-master-pr.yml b/.github/workflows/ci-master-pr.yml index 0337040..eb5a01f 100644 --- a/.github/workflows/ci-master-pr.yml +++ b/.github/workflows/ci-master-pr.yml @@ -2423,7 +2423,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} publish-draft-release: - needs: [build-v1-22-0-alpine-3-8, build-v1-22-0-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-21-0-alpine-3-8, build-v1-21-0-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-20-4-alpine-3-8, build-v1-20-4-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-19-7-alpine-3-8, build-v1-19-7-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-18-15-alpine-3-8, build-v1-18-15-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-17-17-alpine-3-8, build-v1-17-17-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-16-15-alpine-3-8, build-v1-16-15-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-15-12-alpine-3-8, build-v1-15-12-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-14-10-alpine-3-8, build-v1-14-10-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, converge-master-and-release-branches] + needs: [build-v1-22-0-alpine-3-8, build-v1-22-0-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-21-0-alpine-3-8, build-v1-21-0-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-20-4-alpine-3-8, build-v1-20-4-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-19-7-alpine-3-8, build-v1-19-7-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-18-15-alpine-3-8, build-v1-18-15-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-17-17-alpine-3-8, build-v1-17-17-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-16-15-alpine-3-8, build-v1-16-15-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-15-12-alpine-3-8, build-v1-15-12-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, build-v1-14-10-alpine-3-8, build-v1-14-10-envsubst-git-jq-kustomize-sops-ssh-alpine-3-8, converge-master-and-release-branches, resolve-release-tag] # For Generate-DockerImageVariants: For CalVer releases. Each push to 'release' branch is a time-based release. # if: startsWith(github.ref, 'refs/tags/') if: github.ref == 'refs/heads/release' diff --git a/generate/templates/.github/workflows/ci-master-pr.yml.ps1 b/generate/templates/.github/workflows/ci-master-pr.yml.ps1 index d9e365d..d28d631 100644 --- a/generate/templates/.github/workflows/ci-master-pr.yml.ps1 +++ b/generate/templates/.github/workflows/ci-master-pr.yml.ps1 @@ -252,7 +252,7 @@ if ( $_['tag_as_latest'] ) { publish-draft-release: - needs: [$( $local:WORKFLOW_JOB_NAMES -join ', ' ), converge-master-and-release-branches] + needs: [$( $local:WORKFLOW_JOB_NAMES -join ', ' ), converge-master-and-release-branches, resolve-release-tag] "@ @' From b2c0edbaff497da2cfd22c3c30bb26f8e2aaa138 Mon Sep 17 00:00:00 2001 From: Leonard Jonathan Oh Date: Sun, 12 Sep 2021 21:07:26 +0000 Subject: [PATCH 2/2] Refactor (ci): Update ci-master-pr template to only build multi arch image for alpine >3.5 --- .../.github/workflows/ci-master-pr.yml.ps1 | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/generate/templates/.github/workflows/ci-master-pr.yml.ps1 b/generate/templates/.github/workflows/ci-master-pr.yml.ps1 index d28d631..1ac0a22 100644 --- a/generate/templates/.github/workflows/ci-master-pr.yml.ps1 +++ b/generate/templates/.github/workflows/ci-master-pr.yml.ps1 @@ -13,7 +13,7 @@ jobs: '@ $local:WORKFLOW_JOB_NAMES = $VARIANTS | % { "build-$( $_['tag'].Replace('.', '-') )" } -$( $VARIANTS | % { +$VARIANTS | % { @" @@ -97,18 +97,21 @@ $( $VARIANTS | % { DOCKERHUB_REGISTRY_USER: ${{ secrets.DOCKERHUB_REGISTRY_USER }} DOCKERHUB_REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_REGISTRY_PASSWORD }} + +'@ +@" - name: Build (PRs) id: docker_build_pr # Run only on pull requests if: github.event_name == 'pull_request' uses: docker/build-push-action@v2 with: - context: ${{ steps.prep.outputs.CONTEXT }} - platforms: linux/386,linux/amd64,linux/arm,linux/arm64,linux/s390x + context: `${{ steps.prep.outputs.CONTEXT }} + platforms: $( if ($_['_metadata']['distro'] -eq 'alpine' -and $_['_metadata']['distro_version'] -in @( '3.3', '3.4', '3.5' ) ) { 'linux/amd64' } else { 'linux/386,linux/amd64,linux/arm,linux/arm64,linux/s390x' } ) push: false tags: | - ${{ github.repository }}:${{ steps.prep.outputs.VARIANT_TAG_WITH_REF }} - ${{ github.repository }}:${{ steps.prep.outputs.VARIANT_TAG_WITH_REF_AND_SHA_SHORT }} + `${{ github.repository }}:`${{ steps.prep.outputs.VARIANT_TAG_WITH_REF }} + `${{ github.repository }}:`${{ steps.prep.outputs.VARIANT_TAG_WITH_REF_AND_SHA_SHORT }} cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache @@ -118,12 +121,12 @@ $( $VARIANTS | % { if: github.ref == 'refs/heads/master' uses: docker/build-push-action@v2 with: - context: ${{ steps.prep.outputs.CONTEXT }} - platforms: linux/386,linux/amd64,linux/arm,linux/arm64,linux/s390x + context: `${{ steps.prep.outputs.CONTEXT }} + platforms: $( if ($_['_metadata']['distro'] -eq 'alpine' -and $_['_metadata']['distro_version'] -in @( '3.3', '3.4', '3.5' ) ) { 'linux/amd64' } else { 'linux/386,linux/amd64,linux/arm,linux/arm64,linux/s390x' } ) push: true tags: | - ${{ github.repository }}:${{ steps.prep.outputs.VARIANT_TAG_WITH_REF }} - ${{ github.repository }}:${{ steps.prep.outputs.VARIANT_TAG_WITH_REF_AND_SHA_SHORT }} + `${{ github.repository }}:`${{ steps.prep.outputs.VARIANT_TAG_WITH_REF }} + `${{ github.repository }}:`${{ steps.prep.outputs.VARIANT_TAG_WITH_REF_AND_SHA_SHORT }} cache-to: type=local,dest=/tmp/.buildx-cache - name: Build and push (release) @@ -133,15 +136,15 @@ $( $VARIANTS | % { if: github.ref == 'refs/heads/release' uses: docker/build-push-action@v2 with: - context: ${{ steps.prep.outputs.CONTEXT }} - platforms: linux/386,linux/amd64,linux/arm,linux/arm64,linux/s390x + context: `${{ steps.prep.outputs.CONTEXT }} + platforms: $( if ($_['_metadata']['distro'] -eq 'alpine' -and $_['_metadata']['distro_version'] -in @( '3.3', '3.4', '3.5' ) ) { 'linux/amd64' } else { 'linux/386,linux/amd64,linux/arm,linux/arm64,linux/s390x' } ) push: true tags: | - ${{ github.repository }}:${{ steps.prep.outputs.VARIANT_TAG }} - ${{ github.repository }}:${{ steps.prep.outputs.VARIANT_TAG_WITH_REF }} - ${{ github.repository }}:${{ steps.prep.outputs.VARIANT_TAG_WITH_REF_AND_SHA_SHORT }} + `${{ github.repository }}:`${{ steps.prep.outputs.VARIANT_TAG }} + `${{ github.repository }}:`${{ steps.prep.outputs.VARIANT_TAG_WITH_REF }} + `${{ github.repository }}:`${{ steps.prep.outputs.VARIANT_TAG_WITH_REF_AND_SHA_SHORT }} -'@ +"@ if ( $_['tag_as_latest'] ) { @' @@ -160,7 +163,7 @@ if ( $_['tag_as_latest'] ) { run: docker logout if: always() '@ -}) +} @"