-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathrustup.sh
More file actions
executable file
·117 lines (94 loc) · 3.78 KB
/
rustup.sh
File metadata and controls
executable file
·117 lines (94 loc) · 3.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/bash
# This script is executed at the start of each local release for Rustup, and
# prepares the environment by copying the artifacts built by CI onto the MinIO
# instance. Then, it starts promote-release with the right flags.
set -euo pipefail
IFS=$'\n\t'
RUSTUP_REPO="https://github.com/rust-lang/rustup"
RUSTUP_DEFAULT_BRANCH="stable"
# S3 bucket from which to download the Rustup artifacts
S3_BUCKET="rustup-builds"
# CDN from which to download the CI artifacts
DOWNLOAD_BASE="https://rustup-builds.rust-lang.org"
# The artifacts for the following targets will be downloaded and copied during
# the release process. At least one target is required.
DOWNLOAD_TARGETS=(
"aarch64-unknown-linux-gnu"
"x86_64-unknown-linux-gnu"
)
# The following files will be downloaded and put into the local MinIO instance.
DOWNLOAD_FILES=(
"rustup-init"
"rustup-init.sha256"
"rustup-setup"
"rustup-setup.sha256"
)
channel="$1"
override_commit="$2"
if [[ "${override_commit}" = "" ]]; then
echo "==> detecting the last Rustup commit on the default branch"
commit="$(git ls-remote "${RUSTUP_REPO}" | grep "refs/heads/${RUSTUP_DEFAULT_BRANCH}" | awk '{print($1)}')"
else
echo "=>> using overridden commit ${override_commit}"
commit="${override_commit}"
fi
for target in "${DOWNLOAD_TARGETS[@]}"; do
if ! mc stat "local/rustup-builds/${commit}/dist/${target}" >/dev/null 2>&1; then
echo "==> copying ${target} from S3"
for file in "${DOWNLOAD_FILES[@]}"; do
echo "==> copying ${file} from S3"
if curl -Lo /tmp/component "${DOWNLOAD_BASE}/${commit}/dist/${target}/${file}" --fail; then
mc cp /tmp/component "local/rustup-builds/${commit}/dist/${target}/${file}" >/dev/null
fi
done
else
echo "==> reusing cached ${target} target"
fi
done
if ! mc stat "local/rustup-builds/${commit}/rustup-init.sh" >/dev/null 2>&1; then
echo "==> copying rustup-init.sh from S3"
if curl -Lo /tmp/component "${DOWNLOAD_BASE}/${commit}/rustup-init.sh" --fail; then
mc cp /tmp/component "local/rustup-builds/${commit}/rustup-init.sh" >/dev/null
fi
else
echo "==> reusing cached rustup-init.sh"
fi
# Build the promote-release binary if it hasn't been pre-built
if [[ ! -f "/src/target/release/promote-release" ]]; then
echo "==> building promote-release"
cd /src
cargo build --release
cd ..
fi
echo "==> configuring the environment"
# Release Rustup
export PROMOTE_RELEASE_ACTION="promote-rustup"
# Point to the right GnuPG environment
export GNUPGHOME=/persistent/gpg-home
## Environment variables also used in prod releases
export AWS_ACCESS_KEY_ID="access_key"
export AWS_SECRET_ACCESS_KEY="secret_key"
export PROMOTE_RELEASE_CHANNEL="${channel}"
export PROMOTE_RELEASE_CLOUDFRONT_DOC_ID=""
export PROMOTE_RELEASE_CLOUDFRONT_STATIC_ID=""
export PROMOTE_RELEASE_DOWNLOAD_BUCKET="rustup-builds"
export PROMOTE_RELEASE_DOWNLOAD_DIR=""
export PROMOTE_RELEASE_GPG_KEY_FILE=""
export PROMOTE_RELEASE_GPG_PASSWORD_FILE=""
export PROMOTE_RELEASE_SKIP_CLOUDFRONT_INVALIDATIONS="yes"
export PROMOTE_RELEASE_UPLOAD_ADDR=""
export PROMOTE_RELEASE_UPLOAD_BUCKET="static"
export PROMOTE_RELEASE_UPLOAD_STORAGE_CLASS="STANDARD"
export PROMOTE_RELEASE_UPLOAD_DIR="rustup"
## Environment variables used only by local releases
export PROMOTE_RELEASE_S3_ENDPOINT_URL="http://minio:9000"
# Conditional environment variables
if [[ "${override_commit}" != "" ]]; then
export PROMOTE_RELEASE_OVERRIDE_COMMIT="${override_commit}"
fi
# Conditionally set a version for the next Rustup release
if [[ "${RUSTUP_OVERRIDE_VERSION:-}" != "" ]]; then
export PROMOTE_RELEASE_RUSTUP_OVERRIDE_VERSION="${RUSTUP_OVERRIDE_VERSION}"
fi
echo "==> starting promote-release"
/src/target/release/promote-release /persistent/release "${channel}"