Skip to content

Instantly share code, notes, and snippets.

@janschumann
Created February 4, 2019 18:06
Show Gist options
  • Save janschumann/3a457452805b1499bbbdb28275230526 to your computer and use it in GitHub Desktop.
Save janschumann/3a457452805b1499bbbdb28275230526 to your computer and use it in GitHub Desktop.
New Relic: Notifiy deployment
APP_NAME="<app name from newrelic.cnf"
NEW_RELIC_APP_ID=$(curl --silent -X GET 'https://api.newrelic.com/v2/applications.json' -H "X-Api-Key:${NEW_RELIC_API_KEY}" -G -d "filter[name]=${APP_NAME}" | jq -r '.applications[].id')
if [ -n $NEW_RELIC_APP_ID ]; then
curl -X POST "https://api.newrelic.com/v2/applications/${NEW_RELIC_APP_ID}/deployments.json" \
-H "X-Api-Key:${NEW_RELIC_API_KEY}" -i \
-H 'Content-Type: application/json' \
-d \
"{
\"deployment\": {
\"revision\": \"${VERSION}\",
\"user\": \"${DEPLOYER}\"
}
}"
else
echo "App ${APP_NAME} is not yet registered in NR."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment