Skip to content

Commit 9f4f3ab

Browse files
committed
Fix overriding the Rustup version
1 parent c22a17e commit 9f4f3ab

File tree

3 files changed

+23
-15
lines changed

3 files changed

+23
-15
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches:
66
- master
7-
pull_request: {}
7+
pull_request: { }
88

99
jobs:
1010
test:
@@ -35,7 +35,7 @@ jobs:
3535
strategy:
3636
fail-fast: false
3737
matrix:
38-
channel: [stable, beta, nightly]
38+
channel: [ stable, beta, nightly ]
3939

4040
steps:
4141
- name: Clone the source code
@@ -66,12 +66,12 @@ jobs:
6666
runs-on: ubuntu-latest
6767

6868
env:
69-
PROMOTE_RELEASE_RUSTUP_OVERRIDE_VERSION: 99.0.0
69+
RUSTUP_OVERRIDE_VERSION: 99.0.0
7070

7171
strategy:
7272
fail-fast: false
7373
matrix:
74-
channel: [stable, beta]
74+
channel: [ stable, beta ]
7575

7676
steps:
7777
- name: Clone the source code
@@ -91,6 +91,9 @@ jobs:
9191
env:
9292
RUSTUP_UPDATE_ROOT: http://localhost:9000/static/rustup
9393

94+
- name: Verify Rustup version
95+
run: rustup --version | grep -q ${{ env.RUSTUP_OVERRIDE_VERSION }}
96+
9497
docker:
9598
name: Build Docker image
9699
runs-on: ubuntu-latest
@@ -120,7 +123,7 @@ jobs:
120123
permissions:
121124
id-token: write
122125

123-
needs: [test, release, rustup, docker]
126+
needs: [ test, release, rustup, docker ]
124127
if: github.event_name == 'push' && github.repository == 'rust-lang/promote-release' && github.ref == 'refs/heads/master'
125128

126129
steps:

local/rustup.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ else
4242
fi
4343

4444
for target in "${DOWNLOAD_TARGETS[@]}"; do
45-
if ! mc stat "local/artifacts/builds/${commit}/dist/${target}" >/dev/null 2>&1; then
46-
echo "==> copying ${target} from S3"
45+
if ! mc stat "local/artifacts/builds/${commit}/dist/${target}" >/dev/null 2>&1; then
46+
echo "==> copying ${target} from S3"
4747

4848
for file in "${DOWNLOAD_FILES[@]}"; do
4949
if curl -Lo /tmp/component "${DOWNLOAD_BASE}/${commit}/dist/${target}/${file}" --fail; then
@@ -94,5 +94,10 @@ if [[ "${override_commit}" != "" ]]; then
9494
export PROMOTE_RELEASE_OVERRIDE_COMMIT="${override_commit}"
9595
fi
9696

97+
# Conditionally set a version for the next Rustup release
98+
if [[ "${RUSTUP_OVERRIDE_VERSION:-}" != "" ]]; then
99+
export PROMOTE_RELEASE_RUSTUP_OVERRIDE_VERSION="${RUSTUP_OVERRIDE_VERSION}"
100+
fi
101+
97102
echo "==> starting promote-release"
98103
/src/target/release/promote-release /persistent/release "${channel}"

run.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
set -euo pipefail
66
IFS=$'\n\t'
77

8-
PROMOTE_RELEASE_RUSTUP_OVERRIDE_VERSION=""
8+
RUSTUP_OVERRIDE_VERSION="${RUSTUP_OVERRIDE_VERSION:-}"
99

1010
if [[ "$#" -lt 1 ]]; then
1111
echo "Usage: $0 <release|rustup>"
@@ -50,11 +50,11 @@ if [[ "$(uname)" == "Linux" ]]; then
5050
cargo build --release
5151
fi
5252

53-
# If the PROMOTE_RELEASE_RUSTUP_OVERRIDE_VERSION environment variable is set,
54-
# forward it to the Docker environment.
55-
if [[ "$PROMOTE_RELEASE_RUSTUP_OVERRIDE_VERSION" != "" ]]; then
56-
docker compose exec -e "PROMOTE_RELEASE_RUSTUP_OVERRIDE_VERSION=${PROMOTE_RELEASE_RUSTUP_OVERRIDE_VERSION}" -T local "/src/local/${command}.sh" "${channel}" "${override_commit}"
53+
if [[ "$RUSTUP_OVERRIDE_VERSION" != "" ]]; then
54+
# If the RUSTUP_OVERRIDE_VERSION environment variable is set, forward it to the Docker environment.
55+
echo "==> running local release with override version ${RUSTUP_OVERRIDE_VERSION}"
56+
docker compose exec -e "RUSTUP_OVERRIDE_VERSION=${RUSTUP_OVERRIDE_VERSION}" -T local "/src/local/${command}.sh" "${channel}" "${override_commit}"
57+
else
58+
# Run the command inside the docker environment.
59+
docker compose exec -T local "/src/local/${command}.sh" "${channel}" "${override_commit}"
5760
fi
58-
59-
# Run the command inside the docker environment.
60-
docker compose exec -T local "/src/local/${command}.sh" "${channel}" "${override_commit}"

0 commit comments

Comments
 (0)