1
- version : 2
1
+ version : 2.1
2
+ parameters :
3
+ run_basedeployment :
4
+ default : true
5
+ type : boolean
6
+ run_smoketesting :
7
+ default : false
8
+ type : boolean
9
+
2
10
defaults : &defaults
3
11
docker :
4
12
- image : circleci/python:2.7-stretch-browsers
13
+
14
+ test_defaults : &test_defaults
15
+ docker :
16
+ - image : docker:17.11.0-ce-git
17
+
5
18
install_dependency : &install_dependency
6
19
name : Installation of build and deployment dependencies.
7
20
command : |
8
21
sudo apt install jq
9
22
sudo pip install awscli --upgrade
10
23
sudo pip install docker-compose
24
+
25
+ install_test_dependency : &install_test_dependency
26
+ name : Installation of build and deployment dependencies.
27
+ command : |
28
+ apk update
29
+ apk add --no-cache bash openssl curl
30
+ apk upgrade
31
+ apk add --no-cache jq py-pip sudo
32
+ sudo pip install awscli --upgrade
33
+
11
34
install_deploysuite : &install_deploysuite
12
35
name : Installation of install_deploysuite.
13
36
command : |
14
37
git clone --branch v1.4 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
15
38
cp ./../buildscript/master_deploy.sh .
16
39
cp ./../buildscript/buildenv.sh .
17
40
cp ./../buildscript/awsconfiguration.sh .
41
+
18
42
restore_cache_settings_for_build : &restore_cache_settings_for_build
19
43
key : docker-node-modules-28-10-2020-{{ checksum "package-lock.json" }}
20
44
@@ -35,7 +59,7 @@ builddeploy_steps: &builddeploy_steps
35
59
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-buildvar
36
60
echo awsenvconf >.dockerignore
37
61
echo buildenvvar >>.dockerignore
38
- - run :
62
+ - run :
39
63
name : " building image"
40
64
command : |
41
65
source buildenvvar
@@ -48,7 +72,35 @@ builddeploy_steps: &builddeploy_steps
48
72
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-deployvar
49
73
source buildenvvar
50
74
./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -s ${LOGICAL_ENV}-global-appvar,${LOGICAL_ENV}-${APPNAME}-appvar -i ${APPNAME}
75
+ curl --request POST \
76
+ --url https://circleci.com/api/v2/project/github/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pipeline \
77
+ --header "Circle-Token: ${CIRCLE_TOKEN}" \
78
+ --header 'content-type: application/json' \
79
+ --data '{"branch":"'"$CIRCLE_BRANCH"'","parameters":{"run_smoketesting":true, "run_basedeployment": false}}'
51
80
81
+ # Automated Smoke Testing
82
+ smoke_testing : &smoke_testing
83
+ # Initialization.
84
+ - checkout
85
+ - setup_remote_docker
86
+ - run : *install_test_dependency
87
+ - run : *install_deploysuite
88
+ # Restoration of node_modules from cache.
89
+ - restore_cache : *restore_cache_settings_for_build
90
+ - run :
91
+ name : " configuring environment"
92
+ command : |
93
+ ./awsconfiguration.sh $DEPLOY_ENV
94
+ ./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-deployvar
95
+ - run :
96
+ name : " Run automation"
97
+ no_output_timeout : 20m
98
+ command : |
99
+ source awsenvconf
100
+ source buildenvvar
101
+ ./test-automation/smoketest.sh
102
+ - store_artifacts :
103
+ path : ./test-automation/test-results
52
104
53
105
jobs :
54
106
# Build & Deploy against development backend
@@ -59,29 +111,44 @@ jobs:
59
111
LOGICAL_ENV : " dev"
60
112
NODE_ENV : " development"
61
113
BABEL_ENV : " development"
62
- APPNAME : " challenge-engine-ui"
114
+ APPNAME : " challenge-engine-ui"
63
115
steps : *builddeploy_steps
64
116
65
117
" build-prod " :
66
118
<< : *defaults
67
119
environment :
68
120
DEPLOY_ENV : " PROD"
69
- LOGICAL_ENV : " prod"
121
+ LOGICAL_ENV : " prod"
70
122
NODE_ENV : " production"
71
123
BABEL_ENV : " production"
72
- APPNAME : " challenge-engine-ui"
124
+ APPNAME : " challenge-engine-ui"
73
125
steps : *builddeploy_steps
74
126
127
+ " smoke-testing-dev " :
128
+ << : *test_defaults
129
+ environment :
130
+ DEPLOY_ENV : " DEV"
131
+ LOGICAL_ENV : " dev"
132
+ steps : *smoke_testing
133
+
134
+ " smoke-testing-prod " :
135
+ << : *test_defaults
136
+ environment :
137
+ DEPLOY_ENV : " PROD"
138
+ LOGICAL_ENV : " prod"
139
+ steps : *smoke_testing
140
+
75
141
workflows :
76
142
version : 2
77
143
build :
144
+ when : << pipeline.parameters.run_basedeployment >>
78
145
jobs :
79
146
# Development builds are executed on "develop" branch only.
80
147
- " build-dev " :
81
148
context : org-global
82
149
filters :
83
150
branches :
84
- only : ['develop', 'feature/bug-bash-july']
151
+ only : ['develop', 'feature/bug-bash-july', 'feature/test-automation' ]
85
152
86
153
# Production builds are exectuted only on tagged commits to the
87
154
# master branch.
@@ -90,3 +157,21 @@ workflows:
90
157
filters :
91
158
branches :
92
159
only : master
160
+
161
+ Smoke Testing :
162
+ when : << pipeline.parameters.run_smoketesting >>
163
+ jobs :
164
+ - Hold [Smoke-Testing] :
165
+ type : approval
166
+ - smoke-testing-dev :
167
+ context : org-global
168
+ requires :
169
+ - Hold [Smoke-Testing]
170
+ filters :
171
+ << : *filters-dev
172
+ - smoke-testing-prod :
173
+ context : org-global
174
+ requires :
175
+ - Hold [Smoke-Testing]
176
+ filters :
177
+ << : *filters-prod
0 commit comments