Skip to content

Commit b14ecdc

Browse files
committed
test
Signed-off-by: onur-ozkan <work@onurozkan.dev>
1 parent 5bc7223 commit b14ecdc

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/ci/run.sh

+14
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,20 @@ fi
4545
ci_dir=`cd $(dirname $0) && pwd`
4646
source "$ci_dir/shared.sh"
4747

48+
git_repository=$(parse_stage0_file_by_key "git_repository")
49+
nightly_branch=$(parse_stage0_file_by_key "nightly_branch")
50+
51+
# Add remote only if it doesn't exist
52+
if ! git remote | grep -q "^${git_repository}$"; then
53+
echo "Configuring remote upstream."
54+
git remote add upstream "https://github.com/${git_repository}"
55+
REMOTE_NAME="upstream"
56+
else
57+
REMOTE_NAME="origin"
58+
fi
59+
60+
git fetch $REMOTE_NAME $nightly_branch
61+
4862
export CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
4963

5064
# suppress change-tracker warnings on CI

src/ci/shared.sh

+12
Original file line numberDiff line numberDiff 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="$rust_root/src/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+
}

0 commit comments

Comments
 (0)