From bdc8894004031b063d9201f5297292211c6df791 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Sat, 13 Dec 2025 16:41:26 -0500 Subject: [PATCH] Write file with channel to S3 This will let rustup-toolchain-install-master gain support for installing stable artifacts, which is currently only possible when explicitly overriding the channel. That in turn will unblock letting Crater kick off a beta run as soon as both a new beta and a new stable artifact are ready, rather than waiting until the actual release. --- src/bootstrap/src/lib.rs | 18 ++++++------------ src/ci/scripts/upload-artifacts.sh | 17 +++++++++++++++++ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs index adae9a1b8b081..c9358599012c8 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs @@ -1624,26 +1624,20 @@ impl Build { self.release(&self.version) } - /// Returns the "package version" for a component given the `num` release - /// number. + /// Returns the "package version" for a component. /// /// The package version is typically what shows up in the names of tarballs. - /// For channels like beta/nightly it's just the channel name, otherwise - /// it's the `num` provided. - fn package_vers(&self, num: &str) -> String { + /// For channels like beta/nightly it's just the channel name, otherwise it's the release + /// version. + fn rust_package_vers(&self) -> String { match &self.config.channel[..] { - "stable" => num.to_string(), + "stable" => self.version.to_string(), "beta" => "beta".to_string(), "nightly" => "nightly".to_string(), - _ => format!("{num}-dev"), + _ => format!("{}-dev", self.version), } } - /// Returns the value of `package_vers` above for Rust itself. - fn rust_package_vers(&self) -> String { - self.package_vers(&self.version) - } - /// Returns the `version` string associated with this compiler for Rust /// itself. /// diff --git a/src/ci/scripts/upload-artifacts.sh b/src/ci/scripts/upload-artifacts.sh index 975b4c527267b..6c916eb90cbec 100755 --- a/src/ci/scripts/upload-artifacts.sh +++ b/src/ci/scripts/upload-artifacts.sh @@ -6,6 +6,7 @@ set -euo pipefail IFS=$'\n\t' +ci_dir=`cd $(dirname $0)/.. && pwd` source "$(cd "$(dirname "$0")" && pwd)/../shared.sh" upload_dir="$(mktemp -d)" @@ -22,6 +23,22 @@ if [[ "${DEPLOY-0}" -eq "1" ]] || [[ "${DEPLOY_ALT-0}" -eq "1" ]]; then mv "${dist_dir}"/* "${upload_dir}" fi +# We write the release channel into the output so that +# `rustup-toolchain-install-master` or other, similar, tools can automatically +# detect the appropriate name to use for downloading artifacts. +# +# For nightly and beta this isn't strictly necessary as just trying both is +# enough, but stable builds produce artifacts with a version (e.g., +# rust-src-1.92.0.tar.xz) which can't be easily guessed otherwise. +channel=$(releaseChannel) +if [[ "$channel" = "stable" ]]; then + # On stable, artifacts use the version number. See rust_package_vers in + # src/bootstrap/src/lib.rs. + cat "$ci_dir/../version" > "${upload_dir}/package-version" +else + echo "$channel" > "${upload_dir}/package-version" +fi + # CPU usage statistics. cp build/cpu-usage.csv "${upload_dir}/cpu-${CI_JOB_NAME}.csv"