blob: d8ff74078220eaee7d45c4af1536564831c455d6 [file] [log] [blame]
set -eu
# The following lines are also found in src/bootstrap/,
# so if updating here, please also update that file.
export MESSAGE_FILE=$(mktemp -t msg.XXXXXX)
git config --global ''
git config --global 'Rust Toolstate Update'
git config --global credential.helper store
> "$HOME/.git-credentials"
git clone --depth=1 $TOOLSTATE_REPO
cd rust-toolstate
for RETRY_COUNT in 1 2 3 4 5; do
# The purpose is to publish the new "current" toolstate in the toolstate repo.
"$BUILD_SOURCESDIRECTORY/src/tools/" "$(git rev-parse HEAD)" \
"$(git log --format=%s -n1 HEAD)" \
# `git commit` failing means nothing to commit.
git commit -a -F "$MESSAGE_FILE" || break
# On failure randomly sleep for 0 to 3 seconds as a crude way to introduce jittering.
git push origin master && break || sleep $(LC_ALL=C tr -cd 0-3 < /dev/urandom | head -c 1)
git fetch origin master
git reset --hard origin/master