ci: fix CARGO_HOME caching

CARGO_HOME's semantic depends on when it's used in the pipeline:
- it's the install prefix when installing Cargo
- it's the crate cache location when building jobs

env.sh is sourced at the start of all jobs and was overidding the
CARGO_HOME path defined in the CI template for caching. Fix this by
moving the prefix install path to install-rust.sh.
This commit is contained in:
Guillaume Desmottes 2020-04-21 09:36:02 +02:00
parent 38b64473e9
commit 932d4720c0
3 changed files with 2 additions and 2 deletions

View file

@ -35,7 +35,7 @@ stages:
.debian:10: .debian:10:
variables: variables:
FDO_DISTRIBUTION_VERSION: 10 FDO_DISTRIBUTION_VERSION: 10
FDO_DISTRIBUTION_TAG: '$RUST_VERSION-2020-04-16.2' FDO_DISTRIBUTION_TAG: '$RUST_VERSION-2020-04-21.1'
# Only stuff inside the repo directory can be cached # Only stuff inside the repo directory can be cached
# Override the CARGO_HOME variable to force its location # Override the CARGO_HOME variable to force its location
CARGO_HOME: "${CI_PROJECT_DIR}/.cargo_home" CARGO_HOME: "${CI_PROJECT_DIR}/.cargo_home"

View file

@ -1,5 +1,4 @@
export RUSTUP_HOME='/usr/local/rustup' export RUSTUP_HOME='/usr/local/rustup'
export CARGO_HOME='/usr/local/cargo'
export PATH=$PATH:/usr/local/cargo/bin export PATH=$PATH:/usr/local/cargo/bin
export PKG_CONFIG_PATH=/usr/local/lib/x86_64-linux-gnu/pkgconfig export PKG_CONFIG_PATH=/usr/local/lib/x86_64-linux-gnu/pkgconfig

View file

@ -1,4 +1,5 @@
source ./ci/env.sh source ./ci/env.sh
export CARGO_HOME='/usr/local/cargo'
RUSTUP_VERSION=1.21.1 RUSTUP_VERSION=1.21.1
RUST_VERSION=$1 RUST_VERSION=$1