8

In GitLab's CI, I can breakdown my build into stages and each stage can pass artifacts to the next configuration:

cache:
  paths:
    - target/
    - Cargo.lock

However, if the cache directory is outside the project directory or the /cache directory, it becomes hard to pass those artifacts along. I need to tell Cargo a good place to put (and look for) its cached crates.

In my case, I wish to use /cache/cargo/registry/... rather than ~/.cargo/registry/.... or /usr/local/cargo/registry/....

Bonus points for doing that via an environment variable.

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
Chen Levy
  • 15,438
  • 17
  • 74
  • 92

1 Answers1

9

Found it:

variables:
  CARGO_HOME: "/cache/cargo/"
Chen Levy
  • 15,438
  • 17
  • 74
  • 92