Skip to content

Commit 1269ba0

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

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

src/ci/docker/run.sh

+16
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,22 @@ if [ -d "$root_dir/.git" ]; then
5050
IS_GIT_SOURCE=1
5151
fi
5252

53+
if [ $IS_GIT_SOURCE -eq 1 ]; then
54+
git_repository=$(parse_stage0_file_by_key "git_repository")
55+
nightly_branch=$(parse_stage0_file_by_key "nightly_branch")
56+
57+
# Add remote only if it doesn't exist
58+
if ! git remote | grep -q "^${git_repository}$"; then
59+
echo "Configuring remote upstream."
60+
git remote add upstream "https://github.com/${git_repository}"
61+
REMOTE_NAME="upstream"
62+
else
63+
REMOTE_NAME="origin"
64+
fi
65+
66+
git fetch $REMOTE_NAME $nightly_branch
67+
fi
68+
5369
CACHE_DOMAIN="${CACHE_DOMAIN:-ci-caches.rust-lang.org}"
5470

5571
if [ -f "$docker_dir/$image/Dockerfile" ]; then

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="$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+
}

0 commit comments

Comments
 (0)