From e6d3d21f9b71641becc5e5a184351bfe75d81a29 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Sat, 30 Nov 2024 22:44:56 +0100 Subject: [PATCH] gha: move docker login step up Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- content/guides/bun/configure-ci-cd.md | 11 +- content/guides/cpp/configure-ci-cd.md | 2 + content/guides/dotnet/configure-ci-cd.md | 3 + content/guides/golang/configure-ci-cd.md | 2 + content/guides/java/configure-ci-cd.md | 3 + content/guides/nodejs/configure-ci-cd.md | 5 +- content/guides/php/configure-ci-cd.md | 3 + content/guides/python/configure-ci-cd.md | 2 + content/guides/r/configure-ci-cd.md | 2 + content/guides/ruby/configure-ci-cd.md | 3 +- content/guides/rust/configure-ci-cd.md | 2 + content/manuals/build-cloud/ci.md | 4 +- .../manuals/build/bake/remote-definition.md | 3 +- content/manuals/build/cache/optimize.md | 8 +- .../manuals/build/ci/github-actions/_index.md | 22 ++-- .../build/ci/github-actions/annotations.md | 18 +-- .../build/ci/github-actions/attestations.md | 12 +- .../build/ci/github-actions/build-summary.md | 10 +- .../manuals/build/ci/github-actions/cache.md | 46 ++++---- .../manuals/build/ci/github-actions/checks.md | 12 +- .../github-actions/copy-image-registries.md | 16 +-- .../ci/github-actions/manage-tags-labels.md | 18 +-- .../build/ci/github-actions/multi-platform.md | 108 +++++++++--------- .../build/ci/github-actions/named-contexts.md | 12 +- .../github-actions/push-multi-registries.md | 16 +-- .../ci/github-actions/reproducible-builds.md | 16 +-- .../build/ci/github-actions/secrets.md | 10 +- .../ci/github-actions/share-image-jobs.md | 6 +- .../ci/github-actions/test-before-push.md | 18 +-- .../github-actions/update-dockerhub-desc.md | 16 +-- content/manuals/scout/integrations/ci/gha.md | 6 +- content/manuals/scout/policy/ci.md | 6 +- 32 files changed, 223 insertions(+), 198 deletions(-) diff --git a/content/guides/bun/configure-ci-cd.md b/content/guides/bun/configure-ci-cd.md index 0f614a9c387..b1634220ff1 100644 --- a/content/guides/bun/configure-ci-cd.md +++ b/content/guides/bun/configure-ci-cd.md @@ -79,17 +79,16 @@ to Docker Hub. build: runs-on: ubuntu-latest steps: - - - name: Login to Docker Hub + - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ vars.DOCKER_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Set up Docker Buildx + + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - - name: Build and push + + - name: Build and push uses: docker/build-push-action@v6 with: platforms: linux/amd64,linux/arm64 diff --git a/content/guides/cpp/configure-ci-cd.md b/content/guides/cpp/configure-ci-cd.md index 57145b8e74d..9b4d289de10 100644 --- a/content/guides/cpp/configure-ci-cd.md +++ b/content/guides/cpp/configure-ci-cd.md @@ -85,8 +85,10 @@ to Docker Hub. with: username: ${{ vars.DOCKER_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Build and push uses: docker/build-push-action@v6 with: diff --git a/content/guides/dotnet/configure-ci-cd.md b/content/guides/dotnet/configure-ci-cd.md index a01592e2fb5..b951f25f739 100644 --- a/content/guides/dotnet/configure-ci-cd.md +++ b/content/guides/dotnet/configure-ci-cd.md @@ -93,13 +93,16 @@ to Docker Hub. with: username: ${{ vars.DOCKER_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Build and test uses: docker/build-push-action@v6 with: target: build load: true + - name: Build and push uses: docker/build-push-action@v6 with: diff --git a/content/guides/golang/configure-ci-cd.md b/content/guides/golang/configure-ci-cd.md index 09a2adbdc53..92c9fef314b 100644 --- a/content/guides/golang/configure-ci-cd.md +++ b/content/guides/golang/configure-ci-cd.md @@ -85,8 +85,10 @@ to Docker Hub. with: username: ${{ vars.DOCKER_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Build and push uses: docker/build-push-action@v6 with: diff --git a/content/guides/java/configure-ci-cd.md b/content/guides/java/configure-ci-cd.md index 370bf89b745..0fa8043a015 100644 --- a/content/guides/java/configure-ci-cd.md +++ b/content/guides/java/configure-ci-cd.md @@ -88,13 +88,16 @@ to Docker Hub. with: username: ${{ vars.DOCKER_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Build and test uses: docker/build-push-action@v6 with: target: test load: true + - name: Build and push uses: docker/build-push-action@v6 with: diff --git a/content/guides/nodejs/configure-ci-cd.md b/content/guides/nodejs/configure-ci-cd.md index a71a62ad9a0..947f8c80c6b 100644 --- a/content/guides/nodejs/configure-ci-cd.md +++ b/content/guides/nodejs/configure-ci-cd.md @@ -85,17 +85,20 @@ to Docker Hub. with: username: ${{ vars.DOCKER_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Build and test uses: docker/build-push-action@v6 with: target: test load: true + - name: Build and push uses: docker/build-push-action@v6 with: - platforms: linux/amd64,linux/arm64/v8 + platforms: linux/amd64,linux/arm64 push: true target: prod tags: ${{ vars.DOCKER_USERNAME }}/${{ github.event.repository.name }}:latest diff --git a/content/guides/php/configure-ci-cd.md b/content/guides/php/configure-ci-cd.md index 0c94ff1bb13..90b5ccba5a5 100644 --- a/content/guides/php/configure-ci-cd.md +++ b/content/guides/php/configure-ci-cd.md @@ -93,13 +93,16 @@ to Docker Hub. with: username: ${{ vars.DOCKER_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Build and test uses: docker/build-push-action@v6 with: target: test load: true + - name: Build and push uses: docker/build-push-action@v6 with: diff --git a/content/guides/python/configure-ci-cd.md b/content/guides/python/configure-ci-cd.md index 4d61495f0fa..621b42ce019 100644 --- a/content/guides/python/configure-ci-cd.md +++ b/content/guides/python/configure-ci-cd.md @@ -85,8 +85,10 @@ to Docker Hub. with: username: ${{ vars.DOCKER_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Build and push uses: docker/build-push-action@v6 with: diff --git a/content/guides/r/configure-ci-cd.md b/content/guides/r/configure-ci-cd.md index 2c7ebf6031c..6faa7d0bbc5 100644 --- a/content/guides/r/configure-ci-cd.md +++ b/content/guides/r/configure-ci-cd.md @@ -85,8 +85,10 @@ to Docker Hub. with: username: ${{ vars.DOCKER_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Build and push uses: docker/build-push-action@v6 with: diff --git a/content/guides/ruby/configure-ci-cd.md b/content/guides/ruby/configure-ci-cd.md index 9b81c5ec57d..254798f5b12 100644 --- a/content/guides/ruby/configure-ci-cd.md +++ b/content/guides/ruby/configure-ci-cd.md @@ -85,12 +85,13 @@ to Docker Hub. with: username: ${{ vars.DOCKER_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Build and push uses: docker/build-push-action@v6 with: - platforms: linux/amd64 push: true tags: ${{ vars.DOCKER_USERNAME }}/${{ github.event.repository.name }}:latest ``` diff --git a/content/guides/rust/configure-ci-cd.md b/content/guides/rust/configure-ci-cd.md index 5efd4c31cce..cf3832b2834 100644 --- a/content/guides/rust/configure-ci-cd.md +++ b/content/guides/rust/configure-ci-cd.md @@ -85,8 +85,10 @@ to Docker Hub. with: username: ${{ vars.DOCKER_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Build and push uses: docker/build-push-action@v6 with: diff --git a/content/manuals/build-cloud/ci.md b/content/manuals/build-cloud/ci.md index f38ebdc40ca..03b2064cc85 100644 --- a/content/manuals/build-cloud/ci.md +++ b/content/manuals/build-cloud/ci.md @@ -65,11 +65,12 @@ jobs: docker: runs-on: ubuntu-latest steps: - - name: Log in to Docker Hub + - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ vars.DOCKER_USER }} password: ${{ secrets.DOCKER_PAT }} + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 with: @@ -77,6 +78,7 @@ jobs: driver: cloud endpoint: "/default" install: true + - name: Build and push uses: docker/build-push-action@v6 with: diff --git a/content/manuals/build/bake/remote-definition.md b/content/manuals/build/bake/remote-definition.md index b3caab8f57f..89e454e2453 100644 --- a/content/manuals/build/bake/remote-definition.md +++ b/content/manuals/build/bake/remote-definition.md @@ -173,8 +173,7 @@ remote definition and the local "metadata-only" Bake file, specify both files and use the `cwd://` prefix for the metadata Bake file: ```yml - - - name: Build + - name: Build uses: docker/bake-action@v4 with: source: "${{ github.server_url }}/${{ github.repository }}.git#${{ github.ref }}" diff --git a/content/manuals/build/cache/optimize.md b/content/manuals/build/cache/optimize.md index f046ca1a9c7..3e0dfed9f78 100644 --- a/content/manuals/build/cache/optimize.md +++ b/content/manuals/build/cache/optimize.md @@ -323,15 +323,15 @@ jobs: docker: runs-on: ubuntu-latest steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build and push uses: docker/build-push-action@v6 with: diff --git a/content/manuals/build/ci/github-actions/_index.md b/content/manuals/build/ci/github-actions/_index.md index d51d9285f72..783d387a010 100644 --- a/content/manuals/build/ci/github-actions/_index.md +++ b/content/manuals/build/ci/github-actions/_index.md @@ -122,17 +122,16 @@ jobs: build: runs-on: ubuntu-latest steps: - - - name: Login to Docker Hub + - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Set up Docker Buildx + + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - - name: Build and push + + - name: Build and push uses: docker/build-push-action@v6 with: push: true @@ -170,17 +169,16 @@ jobs: build: runs-on: ubuntu-latest steps: - - - name: Login to Docker Hub + - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Set up Docker Buildx + + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - - name: Build and push + + - name: Build and push uses: docker/build-push-action@v6 with: push: true diff --git a/content/manuals/build/ci/github-actions/annotations.md b/content/manuals/build/ci/github-actions/annotations.md index 713c452f476..df52d16afa0 100644 --- a/content/manuals/build/ci/github-actions/annotations.md +++ b/content/manuals/build/ci/github-actions/annotations.md @@ -33,15 +33,15 @@ jobs: docker: runs-on: ubuntu-latest steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Extract metadata id: meta uses: docker/metadata-action@v5 @@ -75,14 +75,14 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - name: Extract metadata id: meta @@ -128,14 +128,14 @@ jobs: docker: runs-on: ubuntu-latest steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - name: Extract metadata id: meta diff --git a/content/manuals/build/ci/github-actions/attestations.md b/content/manuals/build/ci/github-actions/attestations.md index 4e37da3df78..eb99baf0d2d 100644 --- a/content/manuals/build/ci/github-actions/attestations.md +++ b/content/manuals/build/ci/github-actions/attestations.md @@ -62,14 +62,14 @@ jobs: docker: runs-on: ubuntu-latest steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - name: Extract metadata id: meta @@ -108,15 +108,15 @@ jobs: docker: runs-on: ubuntu-latest steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Extract metadata id: meta uses: docker/metadata-action@v5 diff --git a/content/manuals/build/ci/github-actions/build-summary.md b/content/manuals/build/ci/github-actions/build-summary.md index df64c5e4387..c41c654c042 100644 --- a/content/manuals/build/ci/github-actions/build-summary.md +++ b/content/manuals/build/ci/github-actions/build-summary.md @@ -69,9 +69,8 @@ select the item in the list. To disable job summaries, set the `DOCKER_BUILD_SUMMARY` environment variable in the YAML configuration for your build step: -```yaml {hl_lines=5} - - - name: Build +```yaml {hl_lines=4} + - name: Build uses: docker/docker-build-push-action@v6 env: DOCKER_BUILD_SUMMARY: false @@ -86,9 +85,8 @@ To disable the upload of the build record archive to GitHub, set the `DOCKER_BUILD_RECORD_UPLOAD` environment variable in the YAML configuration for your build step: -```yaml {hl_lines=5} - - - name: Build +```yaml {hl_lines=4} + - name: Build uses: docker/docker-build-push-action@v6 env: DOCKER_BUILD_RECORD_UPLOAD: false diff --git a/content/manuals/build/ci/github-actions/cache.md b/content/manuals/build/ci/github-actions/cache.md index eb8d9d47d69..bb12ba8b660 100644 --- a/content/manuals/build/ci/github-actions/cache.md +++ b/content/manuals/build/ci/github-actions/cache.md @@ -29,14 +29,14 @@ jobs: docker: runs-on: ubuntu-latest steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - name: Build and push uses: docker/build-push-action@v6 @@ -62,15 +62,15 @@ jobs: docker: runs-on: ubuntu-latest steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build and push uses: docker/build-push-action@v6 with: @@ -107,15 +107,15 @@ jobs: docker: runs-on: ubuntu-latest steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build and push uses: docker/build-push-action@v6 with: @@ -165,6 +165,12 @@ jobs: build: runs-on: ubuntu-latest steps: + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -175,7 +181,7 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: YOUR_IMAGE + images: user/app tags: | type=ref,event=branch type=ref,event=pr @@ -188,7 +194,7 @@ jobs: path: go-build-cache key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum') }} - - name: inject go-build-cache into docker + - name: Inject go-build-cache uses: reproducible-containers/buildkit-cache-dance@4b2444fec0c0fb9dbf175a96c094720a692ef810 # v2.1.4 with: cache-source: go-build-cache @@ -230,9 +236,15 @@ jobs: docker: runs-on: ubuntu-latest steps: + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - + - name: Cache Docker layers uses: actions/cache@v4 with: @@ -240,13 +252,7 @@ jobs: key: ${{ runner.os }}-buildx-${{ github.sha }} restore-keys: | ${{ runner.os }}-buildx- - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ vars.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - + - name: Build and push uses: docker/build-push-action@v6 with: @@ -254,7 +260,7 @@ jobs: tags: user/app:latest cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max - + - # Temp fix # https://github.com/docker/build-push-action/issues/252 # https://github.com/moby/buildkit/issues/1896 diff --git a/content/manuals/build/ci/github-actions/checks.md b/content/manuals/build/ci/github-actions/checks.md index 038eee838a5..dc3bda46314 100644 --- a/content/manuals/build/ci/github-actions/checks.md +++ b/content/manuals/build/ci/github-actions/checks.md @@ -24,14 +24,14 @@ jobs: docker: runs-on: ubuntu-latest steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - name: Validate build configuration uses: docker/build-push-action@v6 @@ -81,15 +81,15 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Validate build configuration uses: docker/bake-action@v5 with: diff --git a/content/manuals/build/ci/github-actions/copy-image-registries.md b/content/manuals/build/ci/github-actions/copy-image-registries.md index b66e9f6739a..4897a070f8f 100644 --- a/content/manuals/build/ci/github-actions/copy-image-registries.md +++ b/content/manuals/build/ci/github-actions/copy-image-registries.md @@ -18,25 +18,25 @@ jobs: docker: runs-on: ubuntu-latest steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - + - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build and push uses: docker/build-push-action@v6 with: @@ -45,7 +45,7 @@ jobs: tags: | user/app:latest user/app:1.0.0 - + - name: Push image to GHCR run: | docker buildx imagetools create \ diff --git a/content/manuals/build/ci/github-actions/manage-tags-labels.md b/content/manuals/build/ci/github-actions/manage-tags-labels.md index 162536a63d0..00d2082585b 100644 --- a/content/manuals/build/ci/github-actions/manage-tags-labels.md +++ b/content/manuals/build/ci/github-actions/manage-tags-labels.md @@ -44,20 +44,14 @@ jobs: type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} type=sha - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - + - name: Login to Docker Hub if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - + - name: Login to GHCR if: github.event_name != 'pull_request' uses: docker/login-action@v3 @@ -65,7 +59,13 @@ jobs: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build and push uses: docker/build-push-action@v6 with: diff --git a/content/manuals/build/ci/github-actions/multi-platform.md b/content/manuals/build/ci/github-actions/multi-platform.md index 0d4d2bfd58c..7311ee2cac5 100644 --- a/content/manuals/build/ci/github-actions/multi-platform.md +++ b/content/manuals/build/ci/github-actions/multi-platform.md @@ -25,18 +25,18 @@ jobs: docker: runs-on: ubuntu-latest steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build and push uses: docker/build-push-action@v6 with: @@ -81,15 +81,15 @@ jobs: } } - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Build and push uses: docker/build-push-action@v6 with: @@ -139,25 +139,25 @@ jobs: run: | platform=${{ matrix.platform }} echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV - + - name: Docker meta id: meta uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY_IMAGE }} - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - + - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build and push by digest id: build uses: docker/build-push-action@v6 @@ -165,13 +165,13 @@ jobs: platforms: ${{ matrix.platform }} labels: ${{ steps.meta.outputs.labels }} outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true - + - name: Export digest run: | mkdir -p /tmp/digests digest="${{ steps.build.outputs.digest }}" touch "/tmp/digests/${digest#sha256:}" - + - name: Upload digest uses: actions/upload-artifact@v4 with: @@ -191,28 +191,28 @@ jobs: path: /tmp/digests pattern: digests-* merge-multiple: true - + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - + - name: Docker meta id: meta uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY_IMAGE }} - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ vars.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - + - name: Create manifest list and push working-directory: /tmp/digests run: | docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) - + - name: Inspect image run: | docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} @@ -280,26 +280,26 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - + - name: Create matrix id: platforms run: | echo "matrix=$(docker buildx bake image-all --print | jq -cr '.target."image-all".platforms')" >>${GITHUB_OUTPUT} - + - name: Show matrix run: | echo ${{ steps.platforms.outputs.matrix }} - + - name: Docker meta id: meta uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY_IMAGE }} - + - name: Rename meta bake definition file run: | mv "${{ steps.meta.outputs.bake-file }}" "/tmp/bake-meta.json" - + - name: Upload meta bake definition uses: actions/upload-artifact@v4 with: @@ -321,28 +321,28 @@ jobs: run: | platform=${{ matrix.platform }} echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV - + - name: Checkout uses: actions/checkout@v4 - + - name: Download meta bake definition uses: actions/download-artifact@v4 with: name: bake-meta path: /tmp - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build id: bake uses: docker/bake-action@v5 @@ -355,13 +355,13 @@ jobs: *.tags= *.platform=${{ matrix.platform }} *.output=type=image,"name=${{ env.REGISTRY_IMAGE }}",push-by-digest=true,name-canonical=true,push=true - + - name: Export digest run: | mkdir -p /tmp/digests digest="${{ fromJSON(steps.bake.outputs.metadata).image['containerimage.digest'] }}" touch "/tmp/digests/${digest#sha256:}" - + - name: Upload digest uses: actions/upload-artifact@v4 with: @@ -380,29 +380,29 @@ jobs: with: name: bake-meta path: /tmp - + - name: Download digests uses: actions/download-artifact@v4 with: path: /tmp/digests pattern: digests-* merge-multiple: true - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - + - name: Login to DockerHub uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Create manifest list and push working-directory: /tmp/digests run: | docker buildx imagetools create $(jq -cr '.target."docker-metadata-action".tags | map(select(startswith("${{ env.REGISTRY_IMAGE }}")) | "-t " + .) | join(" ")' /tmp/bake-meta.json) \ $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) - + - name: Inspect image run: | docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:$(jq -r '.target."docker-metadata-action".args.DOCKER_META_VERSION' /tmp/bake-meta.json) diff --git a/content/manuals/build/ci/github-actions/named-contexts.md b/content/manuals/build/ci/github-actions/named-contexts.md index fe81c03e073..0419bae733a 100644 --- a/content/manuals/build/ci/github-actions/named-contexts.md +++ b/content/manuals/build/ci/github-actions/named-contexts.md @@ -34,7 +34,7 @@ jobs: steps: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - + - name: Build uses: docker/build-push-action@v6 with: @@ -71,14 +71,14 @@ jobs: uses: docker/setup-buildx-action@v3 with: driver: docker - + - name: Build base image uses: docker/build-push-action@v6 with: context: "{{defaultContext}}:base" load: true tags: my-base-image:latest - + - name: Build uses: docker/build-push-action@v6 with: @@ -118,20 +118,20 @@ jobs: steps: - name: Set up QEMU uses: docker/setup-qemu-action@v3 - + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 with: # network=host driver-opt needed to push to local registry driver-opts: network=host - + - name: Build base image uses: docker/build-push-action@v6 with: context: "{{defaultContext}}:base" tags: localhost:5000/my-base-image:latest push: true - + - name: Build uses: docker/build-push-action@v6 with: diff --git a/content/manuals/build/ci/github-actions/push-multi-registries.md b/content/manuals/build/ci/github-actions/push-multi-registries.md index 5b2cb4c1844..617b39d7cff 100644 --- a/content/manuals/build/ci/github-actions/push-multi-registries.md +++ b/content/manuals/build/ci/github-actions/push-multi-registries.md @@ -18,25 +18,25 @@ jobs: docker: runs-on: ubuntu-latest steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - + - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build and push uses: docker/build-push-action@v6 with: diff --git a/content/manuals/build/ci/github-actions/reproducible-builds.md b/content/manuals/build/ci/github-actions/reproducible-builds.md index a88cc019f6f..d7c88a9b14d 100644 --- a/content/manuals/build/ci/github-actions/reproducible-builds.md +++ b/content/manuals/build/ci/github-actions/reproducible-builds.md @@ -34,7 +34,7 @@ jobs: steps: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - + - name: Build uses: docker/build-push-action@v6 with: @@ -58,10 +58,10 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - + - name: Build uses: docker/bake-action@v5 env: @@ -90,10 +90,10 @@ jobs: steps: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - + - name: Get Git commit timestamps run: echo "TIMESTAMP=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV - + - name: Build uses: docker/build-push-action@v6 with: @@ -117,13 +117,13 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - + - name: Get Git commit timestamps run: echo "TIMESTAMP=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV - + - name: Build uses: docker/bake-action@v5 env: diff --git a/content/manuals/build/ci/github-actions/secrets.md b/content/manuals/build/ci/github-actions/secrets.md index 4931409414d..2048b2c7766 100644 --- a/content/manuals/build/ci/github-actions/secrets.md +++ b/content/manuals/build/ci/github-actions/secrets.md @@ -44,10 +44,10 @@ jobs: steps: - name: Set up QEMU uses: docker/setup-qemu-action@v3 - + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - + - name: Build uses: docker/build-push-action@v6 with: @@ -176,7 +176,7 @@ jobs: host: github.com private-key: ${{ secrets.SSH_GITHUB_PPK }} private-key-name: github-ppk - + - name: Build and push uses: docker/build-push-action@v6 with: @@ -200,14 +200,14 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - + - name: Set up SSH uses: MrSquaare/ssh-setup-action@2d028b70b5e397cf8314c6eaea229a6c3e34977a # v3.1.0 with: host: github.com private-key: ${{ secrets.SSH_GITHUB_PPK }} private-key-name: github-ppk - + - name: Build uses: docker/bake-action@v5 with: diff --git a/content/manuals/build/ci/github-actions/share-image-jobs.md b/content/manuals/build/ci/github-actions/share-image-jobs.md index 995dd08a899..17cb2d29c18 100644 --- a/content/manuals/build/ci/github-actions/share-image-jobs.md +++ b/content/manuals/build/ci/github-actions/share-image-jobs.md @@ -24,13 +24,13 @@ jobs: steps: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - + - name: Build and export uses: docker/build-push-action@v6 with: tags: myimage:latest outputs: type=docker,dest=/tmp/myimage.tar - + - name: Upload artifact uses: actions/upload-artifact@v4 with: @@ -46,7 +46,7 @@ jobs: with: name: myimage path: /tmp - + - name: Load image run: | docker load --input /tmp/myimage.tar diff --git a/content/manuals/build/ci/github-actions/test-before-push.md b/content/manuals/build/ci/github-actions/test-before-push.md index 064f45665cd..05c5f824b26 100644 --- a/content/manuals/build/ci/github-actions/test-before-push.md +++ b/content/manuals/build/ci/github-actions/test-before-push.md @@ -27,28 +27,28 @@ jobs: docker: runs-on: ubuntu-latest steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build and export to Docker uses: docker/build-push-action@v6 with: load: true tags: ${{ env.TEST_TAG }} - + - name: Test run: | docker run --rm ${{ env.TEST_TAG }} - + - name: Build and push uses: docker/build-push-action@v6 with: diff --git a/content/manuals/build/ci/github-actions/update-dockerhub-desc.md b/content/manuals/build/ci/github-actions/update-dockerhub-desc.md index 04ed5cc3a68..6c49dc3ce88 100644 --- a/content/manuals/build/ci/github-actions/update-dockerhub-desc.md +++ b/content/manuals/build/ci/github-actions/update-dockerhub-desc.md @@ -19,24 +19,24 @@ jobs: docker: runs-on: ubuntu-latest steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build and push uses: docker/build-push-action@v6 with: push: true tags: user/app:latest - + - name: Update repo description uses: peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae # v4.0.0 with: diff --git a/content/manuals/scout/integrations/ci/gha.md b/content/manuals/scout/integrations/ci/gha.md index 7fbb3379930..9b1ad746455 100644 --- a/content/manuals/scout/integrations/ci/gha.md +++ b/content/manuals/scout/integrations/ci/gha.md @@ -56,9 +56,6 @@ jobs: pull-requests: write steps: - - name: Setup Docker buildx - uses: docker/setup-buildx-action@v3 - # Authenticate to the container registry - name: Authenticate to registry ${{ env.REGISTRY }} uses: docker/login-action@v3 @@ -66,6 +63,9 @@ jobs: registry: ${{ env.REGISTRY }} username: ${{ secrets.REGISTRY_USER }} password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v3 # Extract metadata (tags, labels) for Docker - name: Extract Docker metadata diff --git a/content/manuals/scout/policy/ci.md b/content/manuals/scout/policy/ci.md index bdd41f761f4..1d50a6b149e 100644 --- a/content/manuals/scout/policy/ci.md +++ b/content/manuals/scout/policy/ci.md @@ -94,15 +94,15 @@ jobs: runs-on: ubuntu-latest steps: - - name: Setup Docker buildx - uses: docker/setup-buildx-action@v3 - - name: Log into registry ${{ env.REGISTRY }} uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ secrets.REGISTRY_USER }} password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v3 - name: Extract metadata id: meta