From fb03a29ec6dc0c949933672f5ad23b827f77dc02 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 15 Nov 2024 16:14:48 +0000 Subject: [PATCH 1/3] workflows/docker: use GitHub Packages for caching. The GitHub Actions caching seems to not be very performant and is exploding our cache storage usage. --- .github/workflows/docker.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 5ba285b354ed4..373cb507c3ba1 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -12,6 +12,7 @@ on: permissions: contents: read + packages: write defaults: run: @@ -102,21 +103,27 @@ jobs: fi } | tee -a "${GITHUB_OUTPUT}" + - name: Log in to GitHub Packages + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3 + with: + registry: ghcr.io + username: github-actions[bot] + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build Docker image uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6 with: context: . load: true tags: brew - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: type=registry,ref=ghcr.io/homebrew/ubuntu${{ matrix.version }}:cache build-args: version=${{ matrix.version }} labels: ${{ steps.attributes.outputs.labels }} - name: Run brew test-bot --only-setup run: docker run --rm brew brew test-bot --only-setup - - name: Log in to GitHub Packages + - name: Log in to GitHub Packages (again) if: steps.attributes.outputs.push == 'true' uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3 with: @@ -138,7 +145,7 @@ jobs: context: . push: true tags: ${{ steps.attributes.outputs.tags }} - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: type=registry,ref=ghcr.io/homebrew/ubuntu${{ matrix.version }}:cache + cache-to: type=registry,ref=ghcr.io/homebrew/ubuntu${{ matrix.version }}:cache,mode=max build-args: version=${{ matrix.version }} labels: ${{ steps.attributes.outputs.labels }} From e98fae851296150866cd234cdbc615f0cfed800c Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 15 Nov 2024 17:15:04 +0000 Subject: [PATCH 2/3] workflows/docker: improve step names. Co-authored-by: Markus Reiter --- .github/workflows/docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 373cb507c3ba1..4fd273a5c58af 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -103,7 +103,7 @@ jobs: fi } | tee -a "${GITHUB_OUTPUT}" - - name: Log in to GitHub Packages + - name: Log in to GitHub Packages (github-actions[bot]) uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3 with: registry: ghcr.io @@ -123,7 +123,7 @@ jobs: - name: Run brew test-bot --only-setup run: docker run --rm brew brew test-bot --only-setup - - name: Log in to GitHub Packages (again) + - name: Log in to GitHub Packages (BrewTestBot) if: steps.attributes.outputs.push == 'true' uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3 with: From 10525781b38ec5c31f88016b23d8eacbc5baa133 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 15 Nov 2024 18:24:29 +0000 Subject: [PATCH 3/3] workflows/docker: remove unneeded packages permission. --- .github/workflows/docker.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 4fd273a5c58af..136611f1eb79f 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -12,7 +12,6 @@ on: permissions: contents: read - packages: write defaults: run: