Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new relic notification script post deploy. (#27)
* Add new relic notification script post deploy. * Review fixes: - Consolidate kubectl commands - Get actual API key - Update jsonpath to image to be more specific * Review fixes #2: - Use regex to get image hash from yaml (instead of asking k8s) - Alphabetize some things * Review fixes part 3: - Wrap subshell command to capture output - Improve comments - Notify new relic prior to waiting for/running acceptance tests
- Loading branch information
Showing
2 changed files
with
30 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
set -ex pipefail | ||
|
||
NEWRELIC_USER=gitlab | ||
|
||
API_KEY=$(< ~/.newrelic-api-key) | ||
|
||
# the image value in the yaml contains the first 7 digits of the git commit hash | ||
# yaml line format is as follows: | ||
# image: mozorg/snippets:283065b | ||
GIT_COMMIT_SHORT="$(grep -oP '(image: .+?:)\K.*' ${DEPLOYMENT}/web-deploy.yaml)" | ||
|
||
# go tell new relic | ||
curl -s -H "x-api-key:${API_KEY}" \ | ||
-d "deployment[app_name]=${NEWRELIC_APP}" \ | ||
-d "deployment[revision]=${GIT_COMMIT_SHORT}" \ | ||
-d "deployment[user]=${NEWRELIC_USER}" \ | ||
https://api.newrelic.com/deployments.xml |