From af99bc3f953b840675dea0440a3852c99ce9bb0d Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Tue, 25 Jun 2024 10:38:06 +0200 Subject: [PATCH] Disable automatic self updates in CI environments --- ci/run.bash | 2 +- src/config.rs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ci/run.bash b/ci/run.bash index c83bf5e758..d3baae3f1e 100644 --- a/ci/run.bash +++ b/ci/run.bash @@ -77,5 +77,5 @@ build_test() { if [ -z "$SKIP_TESTS" ]; then target_cargo run --features test -- --dump-testament build_test build - build_test test + RUSTUP_CI=1 build_test test fi diff --git a/src/config.rs b/src/config.rs index fcaed93b3c..8551c894db 100644 --- a/src/config.rs +++ b/src/config.rs @@ -418,6 +418,12 @@ impl<'a> Cfg<'a> { } pub(crate) fn get_self_update_mode(&self) -> Result { + if self.process.var("CI").is_ok() && self.process.var("RUSTUP_CI").is_err() { + // If we're in CI (but not rustup's own CI, which wants to test this stuff!), + // disable automatic self updates. + return Ok(SelfUpdateMode::Disable); + } + self.settings_file.with(|s| { Ok(match s.auto_self_update { Some(mode) => mode,