Skip to content

Commit 1fb2235

Browse files
ci: User yaml anchor to filter automated smoke testing
1 parent fd7b884 commit 1fb2235

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

.circleci/config.yml

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ parameters:
33
run_basedeployment:
44
default: true
55
type: boolean
6+
run_smoketesting:
7+
default: false
8+
type: boolean
69
run_performancetesting:
710
default: false
811
type: boolean
@@ -182,6 +185,11 @@ jobs:
182185
source awsenvconf
183186
source buildenvvar
184187
./master_deploy.sh -d ECS -e PROD -t latest -s staging_communityapp_taskvar, -i communityapp
188+
curl --request POST \
189+
--url https://circleci.com/api/v2/project/github/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pipeline \
190+
--header "Circle-Token: ${CIRCLE_TOKEN}" \
191+
--header 'content-type: application/json' \
192+
--data '{"branch":"'"$CIRCLE_BRANCH"'","parameters":{"run_smoketesting":true , "run_performancetesting":false, "run_basedeployment": false}}'
185193
186194
# Build & Deploy against production backend
187195
"build-prod":
@@ -210,7 +218,12 @@ jobs:
210218
source awsenvconf
211219
source buildenvvar
212220
./master_deploy.sh -d ECS -e PROD -t latest -s prod_communityapp_taskvar -i communityapp
213-
221+
curl --request POST \
222+
--url https://circleci.com/api/v2/project/github/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pipeline \
223+
--header "Circle-Token: ${CIRCLE_TOKEN}" \
224+
--header 'content-type: application/json' \
225+
--data '{"branch":"'"$CIRCLE_BRANCH"'","parameters":{"run_smoketesting":true , "run_performancetesting":false, "run_basedeployment": false}}'
226+
214227
# Automated Smoke Testing against Staging
215228
Smoke-Testing-On-Staging:
216229
<<: *defaults
@@ -236,8 +249,8 @@ jobs:
236249
./automated-smoke-test/smoketest.sh automation-config-staging.json prod
237250
- store_artifacts:
238251
path: /automated-smoke-test/test-results
239-
240-
# Automated Smoke Testing against Production
252+
253+
# Automated Smoke Testing against Production
241254
Smoke-Testing-On-Production:
242255
<<: *defaults
243256
steps:
@@ -277,7 +290,7 @@ jobs:
277290
paths:
278291
- node_modules
279292
- run: npm test
280-
293+
281294
Performance-Testing:
282295
docker:
283296
# specify the version you desire here
@@ -315,7 +328,7 @@ jobs:
315328

316329
- store_artifacts:
317330
path: target/jmeter/reports
318-
331+
319332
workflows:
320333
version: 2
321334
Build:
@@ -352,7 +365,7 @@ workflows:
352365
# This is stage env for production QA releases
353366
- "build-prod-staging":
354367
context : org-global
355-
filters:
368+
filters: &filters-staging
356369
branches:
357370
only:
358371
- develop
@@ -365,7 +378,7 @@ workflows:
365378
# master branch.
366379
- "build-prod":
367380
context : org-global
368-
filters:
381+
filters: &filters-prod
369382
branches:
370383
only:
371384
- master
@@ -379,9 +392,8 @@ workflows:
379392

380393
Smoke Testing:
381394
when:
382-
or:
383-
- equal: [ develop, << pipeline.git.branch >> ]
384-
- equal: [ master, << pipeline.git.branch >> ]
395+
and:
396+
- << pipeline.parameters.run_smoketesting >>
385397
jobs:
386398
- Hold [Smoke-Testing]:
387399
type: approval
@@ -390,17 +402,13 @@ workflows:
390402
requires:
391403
- Hold [Smoke-Testing]
392404
filters:
393-
branches:
394-
only:
395-
- develop
405+
<<: *filters-staging
396406
- Smoke-Testing-On-Production:
397407
context : org-global
398408
requires:
399409
- Hold [Smoke-Testing]
400410
filters:
401-
branches:
402-
only:
403-
- master
411+
<<: *filters-prod
404412

405413
Performance Testing:
406414
when: << pipeline.parameters.run_performancetesting >>

0 commit comments

Comments
 (0)