Skip to content

Instantly share code, notes, and snippets.

@csrui
Created October 7, 2019 14:14
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 csrui/711c877f178d60b126a5d233e18746c7 to your computer and use it in GitHub Desktop.
Save csrui/711c877f178d60b126a5d233e18746c7 to your computer and use it in GitHub Desktop.
Notify Rollbar of a new deployment
#!/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