File tree 3 files changed +38
-0
lines changed
3 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,9 @@ jobs:
122
122
# which then uses log commands to actually set them.
123
123
EXTRA_VARIABLES : ${{ toJson(matrix.env) }}
124
124
125
+ - name : setup upstream remote
126
+ run : src/ci/scripts/setup-upstream-remote.sh
127
+
125
128
- name : ensure the channel matches the target branch
126
129
run : src/ci/scripts/verify-channel.sh
127
130
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # Prepares upstream master branch to allow bootstrap to accurately
3
+ # track modified files in CI environments.
4
+
5
+ set -euo pipefail
6
+ IFS=$' \n\t '
7
+
8
+ ci_dir=$( cd $( dirname $0 ) && pwd) /..
9
+ source " $ci_dir /shared.sh"
10
+
11
+ git_repository=$( parse_stage0_file_by_key " git_repository" )
12
+ nightly_branch=$( parse_stage0_file_by_key " nightly_branch" )
13
+
14
+ # Configure "rust-lang/rust" upstream remote only when it's not origin.
15
+ if [ -z " $( git config remote.origin.url | grep $git_repository ) " ]; then
16
+ echo " Configuring https://github.com/$git_repository remote as upstream."
17
+ git remote add upstream " https://github.com/$git_repository "
18
+ REMOTE_NAME=" upstream"
19
+ else
20
+ REMOTE_NAME=" origin"
21
+ fi
22
+
23
+ git fetch $REMOTE_NAME $nightly_branch
Original file line number Diff line number Diff line change @@ -136,3 +136,15 @@ function releaseChannel {
136
136
echo $RUST_CI_OVERRIDE_RELEASE_CHANNEL
137
137
fi
138
138
}
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