diff options
Diffstat (limited to 'taskcluster/docker/sentry')
-rw-r--r-- | taskcluster/docker/sentry/Dockerfile | 11 | ||||
-rwxr-xr-x | taskcluster/docker/sentry/prepare.sh | 18 | ||||
-rw-r--r-- | taskcluster/docker/sentry/submit_sentry_release.sh | 29 |
3 files changed, 58 insertions, 0 deletions
diff --git a/taskcluster/docker/sentry/Dockerfile b/taskcluster/docker/sentry/Dockerfile new file mode 100644 index 0000000000..2f606c5529 --- /dev/null +++ b/taskcluster/docker/sentry/Dockerfile @@ -0,0 +1,11 @@ +FROM $DOCKER_IMAGE_PARENT +LABEL maintainer="Mitchell Hentges mhentges@mozilla.com" + +VOLUME /builds/worker/checkouts + +ADD prepare.sh /setup/prepare-docker.sh +ADD submit_sentry_release.sh /usr/bin/submit_sentry_release.sh +RUN /bin/bash /setup/prepare-docker.sh && rm -R /setup + +# Set a default command useful for debugging +CMD ["/bin/sh", "--login"] diff --git a/taskcluster/docker/sentry/prepare.sh b/taskcluster/docker/sentry/prepare.sh new file mode 100755 index 0000000000..7cce3e1955 --- /dev/null +++ b/taskcluster/docker/sentry/prepare.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +set -o errexit +set -o nounset +set -o xtrace + +apt-get -y update + +# Install: +# * curl to fetch sentry-cli +# * jq to parse hgmo pushlog +apt-get install -y \ + curl \ + jq + +# Install sentry-cli to publish releases +curl -L https://github.com/getsentry/sentry-cli/releases/download/1.63.1/sentry-cli-Linux-x86_64 -o /usr/bin/sentry-cli +chmod +x /usr/bin/sentry-cli diff --git a/taskcluster/docker/sentry/submit_sentry_release.sh b/taskcluster/docker/sentry/submit_sentry_release.sh new file mode 100644 index 0000000000..136e06a58a --- /dev/null +++ b/taskcluster/docker/sentry/submit_sentry_release.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +set -o nounset +set -o pipefail + +run() { + revisions=$(curl "$HG_PUSHLOG_URL" | jq -c -r ".pushes[].changesets | @sh" | tr -d \') || return 1 + sentry_api_key=$(curl "http://taskcluster/secrets/v1/secret/$SENTRY_SECRET" | jq -r ".secret.sentryToken") || return 1 + for revision in $revisions; do + SENTRY_AUTH_TOKEN=$sentry_api_key SENTRY_ORG=mozilla sentry-cli --url https://sentry.io/ releases --project mach new "hg-rev-$revision" || return 1 + done +} + +with_backoff() { + failures=0 + while ! "$@"; do + failures=$(( failures + 1 )) + if (( failures >= 5 )); then + echo "[with_backoff] Unable to succeed after 5 tries, failing the job." + return 1 + else + seconds=$(( 2 ** (failures - 1) )) + echo "[with_backoff] Retrying in $seconds second(s)" + sleep $seconds + fi + done +} + +with_backoff run |