From 60132c4271eaaec553c5e157da23619cfdc0388f Mon Sep 17 00:00:00 2001 From: Mish Ushakov <10400064+mishushakov@users.noreply.github.com> Date: Mon, 13 Jul 2026 18:52:09 +0200 Subject: [PATCH] ci: seed codegen image cache from main instead of per-PR scopes The generated_files.yml workflow only runs on pull_request, so its cache-to: type=gha,mode=max wrote buildkit blobs into per-PR scopes that other PRs cannot read. Every new PR cold-built the codegen image (235-365s in 11 of 17 runs last week), and ~6 GB of duplicate blobs pushed the repo's Actions cache to 9.9/10 GB, evicting the Playwright and pnpm caches. Add codegen_image_cache.yml, which builds the image on pushes to main that touch its inputs (codegen.Dockerfile, packages/connect-python) and exports the cache to main's scope, readable by all PRs. Drop cache-to from the PR-side build. Co-Authored-By: Claude Fable 5 --- .github/workflows/codegen_image_cache.yml | 35 +++++++++++++++++++++++ .github/workflows/generated_files.yml | 4 ++- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/codegen_image_cache.yml diff --git a/.github/workflows/codegen_image_cache.yml b/.github/workflows/codegen_image_cache.yml new file mode 100644 index 0000000000..83e3584435 --- /dev/null +++ b/.github/workflows/codegen_image_cache.yml @@ -0,0 +1,35 @@ +name: Codegen image cache + +# Seeds the buildkit cache for codegen.Dockerfile from main so pull request +# runs of generated_files.yml warm-start. PR-scoped cache writes are not +# readable by other PRs, so main is the only scope worth writing to. +on: + push: + branches: [main] + paths: + - 'codegen.Dockerfile' + - 'packages/connect-python/**' + - '.github/workflows/codegen_image_cache.yml' + workflow_dispatch: + +permissions: + contents: read + +jobs: + seed: + name: Seed codegen image cache + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build codegen image and export cache + uses: docker/build-push-action@v6 + with: + context: . + file: codegen.Dockerfile + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/generated_files.yml b/.github/workflows/generated_files.yml index 39d1a85dc7..772c48fda6 100644 --- a/.github/workflows/generated_files.yml +++ b/.github/workflows/generated_files.yml @@ -81,8 +81,10 @@ jobs: file: codegen.Dockerfile tags: codegen-env:latest load: true # makes the image available for `docker run` + # Cache is seeded from main by codegen_image_cache.yml. No cache-to + # here: PR-scoped writes are unreadable by other PRs and only fill + # the repo's 10 GB Actions cache, evicting other caches. cache-from: type=gha - cache-to: type=gha,mode=max - name: Run codegen run: CODEGEN_IMAGE=codegen-env:latest make codegen