Created
October 7, 2019 14:14
-
-
Save csrui/711c877f178d60b126a5d233e18746c7 to your computer and use it in GitHub Desktop.
Notify Rollbar of a new deployment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Used to notify rollbar of a new deployment | |
# | |
# Usage: ./deploy-notify.sh rollbar_token environment_name | |
set -e | |
( | |
ACCESS_TOKEN=$1 | |
ENVIRONMENT=$2 | |
LOCAL_USERNAME=`whoami` | |
REVISION=`git log -n 1 --pretty=format:"%H"` | |
if [[ -z "$ACCESS_TOKEN" ]]; then | |
echo "Missing access token" | |
exit 2 | |
fi | |
if [[ -z "$ENVIRONMENT" ]]; then | |
echo "Missing environment" | |
exit 2 | |
fi | |
curl https://api.rollbar.com/api/1/deploy/ \ | |
-F access_token=$ACCESS_TOKEN \ | |
-F environment=$ENVIRONMENT \ | |
-F revision=$REVISION \ | |
-F local_username=$LOCAL_USERNAME | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment