Skip to content

Commit 215b0bb

Browse files
authored
Merge pull request #229 from adhocteam/cm-363-record-deployments
Cm 363 record deployments
2 parents f4d1e13 + a88570d commit 215b0bb

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.circleci/config.yml

+55
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,33 @@ commands:
3131
- run:
3232
name: Combine package-lock.json files to single file
3333
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+
3461
cf_deploy:
3562
description: "Login to cloud foundry space with service account credentials
3663
and push application using deployment configuration file."
@@ -135,6 +162,18 @@ parameters:
135162
sandbox_git_branch: # change to feature branch to test deployment
136163
default: "cm-363-record-deployments"
137164
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
138177
jobs:
139178
build_and_lint:
140179
executor: docker-executor
@@ -319,6 +358,10 @@ jobs:
319358
cf run-task tta-smarthub-sandbox \
320359
--command "yarn db:migrate:prod" \
321360
--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
322365
- when: # dev
323366
condition:
324367
and:
@@ -344,6 +387,10 @@ jobs:
344387
cf run-task tta-smarthub-dev \
345388
--command "yarn db:migrate:prod" \
346389
--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
347394
- when: # staging
348395
condition:
349396
and:
@@ -367,6 +414,10 @@ jobs:
367414
name: Run database migrations
368415
command: |
369416
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
370421
- when: # prod
371422
condition:
372423
and:
@@ -390,6 +441,10 @@ jobs:
390441
name: Run database migrations
391442
command: |
392443
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
393448
workflows:
394449
build_test_deploy:
395450
jobs:

0 commit comments

Comments
 (0)