@@ -31,6 +31,33 @@ commands:
31
31
- run :
32
32
name : Combine package-lock.json files to single file
33
33
command : cat yarn.lock frontend/yarn.lock > << parameters.filename >>
34
+ notify_new_relic :
35
+ description : " Notify new relic of a deploy"
36
+ parameters :
37
+ env_name :
38
+ description : " Name of the environment. Ex. sandbox, dev, staging, prod"
39
+ type : string
40
+ new_relic_app_id :
41
+ description : " App ID used in New Relic"
42
+ type : string
43
+ new_relic_api_key :
44
+ description : " API key from New Relic"
45
+ type : string
46
+ steps :
47
+ - run :
48
+ name : Notify New Relic
49
+ command : |
50
+ curl -X POST "https://api.newrelic.com/v2/applications/<< parameters.new_relic_app_id >>/deployments.json" \
51
+ -H "X-Api-Key: << parameters.new_relic_api_key >>" -i \
52
+ -H "Content-Type: application/json" \
53
+ -d \
54
+ "{
55
+ \"deployment\": {
56
+ \"revision\": \"<< pipeline.git.revision >>\",
57
+ \"description\": \"<< parameters.env_name >> Successfully Deployed\"
58
+ }
59
+ }"
60
+
34
61
cf_deploy :
35
62
description : " Login to cloud foundry space with service account credentials
36
63
and push application using deployment configuration file."
@@ -135,6 +162,18 @@ parameters:
135
162
sandbox_git_branch : # change to feature branch to test deployment
136
163
default : " cm-363-record-deployments"
137
164
type : string
165
+ prod_new_relic_app_id :
166
+ default : " 877570491"
167
+ type : string
168
+ staging_new_relic_app_id :
169
+ default : " 868729138"
170
+ type : string
171
+ dev_new_relic_app_id :
172
+ default : " 867221900"
173
+ type : string
174
+ sandbox_new_relic_app_id :
175
+ default : " 867346799"
176
+ type : string
138
177
jobs :
139
178
build_and_lint :
140
179
executor : docker-executor
@@ -319,6 +358,10 @@ jobs:
319
358
cf run-task tta-smarthub-sandbox \
320
359
--command "yarn db:migrate:prod" \
321
360
--name "Reset DB"
361
+ - notify_new_relic :
362
+ env_name : sandbox
363
+ new_relic_app_id : << pipeline.parameters.sandbox_new_relic_app_id >>
364
+ new_relic_api_key : $NEW_RELIC_REST_API_KEY
322
365
- when : # dev
323
366
condition :
324
367
and :
@@ -344,6 +387,10 @@ jobs:
344
387
cf run-task tta-smarthub-dev \
345
388
--command "yarn db:migrate:prod" \
346
389
--name "Reset DB"
390
+ - notify_new_relic :
391
+ env_name : dev
392
+ new_relic_app_id : << pipeline.parameters.dev_new_relic_app_id >>
393
+ new_relic_api_key : $NEW_RELIC_REST_API_KEY
347
394
- when : # staging
348
395
condition :
349
396
and :
@@ -367,6 +414,10 @@ jobs:
367
414
name : Run database migrations
368
415
command : |
369
416
cf run-task tta-smarthub-staging --command "yarn db:migrate:prod" --name migrate
417
+ - notify_new_relic :
418
+ env_name : staging
419
+ new_relic_app_id : << pipeline.parameters.staging_new_relic_app_id >>
420
+ new_relic_api_key : $NEW_RELIC_REST_API_KEY
370
421
- when : # prod
371
422
condition :
372
423
and :
@@ -390,6 +441,10 @@ jobs:
390
441
name : Run database migrations
391
442
command : |
392
443
cf run-task tta-smarthub-prod --command "yarn db:migrate:prod" --name migrate
444
+ - notify_new_relic :
445
+ env_name : prod
446
+ new_relic_app_id : << pipeline.parameters.prod_new_relic_app_id >>
447
+ new_relic_api_key : $NEW_RELIC_REST_API_KEY
393
448
workflows :
394
449
build_test_deploy :
395
450
jobs :
0 commit comments