Skip to content

Commit d4bbf6c

Browse files
committed
Disable automatic self updates in CI environments
1 parent fb662c5 commit d4bbf6c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

ci/run.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,5 @@ build_test() {
7777
if [ -z "$SKIP_TESTS" ]; then
7878
target_cargo run --features test -- --dump-testament
7979
build_test build
80-
build_test test
80+
RUSTUP_CI=1 build_test test
8181
fi

src/config.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,12 @@ impl<'a> Cfg<'a> {
418418
}
419419

420420
pub(crate) fn get_self_update_mode(&self) -> Result<SelfUpdateMode> {
421+
if self.process.var("CI").is_ok() && self.process.var("RUSTUP_CI").is_err() {
422+
// If we're in CI (but not rustup's own CI, which wants to test this stuff!),
423+
// disable automatic self updates.
424+
return Ok(SelfUpdateMode::Disable);
425+
}
426+
421427
self.settings_file.with(|s| {
422428
Ok(match s.auto_self_update {
423429
Some(mode) => mode,

0 commit comments

Comments
 (0)