File tree Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,9 @@ jobs:
122122 # which then uses log commands to actually set them.
123123 EXTRA_VARIABLES : ${{ toJson(matrix.env) }}
124124
125+ - name : setup upstream remote
126+ run : src/ci/scripts/setup-upstream-remote.sh
127+
125128 - name : ensure the channel matches the target branch
126129 run : src/ci/scripts/verify-channel.sh
127130
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # In CI environments, bootstrap is forced to use the remote upstream based
3+ # on "git_repository" and "nightly_branch" values from src/stage0 file.
4+ # This script configures the remote as it may not exist by default.
5+
6+ set -euo pipefail
7+ IFS=$' \n\t '
8+
9+ ci_dir=$( cd $( dirname $0 ) && pwd) /..
10+ source " $ci_dir /shared.sh"
11+
12+ git_repository=$( parse_stage0_file_by_key " git_repository" )
13+ nightly_branch=$( parse_stage0_file_by_key " nightly_branch" )
14+
15+ # Configure "rust-lang/rust" upstream remote only when it's not origin.
16+ if [ -z " $( git config remote.origin.url | grep $git_repository ) " ]; then
17+ echo " Configuring https://github.com/$git_repository remote as upstream."
18+ git remote add upstream " https://github.com/$git_repository "
19+ REMOTE_NAME=" upstream"
20+ else
21+ REMOTE_NAME=" origin"
22+ fi
23+
24+ git fetch $REMOTE_NAME $nightly_branch
Original file line number Diff line number Diff line change @@ -136,3 +136,15 @@ function releaseChannel {
136136 echo $RUST_CI_OVERRIDE_RELEASE_CHANNEL
137137 fi
138138}
139+
140+ # Parse values from src/stage0 file by key
141+ function parse_stage0_file_by_key {
142+ local key=" $1 "
143+ local file=" $ci_dir /../stage0"
144+ local value=$( awk -F= ' {a[$1]=$2} END {print(a["' $key ' "])}' $file )
145+ if [ -z " $value " ]; then
146+ echo " ERROR: Key '$key ' not found in '$file '."
147+ exit 1
148+ fi
149+ echo " $value "
150+ }
You can’t perform that action at this time.
0 commit comments