From c154c8d8f231a26aa037d5cd710ba98b1c5fd668 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 c83bf5e7584..d3baae3f1e2 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 fcaed93b3ca..2ceeb9c0f11 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() { + if !self.process.var("RUSTUP_CI").is_ok() { + return Ok(SelfUpdateMode::Disable); + } + } + self.settings_file.with(|s| { Ok(match s.auto_self_update { Some(mode) => mode,