Skip to content

Commit

Permalink
Include Git branch in CircleCI cache keys and bump key version.
Browse files Browse the repository at this point in the history
This should resolve an issue affecting the 2.7.5 release, where an old
federation-2/target/ cache was restored from an unrelated PR branch
build (because Cargo.lock was the same), causing the compiled supergraph
binary to call op_composition_result with a string rather than an object
in some cases, triggering a panic on the Rust side.

I would have liked to disable this caching completely when publishing an
official release, to prioritize correctness over build speed, but it
doesn't seem like conditional caching is supported by CircleCI:
https://circleci.com/docs/caching/#clearing-cache

We could potentially run `cargo clean` conditionally for release builds,
after restore_cache (thereby throwing away the cache), but that doesn't
seem ideal.
  • Loading branch information
benjamn committed May 10, 2024
1 parent bf654c7 commit c4cb172
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -418,14 +418,14 @@ commands:
steps:
- restore_cache:
keys:
- rust-target-v2-<< parameters.platform >>-{{ checksum "Cargo.lock" }}
- &target-cache-key rust-target-v3-<< parameters.platform >>-{{ .Branch }}-{{ checksum "Cargo.lock" }}

- run:
command: cargo xtask << parameters.command >> << parameters.options >>
working_directory: << parameters.working_directory >>

- save_cache:
key: rust-target-v2-<< parameters.platform >>-{{ checksum "Cargo.lock" }}
key: *target-cache-key
paths:
- target/

Expand Down

0 comments on commit c4cb172

Please sign in to comment.