From 3ee14659de0dd55c4c09bec4b1dbe09c26f058f4 Mon Sep 17 00:00:00 2001 From: Vasili Pascal Date: Mon, 21 Sep 2026 20:49:02 +0300 Subject: [PATCH] ci: stop caching the Rust target directory in the docker workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The build filled the runner's disk and died in post-job cleanup: Unhandled exception. System.IO.IOException: No space left on device Every check had passed — cargo check, the test suite, the BDD suite, rustfmt, all four release binaries. The job only failed while saving its cache, after 33 minutes. `actions/cache` was storing the whole `target` directory, and `restore-keys: docker-` meant each run started from an older, already bloated cache, added to it, and saved a larger one — so every run raised the next one's floor. For a workspace building five binaries in both debug and release that ratchets past the ~14 GB a runner has free. Replaced with Swatinem/rust-cache, caching registry and git only. rust.yml already made this exact call, with a comment explaining why; the two workflows now follow one rule. The trade-off is a slower docker workflow, since compilation output is no longer reused between runs. That is the right side to err on: a slow pipeline is an inconvenience, a pipeline that cannot finish is not. Co-Authored-By: Claude Opus 5 --- .github/workflows/docker.yml | 38 ++++++++++++------------------------ 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 2a9150c3..8ddc86d1 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -66,23 +66,20 @@ jobs: override: true components: rustfmt, clippy - - name: Cache cargo registry - uses: actions/cache@v4 + # Registry and git only — not `target`. Caching the target directory here + # filled the runner's disk: `restore-keys: docker-` pulled in an older, + # already-bloated cache, the build added to it, and the post-job step + # saved a larger one still, so every run grew the next one's starting + # point. A 33-minute job that passed every check then died in cleanup + # with "No space left on device". + # + # rust.yml reached the same conclusion for the same reason; this keeps + # both workflows on one rule. + - name: Cache Cargo registry/git (no target — it grows without bound here) + uses: Swatinem/rust-cache@v2 with: - path: ~/.cargo/registry - key: docker-registry-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - docker-registry- - docker- - - - name: Cache cargo index - uses: actions/cache@v4 - with: - path: ~/.cargo/git - key: docker-index-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - docker-index- - docker- + cache-targets: "false" + key: docker-cicd - name: Generate Secret Key run: | @@ -99,15 +96,6 @@ jobs: echo "PostgreSQL did not become ready in time" >&2 exit 1 - - name: Cache cargo build - uses: actions/cache@v4 - with: - path: target - key: docker-build-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - docker-build- - docker- - - name: Cargo check uses: actions-rs/cargo@v1 with: