5 # The following lines are also found in src/bootstrap/toolstate.rs,
6 # so if updating here, please also update that file.
8 export MESSAGE_FILE=$(mktemp -t msg.XXXXXX)
10 git config --global user.email '7378925+rust-toolstate-update@users.noreply.github.com'
11 git config --global user.name 'Rust Toolstate Update'
12 git config --global credential.helper store
13 printf 'https://%s:x-oauth-basic@github.com\n' "$TOOLSTATE_REPO_ACCESS_TOKEN" \
14 > "$HOME/.git-credentials"
15 git clone --depth=1 $TOOLSTATE_REPO
19 for RETRY_COUNT in 1 2 3 4 5; do
20 # The purpose is to publish the new "current" toolstate in the toolstate repo.
21 "$BUILD_SOURCESDIRECTORY/src/tools/publish_toolstate.py" "$(git rev-parse HEAD)" \
22 "$(git log --format=%s -n1 HEAD)" \
24 "$TOOLSTATE_REPO_ACCESS_TOKEN"
25 # `git commit` failing means nothing to commit.
27 git commit -a -F "$MESSAGE_FILE" || break
28 # On failure randomly sleep for 0 to 3 seconds as a crude way to introduce jittering.
29 git push origin master && break || sleep $(LC_ALL=C tr -cd 0-3 < /dev/urandom | head -c 1)
31 git fetch origin master
32 git reset --hard origin/master