Skip to content

Commit

Permalink
Disable automatic self updates in CI environments
Browse files Browse the repository at this point in the history
  • Loading branch information
djc committed Jun 25, 2024
1 parent fb662c5 commit d4bbf6c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ci/run.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 6 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,12 @@ impl<'a> Cfg<'a> {
}

pub(crate) fn get_self_update_mode(&self) -> Result<SelfUpdateMode> {
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,
Expand Down

0 comments on commit d4bbf6c

Please sign in to comment.