Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
Signed-off-by: onur-ozkan <work@onurozkan.dev>
  • Loading branch information
onur-ozkan committed Oct 11, 2024
1 parent 5bc7223 commit 3c3b68a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/ci/docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,22 @@ if [ -d "$root_dir/.git" ]; then
IS_GIT_SOURCE=1
fi

if [ $IS_GIT_SOURCE -eq 1 ]; then
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 -v | 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
fi

CACHE_DOMAIN="${CACHE_DOMAIN:-ci-caches.rust-lang.org}"

if [ -f "$docker_dir/$image/Dockerfile" ]; then
Expand Down
12 changes: 12 additions & 0 deletions src/ci/shared.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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="$ci_dir/../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"
}

0 comments on commit 3c3b68a

Please sign in to comment.