Skip to content

Commit a7b6bfe

Browse files
authored
Merge pull request #238 from snyk/chore/always-notify-failures
chore: always notify failures
2 parents 655f5a7 + 47ca730 commit a7b6bfe

File tree

1 file changed

+38
-13
lines changed

1 file changed

+38
-13
lines changed

.circleci/config.yml

+38-13
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ jobs:
3737
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" &&
3838
nvm install v10 &&
3939
npm install &&
40-
npm run test:apk ||
41-
(./scripts/slack-notify-failure.sh "APK regression test" && false)
40+
npm run test:apk
41+
- run:
42+
name: Notify Slack on failure
43+
command: ./scripts/slack-notify-failure.sh "apk-tests"
44+
when: on_fail
4245

4346
package_manager_test_apt:
4447
<<: *default_machine_config
@@ -51,9 +54,11 @@ jobs:
5154
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" &&
5255
nvm install v10 &&
5356
npm install &&
54-
npm run test:apt ||
55-
(./scripts/slack-notify-failure.sh "APT regression test" && false)
56-
57+
npm run test:apt
58+
- run:
59+
name: Notify Slack on failure
60+
command: ./scripts/slack-notify-failure.sh "apt-tests"
61+
when: on_fail
5762
package_manager_test_rpm:
5863
<<: *default_machine_config
5964
steps:
@@ -65,8 +70,11 @@ jobs:
6570
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" &&
6671
nvm install v10 &&
6772
npm install &&
68-
npm run test:rpm ||
69-
(./scripts/slack-notify-failure.sh "RPM regression test" && false)
73+
npm run test:rpm
74+
- run:
75+
name: Notify Slack on failure
76+
command: ./scripts/slack-notify-failure.sh "rpm-tests"
77+
when: on_fail
7078

7179
######################## PR TO STAGING ########################
7280
test_discardable:
@@ -102,8 +110,11 @@ jobs:
102110
./scripts/build-image.sh ${IMAGE_NAME_CANDIDATE} &&
103111
docker push ${IMAGE_NAME_CANDIDATE} &&
104112
./scripts/slack-notify-push.sh ${IMAGE_NAME_CANDIDATE} &&
105-
KUBERNETES_MONITOR_IMAGE_NAME_AND_TAG=${IMAGE_NAME_CANDIDATE} npm run test:integration ||
106-
( ./scripts/slack-notify-failure.sh "staging-test" && false )
113+
KUBERNETES_MONITOR_IMAGE_NAME_AND_TAG=${IMAGE_NAME_CANDIDATE} npm run test:integration
114+
- run:
115+
name: Notify Slack on failure
116+
command: ./scripts/slack-notify-failure.sh "staging-test"
117+
when: on_fail
107118
tag_and_push:
108119
<<: *default_container_config
109120
steps:
@@ -120,8 +131,11 @@ jobs:
120131
unset CIRCLE_PULL_REQUESTS &&
121132
npx semantic-release &&
122133
NEW_VERSION=`cat ./package.json | jq -r '.version'` &&
123-
./scripts/approve-image.sh $NEW_VERSION ||
124-
( ./scripts/slack-notify-failure.sh "staging-release" && false )
134+
./scripts/approve-image.sh $NEW_VERSION
135+
- run:
136+
name: Notify Slack on failure
137+
command: ./scripts/slack-notify-failure.sh "staging-release"
138+
when: on_fail
125139
deploy_dev:
126140
<<: *default_container_config
127141
steps:
@@ -136,6 +150,10 @@ jobs:
136150
-X POST -d "{\"docker_sha\":\"${LATEST_TAG}\", \
137151
\"commit_hash\":\"${CIRCLE_SHA1}\"}" \
138152
https://my.dev.snyk.io/${DEV_DEPLOY_TOKEN}
153+
- run:
154+
name: Notify Slack on failure
155+
command: ./scripts/slack-notify-failure.sh "deploy-dev"
156+
when: on_fail
139157

140158
######################## PR TO MASTER ########################
141159
prepublish:
@@ -165,8 +183,11 @@ jobs:
165183
docker tag ${IMAGE_NAME_APPROVED} ${IMAGE_NAME_PUBLISHED} &&
166184
docker push ${IMAGE_NAME_PUBLISHED} &&
167185
./scripts/slack-notify-push.sh ${IMAGE_NAME_PUBLISHED} &&
168-
./scripts/publish-gh-pages.sh ${LATEST_TAG} ||
169-
( ./scripts/slack-notify-failure.sh master && false )
186+
./scripts/publish-gh-pages.sh ${LATEST_TAG}
187+
- run:
188+
name: Notify Slack on failure
189+
command: ./scripts/slack-notify-failure.sh "master"
190+
when: on_fail
170191

171192
deploy_prod:
172193
<<: *default_container_config
@@ -181,6 +202,10 @@ jobs:
181202
curl -i -H "Accept: application/json" -H "Content-Type: application/json" \
182203
-X POST -d "{}" \
183204
https://my.prod.snyk.io/${PROD_DEPLOY_TOKEN}
205+
- run:
206+
name: Notify Slack on failure
207+
command: ./scripts/slack-notify-failure.sh "deploy-prod"
208+
when: on_fail
184209

185210
#######################################################################
186211

0 commit comments

Comments
 (0)