From b14ecdc7204e7c38294d31d8641edfd59cb03880 Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Fri, 11 Oct 2024 17:27:27 +0300 Subject: [PATCH] test Signed-off-by: onur-ozkan --- src/ci/run.sh | 14 ++++++++++++++ src/ci/shared.sh | 12 ++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/ci/run.sh b/src/ci/run.sh index c8201d9bcfd27..89547712d2c68 100755 --- a/src/ci/run.sh +++ b/src/ci/run.sh @@ -45,6 +45,20 @@ fi ci_dir=`cd $(dirname $0) && pwd` source "$ci_dir/shared.sh" +git_repository=$(parse_stage0_file_by_key "git_repository") +nightly_branch=$(parse_stage0_file_by_key "nightly_branch") + +# Add remote only if it doesn't exist +if ! git remote | grep -q "^${git_repository}$"; then + echo "Configuring remote upstream." + git remote add upstream "https://github.com/${git_repository}" + REMOTE_NAME="upstream" +else + REMOTE_NAME="origin" +fi + +git fetch $REMOTE_NAME $nightly_branch + export CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse # suppress change-tracker warnings on CI diff --git a/src/ci/shared.sh b/src/ci/shared.sh index 2b0a10e4d08d9..9f17e2ae501d7 100644 --- a/src/ci/shared.sh +++ b/src/ci/shared.sh @@ -136,3 +136,15 @@ function releaseChannel { echo $RUST_CI_OVERRIDE_RELEASE_CHANNEL fi } + +# Parse values from ./src/stage0 file by key +function parse_stage0_file_by_key { + local key="$1" + local file="$rust_root/src/stage0" + local value=$(awk -F= '{a[$1]=$2} END {print(a["'$key'"])}' $file) + if [ -z "$value" ]; then + echo "ERROR: Key '$key' not found in '$file'." + exit 1 + fi + echo "$value" +}