Skip to content

Instantly share code, notes, and snippets.

@redroot
Last active January 25, 2017 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save redroot/01d044e77ee40181d2d6353991a827f7 to your computer and use it in GitHub Desktop.
Save redroot/01d044e77ee40181d2d6353991a827f7 to your computer and use it in GitHub Desktop.
Sentry Releases API bug
Ø ./sentry-test
1) deleting staging release luke-test-release for kindness/kindness-frontend-staging
2) deleting production release luke-test-release for kindness/kindness-frontend
{"detail": ""}
3) creating staging release luke-test-release for kindness/kindness-frontend-staging at 2017-01-25T15:35:28Z
{"dateReleased": null, "lastEvent": null, "url": null, "ref": null, "dateCreated": "2017-01-25T15:35:30.706Z", "owner": null, "version": "luke-test-release", "firstEvent": null, "shortVersion": "luke-test-release", "dateStarted": "2017-01-25T15:35:28Z", "newGroups": 0, "data": {}}
4) creating production release luke-test-release for kindness/kindness-frontend at 2017-01-25T15:35:35Z
{"dateReleased": null, "lastEvent": null, "url": null, "ref": null, "dateCreated": "2017-01-25T15:35:30.706Z", "owner": null, "version": "luke-test-release", "firstEvent": null, "shortVersion": "luke-test-release", "dateStarted": "2017-01-25T15:35:28Z", "newGroups": 0, "data": {}}
5) Uploading to staging - ./test.txt
{"sha1": "8c0fb9175cccd43c833ccf05204c5e0f0bef1a2e", "name": "~/test.txt", "dateCreated": "2017-01-25T15:35:37.750Z", "headers": {"Content-Type": "text/plain"}, "id": "5453557", "size": 10}
6) Uploading to production - ./test.txt
{"detail": "A file matching this name already exists for the given release"}
#!/usr/bin/env bash
set -e
set -o pipefail
ORG='kindness'
PROJECT_STAGING='kindness-frontend-staging'
PROJECT_PRODUCTION='kindness-frontend'
RELEASE_ID='luke-test-release'
TEST_FILE='./test.txt'
STAGING_RELEASE_PROCESS_TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
echo "1) deleting staging release $RELEASE_ID for $ORG/$PROJECT_STAGING"
printf "\n"
curl https://sentry.io/api/0/projects/$ORG/$PROJECT_STAGING/releases/$RELEASE_ID/ \
-X DELETE \
-H "Authorization: Bearer $SENTRY_API_KEY" \
-H 'Content-Type: application/json'
printf "\n"
echo "2) deleting production release $RELEASE_ID for $ORG/$PROJECT_PRODUCTION"
printf "\n"
curl https://sentry.io/api/0/projects/$ORG/$PROJECT_PRODUCTION/releases/$RELEASE_ID/ \
-X DELETE \
-H "Authorization: Bearer $SENTRY_API_KEY" \
-H 'Content-Type: application/json'
printf "\n"
echo "3) creating staging release $RELEASE_ID for $ORG/$PROJECT_STAGING at $STAGING_RELEASE_PROCESS_TIMESTAMP"
printf "\n"
curl https://sentry.io/api/0/projects/$ORG/$PROJECT_STAGING/releases/ \
-X POST \
-H "Authorization: Bearer $SENTRY_API_KEY" \
-H 'Content-Type: application/json' \
-d "{\"version\": \"$RELEASE_ID\", \"dateStarted\": \"$STAGING_RELEASE_PROCESS_TIMESTAMP\"}"
printf "\n"
sleep 5
PRODUCTION_RELEASE_PROCESS_TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
echo "4) creating production release $RELEASE_ID for $ORG/$PROJECT_PRODUCTION at $PRODUCTION_RELEASE_PROCESS_TIMESTAMP"
printf "\n"
curl https://sentry.io/api/0/projects/$ORG/$PROJECT_PRODUCTION/releases/ \
-X POST \
-H "Authorization: Bearer $SENTRY_API_KEY" \
-H 'Content-Type: application/json' \
-d "{\"version\": \"$RELEASE_ID\", \"dateStarted\": \"$PRODUCTION_RELEASE_PROCESS_TIMESTAMP\"}"
printf "\n"
echo '5) Uploading to staging - ' $TEST_FILE
printf "\n"
curl https://sentry.io/api/0/projects/$ORG/$PROJECT_STAGING/releases/$RELEASE_ID/files/ \
-X POST \
-H "Authorization: Bearer $SENTRY_API_KEY" \
-F file=@$TEST_FILE \
-F name="~/$(basename $TEST_FILE)"
printf "\n"
echo '6) Uploading to production - ' $TEST_FILE
printf "\n"
curl https://sentry.io/api/0/projects/$ORG/$PROJECT_PRODUCTION/releases/$RELEASE_ID/files/ \
-X POST \
-H "Authorization: Bearer $SENTRY_API_KEY" \
-F file=@$TEST_FILE \
-F name="~/$(basename $TEST_FILE)"
printf "\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment