submit_sentry_release.sh (906B)
1 #!/bin/bash 2 3 set -o nounset 4 set -o pipefail 5 6 run() { 7 revisions=$(curl "$HG_PUSHLOG_URL" | jq -c -r ".pushes[].changesets | @sh" | tr -d \') || return 1 8 sentry_api_key=$(curl "http://taskcluster/secrets/v1/secret/$SENTRY_SECRET" | jq -r ".secret.sentryToken") || return 1 9 for revision in $revisions; do 10 SENTRY_AUTH_TOKEN=$sentry_api_key SENTRY_ORG=mozilla sentry-cli --url https://sentry.io/ releases --project mach new "hg-rev-$revision" || return 1 11 done 12 } 13 14 with_backoff() { 15 failures=0 16 while ! "$@"; do 17 failures=$(( failures + 1 )) 18 if (( failures >= 5 )); then 19 echo "[with_backoff] Unable to succeed after 5 tries, failing the job." 20 return 1 21 else 22 seconds=$(( 2 ** (failures - 1) )) 23 echo "[with_backoff] Retrying in $seconds second(s)" 24 sleep $seconds 25 fi 26 done 27 } 28 29 with_backoff run