Skip to content

Commit 408fe83

Browse files
Permit downloads of any channel artifact
We recently landed beta artifacts on the master branch for some time which broke perf, and this should avoid breaking perf if that happens in the future. In theory it should also let us benchmark beta/stable PRs if that ever becomes necessary without as much hassle.
1 parent 55e1364 commit 408fe83

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

collector/src/sysroot.rs

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,18 @@ impl fmt::Display for ModuleVariant {
9494
}
9595

9696
impl ModuleVariant {
97-
fn url(&self, sysroot: &SysrootDownload, triple: &str) -> String {
97+
fn url(&self, channel: &str, sysroot: &SysrootDownload, triple: &str) -> String {
9898
let suffix = if *self == ModuleVariant::RustSrc {
9999
String::new()
100100
} else {
101101
format!("-{}", triple)
102102
};
103103
format!(
104-
"{base}/{sha}/{module}-nightly{suffix}.tar.xz",
104+
"{base}/{sha}/{module}-{channel}{suffix}.tar.xz",
105105
base = BASE_URL,
106106
module = self,
107107
sha = sysroot.rust_sha,
108+
channel = channel,
108109
suffix = suffix,
109110
)
110111
}
@@ -151,26 +152,34 @@ impl SysrootDownload {
151152
}
152153
}
153154

154-
let url = variant.url(self, &self.triple);
155-
log::debug!("requesting: {}", url);
156-
let resp = reqwest::blocking::get(&url)?;
157-
log::debug!("{}", resp.status());
158-
if resp.status().is_success() {
159-
let reader = XzDecoder::new(BufReader::new(resp));
160-
match self.extract(variant, reader) {
161-
Ok(()) => return Ok(()),
162-
Err(err) => {
163-
log::warn!("extracting {} failed: {:?}", url, err);
155+
// We usually have nightlies but we want to avoid breaking down if we
156+
// accidentally end up with a beta or stable commit.
157+
let urls = [
158+
variant.url("nightly", self, &self.triple),
159+
variant.url("beta", self, &self.triple),
160+
variant.url("stable", self, &self.triple),
161+
];
162+
for url in &urls {
163+
log::debug!("requesting: {}", url);
164+
let resp = reqwest::blocking::get(url)?;
165+
log::debug!("{}", resp.status());
166+
if resp.status().is_success() {
167+
let reader = XzDecoder::new(BufReader::new(resp));
168+
match self.extract(variant, reader) {
169+
Ok(()) => return Ok(()),
170+
Err(err) => {
171+
log::warn!("extracting {} failed: {:?}", url, err);
172+
}
164173
}
165174
}
166175
}
167176

168177
return Err(anyhow!(
169-
"unable to download sha {} triple {} module {} from {}",
178+
"unable to download sha {} triple {} module {} from any of {:?}",
170179
self.rust_sha,
171180
self.triple,
172181
variant,
173-
url
182+
urls
174183
));
175184
}
176185

0 commit comments

Comments
 (0)