From 26aaca38a6cd6df4f547a08c897aad7b2079bbf5 Mon Sep 17 00:00:00 2001 From: tom goriunov Date: Mon, 10 Feb 2025 18:37:34 +0100 Subject: [PATCH] Update tag convention for docker images (#2566) * Update tag convention for docker images * change default input flavor behavior * [skip ci] ooops * [skip ci] fix typo --- .github/workflows/deploy-main.yml | 4 ++++ .github/workflows/deploy-review-l2.yml | 3 ++- .github/workflows/deploy-review.yml | 3 ++- .github/workflows/e2e-tests.yml | 6 ++++++ .github/workflows/publish-image.yml | 11 ++++++++--- .github/workflows/release.yml | 3 +++ 6 files changed, 25 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy-main.yml b/.github/workflows/deploy-main.yml index 73bdd72cf7..8a7cd4bc8c 100644 --- a/.github/workflows/deploy-main.yml +++ b/.github/workflows/deploy-main.yml @@ -25,3 +25,7 @@ jobs: name: Publish Docker image uses: './.github/workflows/publish-image.yml' secrets: inherit + with: + tags: | + type=ref,event=branch + type=raw,value=unstable diff --git a/.github/workflows/deploy-review-l2.yml b/.github/workflows/deploy-review-l2.yml index 5df2f0d45c..e8f4afa7b5 100644 --- a/.github/workflows/deploy-review-l2.yml +++ b/.github/workflows/deploy-review-l2.yml @@ -53,7 +53,8 @@ jobs: needs: make_slug uses: './.github/workflows/publish-image.yml' with: - tags: ghcr.io/blockscout/frontend:review-${{ needs.make_slug.outputs.REF_SLUG }} + tags: | + type=raw,value=review-${{ needs.make_slug.outputs.REF_SLUG }} build_args: ENVS_PRESET=${{ inputs.envs_preset }} secrets: inherit diff --git a/.github/workflows/deploy-review.yml b/.github/workflows/deploy-review.yml index 3b050858c0..a0c346af6b 100644 --- a/.github/workflows/deploy-review.yml +++ b/.github/workflows/deploy-review.yml @@ -54,7 +54,8 @@ jobs: needs: make_slug uses: './.github/workflows/publish-image.yml' with: - tags: ghcr.io/blockscout/frontend:review-${{ needs.make_slug.outputs.REF_SLUG }} + tags: | + type=raw,value=review-${{ needs.make_slug.outputs.REF_SLUG }} build_args: ENVS_PRESET=${{ inputs.envs_preset }} secrets: inherit diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 6aab1f48ff..74faa22a26 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -13,6 +13,12 @@ jobs: name: Publish Docker image uses: './.github/workflows/publish-image.yml' secrets: inherit + with: + # FIXME: e2e tests has default docker image tag "main" - https://github.com/blockscout/blockscout-ci-cd/blob/56a5424cfa07b03ca378e04650c4c67650ec40a0/charts/blockscout-stack/values/e2e/values.yaml#L352 + # NOTE: by default the image will be built with type=ref,event=tag; so we don't need to specify it here + tags: | + type=raw,value=main + type=ref,event=branch deploy_e2e: name: Deploy E2E instance diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index 97c1102e8f..177f57f735 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: inputs: tags: - description: Image tags + description: Image tags (e.g. "type=raw,value=foo") required: false type: string build_args: @@ -19,7 +19,7 @@ on: workflow_call: inputs: tags: - description: Image tags + description: Image tags (e.g. "type=raw,value=foo") required: false type: string build_args: @@ -49,6 +49,11 @@ jobs: uses: docker/metadata-action@v5 with: images: ghcr.io/blockscout/frontend + flavor: | + latest=false + tags: | + type=ref,event=tag + ${{ inputs.tags }} - name: Login to GitHub Container Registry uses: docker/login-action@v2 @@ -75,7 +80,7 @@ jobs: file: ./Dockerfile push: true cache-from: type=gha - tags: ${{ inputs.tags || steps.meta.outputs.tags }} + tags: ${{ steps.meta.outputs.tags }} platforms: ${{ inputs.platforms }} labels: ${{ steps.meta.outputs.labels }} build-args: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7485ee7c82..f82c6046ab 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -80,6 +80,9 @@ jobs: secrets: inherit with: platforms: linux/amd64,linux/arm64/v8 + # NOTE: by default the image will be built with type=ref,event=tag; so we need to specify it here + tags: | + type=raw,value=latest sync_envs_docs: name: Sync ENV variables docs