From fd3fc97effa60e17d916cf0582d5795f0a1e1c7d Mon Sep 17 00:00:00 2001 From: JesperTerkelsen <99995+JesperTerkelsen@users.noreply.github.com> Date: Sat, 14 Nov 2026 21:28:36 +0000 Subject: [PATCH 1/2] perf(component-build): keep cache mounts out of the checkout and save them every S3 build --- .github/workflows/component-build.yml | 8 +++++--- CLAUDE.md | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/component-build.yml b/.github/workflows/component-build.yml index 61452db..eee6328 100644 --- a/.github/workflows/component-build.yml +++ b/.github/workflows/component-build.yml @@ -154,9 +154,10 @@ jobs: if: ${{ (inputs.use-arc-runners && github.event.repository.private) && env.S3_CACHE != 'true' }} uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5 with: &cache-mounts - path: buildkit-cache-mounts - key: buildkit-cache-mounts-${{ inputs.docker-file-name }}-${{ hashFiles('**/*.gradle.kts', '**/gradle.properties', 'gradle/libs.versions.toml', 'gradle/wrapper/gradle-wrapper.properties', '**/package-lock.json', '**/pnpm-lock.yaml', '**/yarn.lock', '**/bun.lock', '**/bun.lockb', '**/requirements*.txt', '**/poetry.lock', '**/uv.lock', '**/go.sum', '**/Cargo.lock') }} + path: ${{ runner.temp }}/buildkit-cache-mounts + key: buildkit-cache-mounts-${{ inputs.docker-file-name }}-${{ hashFiles('**/*.gradle.kts', '**/gradle.properties', 'gradle/libs.versions.toml', 'gradle/wrapper/gradle-wrapper.properties', '**/package-lock.json', '**/pnpm-lock.yaml', '**/yarn.lock', '**/bun.lock', '**/bun.lockb', '**/requirements*.txt', '**/poetry.lock', '**/uv.lock', '**/go.sum', '**/Cargo.lock') }}${{ env.S3_CACHE == 'true' && format('-{0}', github.sha) || '' }} restore-keys: | + buildkit-cache-mounts-${{ inputs.docker-file-name }}-${{ hashFiles('**/*.gradle.kts', '**/gradle.properties', 'gradle/libs.versions.toml', 'gradle/wrapper/gradle-wrapper.properties', '**/package-lock.json', '**/pnpm-lock.yaml', '**/yarn.lock', '**/bun.lock', '**/bun.lockb', '**/requirements*.txt', '**/poetry.lock', '**/uv.lock', '**/go.sum', '**/Cargo.lock') }} buildkit-cache-mounts-${{ inputs.docker-file-name }}- - name: Restore Dockerfile cache mounts (S3) id: cache-mounts-s3 @@ -175,7 +176,8 @@ jobs: uses: reproducible-containers/buildkit-cache-dance@5422eac04292c961a382e0f584ea0f03ad9da723 # v3.4.0 with: dockerfile: ${{ inputs.docker-file-name }} - cache-dir: buildkit-cache-mounts + cache-dir: ${{ runner.temp }}/buildkit-cache-mounts + scratch-dir: ${{ runner.temp }}/buildkit-cache-dance-scratch skip-extraction: ${{ steps.cache-mounts.outputs.cache-hit || steps.cache-mounts-s3.outputs.cache-hit }} - name: Build and push id: build diff --git a/CLAUDE.md b/CLAUDE.md index b8a76af..65e2cc9 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -5,6 +5,9 @@ - **Latest SHA**: 84fb68d (check for newer commits) - **Changes**: new `pnpm-dependency-submission.yml` and `pnpm-dependency-graph` action for pnpm 12 lockfiles +## Recent Changes (2026-11-14) +1. **Dockerfile cache mounts live outside the checkout and, on S3, are saved every build**: `component-build.yml` restores the cache mounts into `${{ runner.temp }}/buildkit-cache-mounts` (and cache-dance's scratch dir into `runner.temp`) instead of `buildkit-cache-mounts` in the checkout. With the folder in the checkout, a Dockerfile that runs `COPY . .` without a `.dockerignore` shipped the whole restored cache (1.3 GB for infra-portal's Go caches) as build context, baked it into a layer and compressed it into the registry cache on every build. On the S3 backend the key also ends in the commit SHA, so every build saves its caches and the next one restores the newest under the same lockfile hash, then the newest for the Dockerfile. Before, the key changed only with the lockfiles, so the Go build cache (and Gradle's) went stale with every commit: infra-portal's `go build` took ~130 s with the cache restored, against ~11 s locally with a fresh one. The `actions/cache` backend keeps the lockfile-only key, since per-commit saves would churn the 10 GB GitHub cache quota. + ## Recent Changes (2026-11-12) 1. **`argocd-wait-sync-multi` refreshes and polls apps in parallel**: the initial refresh and each poll ran `argocd app get` once per app, one after another (~2.6 s each). With monorepo-typescript's 18 apps the refresh took ~47 s before the first poll, and a poll sweep 15-25 s, so an app's `end` was late by up to a sweep. Both now run every app's call in the background and `wait`; the per-app state machine then reads the fetched status from a temp dir, unchanged. Against a 1 s fake `argocd` with 10 already-healthy apps the script went from 23 s to 3 s. Offline tests unchanged and passing. From 63094912af2c67a8f31080848108e08bc8dc8039 Mon Sep 17 00:00:00 2001 From: JesperTerkelsen <99995+JesperTerkelsen@users.noreply.github.com> Date: Sat, 14 Nov 2026 21:29:11 +0000 Subject: [PATCH 2/2] fix(component-build): rely on the existing prefix restore key --- .github/workflows/component-build.yml | 1 - CLAUDE.md | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/component-build.yml b/.github/workflows/component-build.yml index eee6328..ef6270b 100644 --- a/.github/workflows/component-build.yml +++ b/.github/workflows/component-build.yml @@ -157,7 +157,6 @@ jobs: path: ${{ runner.temp }}/buildkit-cache-mounts key: buildkit-cache-mounts-${{ inputs.docker-file-name }}-${{ hashFiles('**/*.gradle.kts', '**/gradle.properties', 'gradle/libs.versions.toml', 'gradle/wrapper/gradle-wrapper.properties', '**/package-lock.json', '**/pnpm-lock.yaml', '**/yarn.lock', '**/bun.lock', '**/bun.lockb', '**/requirements*.txt', '**/poetry.lock', '**/uv.lock', '**/go.sum', '**/Cargo.lock') }}${{ env.S3_CACHE == 'true' && format('-{0}', github.sha) || '' }} restore-keys: | - buildkit-cache-mounts-${{ inputs.docker-file-name }}-${{ hashFiles('**/*.gradle.kts', '**/gradle.properties', 'gradle/libs.versions.toml', 'gradle/wrapper/gradle-wrapper.properties', '**/package-lock.json', '**/pnpm-lock.yaml', '**/yarn.lock', '**/bun.lock', '**/bun.lockb', '**/requirements*.txt', '**/poetry.lock', '**/uv.lock', '**/go.sum', '**/Cargo.lock') }} buildkit-cache-mounts-${{ inputs.docker-file-name }}- - name: Restore Dockerfile cache mounts (S3) id: cache-mounts-s3 diff --git a/CLAUDE.md b/CLAUDE.md index 65e2cc9..9a70a63 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -6,7 +6,7 @@ - **Changes**: new `pnpm-dependency-submission.yml` and `pnpm-dependency-graph` action for pnpm 12 lockfiles ## Recent Changes (2026-11-14) -1. **Dockerfile cache mounts live outside the checkout and, on S3, are saved every build**: `component-build.yml` restores the cache mounts into `${{ runner.temp }}/buildkit-cache-mounts` (and cache-dance's scratch dir into `runner.temp`) instead of `buildkit-cache-mounts` in the checkout. With the folder in the checkout, a Dockerfile that runs `COPY . .` without a `.dockerignore` shipped the whole restored cache (1.3 GB for infra-portal's Go caches) as build context, baked it into a layer and compressed it into the registry cache on every build. On the S3 backend the key also ends in the commit SHA, so every build saves its caches and the next one restores the newest under the same lockfile hash, then the newest for the Dockerfile. Before, the key changed only with the lockfiles, so the Go build cache (and Gradle's) went stale with every commit: infra-portal's `go build` took ~130 s with the cache restored, against ~11 s locally with a fresh one. The `actions/cache` backend keeps the lockfile-only key, since per-commit saves would churn the 10 GB GitHub cache quota. +1. **Dockerfile cache mounts live outside the checkout and, on S3, are saved every build**: `component-build.yml` restores the cache mounts into `${{ runner.temp }}/buildkit-cache-mounts` (and cache-dance's scratch dir into `runner.temp`) instead of `buildkit-cache-mounts` in the checkout. With the folder in the checkout, a Dockerfile that runs `COPY . .` without a `.dockerignore` shipped the whole restored cache (1.3 GB for infra-portal's Go caches) as build context, baked it into a layer and compressed it into the registry cache on every build. On the S3 backend the key also ends in the commit SHA, so every build saves its caches and the next one restores the newest saved for the Dockerfile (the existing prefix restore key). Before, the key changed only with the lockfiles, so the Go build cache (and Gradle's) went stale with every commit: infra-portal's `go build` took ~130 s with the cache restored, against ~11 s locally with a fresh one. The `actions/cache` backend keeps the lockfile-only key, since per-commit saves would churn the 10 GB GitHub cache quota. ## Recent Changes (2026-11-12) 1. **`argocd-wait-sync-multi` refreshes and polls apps in parallel**: the initial refresh and each poll ran `argocd app get` once per app, one after another (~2.6 s each). With monorepo-typescript's 18 apps the refresh took ~47 s before the first poll, and a poll sweep 15-25 s, so an app's `end` was late by up to a sweep. Both now run every app's call in the background and `wait`; the per-app state machine then reads the fetched status from a temp dir, unchanged. Against a 1 s fake `argocd` with 10 already-healthy apps the script went from 23 s to 3 s. Offline tests unchanged and passing.