@@ -17,13 +17,11 @@ pipeline {
17
17
IMAGE = ' nginx-proxy-manager'
18
18
BUILD_VERSION = getVersion()
19
19
MAJOR_VERSION = ' 2'
20
- BRANCH_LOWER = " ${ BRANCH_NAME.toLowerCase().replaceAll('/ ', '-')} "
20
+ BRANCH_LOWER = " ${ BRANCH_NAME.toLowerCase().replaceAll('\\\\', '-').replaceAll('/', '-').replaceAll('\\. ', '-')} "
21
21
COMPOSE_PROJECT_NAME = " npm_${ BRANCH_LOWER} _${ BUILD_NUMBER} "
22
22
COMPOSE_FILE = ' docker/docker-compose.ci.yml'
23
23
COMPOSE_INTERACTIVE_NO_CLI = 1
24
24
BUILDX_NAME = " ${ COMPOSE_PROJECT_NAME} "
25
- DOCS_BUCKET = ' jc21-npm-site'
26
- DOCS_CDN = ' EN1G6DEWZUTDT'
27
25
}
28
26
stages {
29
27
stage(' Environment' ) {
@@ -62,103 +60,114 @@ pipeline {
62
60
}
63
61
}
64
62
}
65
- stage(' Build and Test' ) {
66
- steps {
67
- script {
68
- // Frontend and Backend
69
- def shStatusCode = sh(label : ' Checking and Building' , returnStatus : true , script : '''
70
- set -e
71
- ./scripts/ci/frontend-build > ${WORKSPACE}/tmp-sh-build 2>&1
72
- ./scripts/ci/test-and-build > ${WORKSPACE}/tmp-sh-build 2>&1
73
- ''' )
74
- shOutput = readFile " ${ env.WORKSPACE} /tmp-sh-build"
75
- if (shStatusCode != 0 ) {
76
- error " ${ shOutput} "
63
+ stage(' Builds' ) {
64
+ parallel {
65
+ stage(' Project' ) {
66
+ steps {
67
+ script {
68
+ // Frontend and Backend
69
+ def shStatusCode = sh(label : ' Checking and Building' , returnStatus : true , script : '''
70
+ set -e
71
+ ./scripts/ci/frontend-build > ${WORKSPACE}/tmp-sh-build 2>&1
72
+ ./scripts/ci/test-and-build > ${WORKSPACE}/tmp-sh-build 2>&1
73
+ ''' )
74
+ shOutput = readFile " ${ env.WORKSPACE} /tmp-sh-build"
75
+ if (shStatusCode != 0 ) {
76
+ error " ${ shOutput} "
77
+ }
78
+ }
79
+ }
80
+ post {
81
+ always {
82
+ sh ' rm -f ${WORKSPACE}/tmp-sh-build'
83
+ }
84
+ failure {
85
+ npmGithubPrComment(" CI Error:\n\n ```\n ${ shOutput} \n ```" , true )
86
+ }
77
87
}
78
88
}
79
- }
80
- post {
81
- always {
82
- sh ' rm -f ${WORKSPACE}/tmp-sh-build'
83
- }
84
- failure {
85
- npmGithubPrComment(" CI Error:\n\n ```\n ${ shOutput} \n ```" , true )
89
+ stage(' Docs' ) {
90
+ steps {
91
+ dir(path : ' docs' ) {
92
+ sh ' yarn install'
93
+ sh ' yarn build'
94
+ }
95
+ dir(path : ' docs/.vuepress/dist' ) {
96
+ sh ' tar -czf ../../docs.tgz *'
97
+ }
98
+ archiveArtifacts(artifacts : ' docs/docs.tgz' , allowEmptyArchive : false )
99
+ }
86
100
}
87
- }
88
- }
89
- stage(' Integration Tests Sqlite' ) {
90
- steps {
91
- // Bring up a stack
92
- sh ' docker-compose up -d fullstack-sqlite'
93
- sh ' ./scripts/wait-healthy $(docker-compose ps --all -q fullstack-sqlite) 120'
94
- // Stop and Start it, as this will test it's ability to restart with existing data
95
- sh ' docker-compose stop fullstack-sqlite'
96
- sh ' docker-compose start fullstack-sqlite'
97
- sh ' ./scripts/wait-healthy $(docker-compose ps --all -q fullstack-sqlite) 120'
98
-
99
- // Run tests
100
- sh ' rm -rf test/results'
101
- sh ' docker-compose up cypress-sqlite'
102
- // Get results
103
- sh ' docker cp -L "$(docker-compose ps --all -q cypress-sqlite):/test/results" test/'
104
- }
105
- post {
106
- always {
107
- // Dumps to analyze later
108
- sh ' mkdir -p debug'
109
- sh ' docker-compose logs fullstack-sqlite > debug/docker_fullstack_sqlite.log'
110
- sh ' docker-compose logs db > debug/docker_db.log'
111
- // Cypress videos and screenshot artifacts
112
- dir(path : ' test/results' ) {
113
- archiveArtifacts allowEmptyArchive : true , artifacts : ' **/*' , excludes : ' **/*.xml'
114
- }
115
- junit ' test/results/junit/*'
101
+ stage(' Cypress' ) {
102
+ steps {
103
+ // Creating will also create the network prior to
104
+ // using it in parallel stages below and mitigating
105
+ // a race condition.
106
+ sh ' docker-compose build cypress-sqlite'
107
+ sh ' docker-compose build cypress-mysql'
108
+ sh ' docker-compose create cypress-sqlite'
109
+ sh ' docker-compose create cypress-mysql'
110
+ }
116
111
}
117
112
}
118
113
}
119
- stage(' Integration Tests Mysql' ) {
120
- steps {
121
- // Bring up a stack
122
- sh ' docker-compose up -d fullstack-mysql'
123
- sh ' ./scripts/wait-healthy $(docker-compose ps --all -q fullstack-mysql) 120'
114
+ stage(' Integration Tests' ) {
115
+ parallel {
116
+ stage(' Sqlite' ) {
117
+ steps {
118
+ // Bring up a stack
119
+ sh ' docker-compose up -d fullstack-sqlite'
120
+ sh ' ./scripts/wait-healthy $(docker-compose ps --all -q fullstack-sqlite) 120'
121
+ // Stop and Start it, as this will test it's ability to restart with existing data
122
+ sh ' docker-compose stop fullstack-sqlite'
123
+ sh ' docker-compose start fullstack-sqlite'
124
+ sh ' ./scripts/wait-healthy $(docker-compose ps --all -q fullstack-sqlite) 120'
124
125
125
- // Run tests
126
- sh ' rm -rf test/results'
127
- sh ' docker-compose up cypress-mysql'
128
- // Get results
129
- sh ' docker cp -L "$(docker-compose ps --all -q cypress-mysql):/test/results" test/'
130
- }
131
- post {
132
- always {
133
- // Dumps to analyze later
134
- sh ' mkdir -p debug'
135
- sh ' docker-compose logs fullstack-mysql > debug/docker_fullstack_mysql.log'
136
- sh ' docker-compose logs db > debug/docker_db.log'
137
- // Cypress videos and screenshot artifacts
138
- dir(path : ' test/results' ) {
139
- archiveArtifacts allowEmptyArchive : true , artifacts : ' **/*' , excludes : ' **/*.xml'
140
- }
141
- junit ' test/results/junit/*'
142
- }
143
- }
144
- }
145
- stage(' Docs' ) {
146
- when {
147
- not {
148
- equals expected : ' UNSTABLE' , actual : currentBuild. result
149
- }
150
- }
151
- steps {
152
- dir(path : ' docs' ) {
153
- sh ' yarn install'
154
- sh ' yarn build'
126
+ // Run tests
127
+ sh ' rm -rf test/results-sqlite'
128
+ sh ' docker-compose up cypress-sqlite'
129
+ // Get results
130
+ sh ' docker cp -L "$(docker-compose ps --all -q cypress-sqlite):/test/results" test/results-sqlite'
131
+ }
132
+ post {
133
+ always {
134
+ // Dumps to analyze later
135
+ sh ' mkdir -p debug/sqlite'
136
+ sh ' docker-compose logs fullstack-sqlite > debug/sqlite/docker_fullstack_sqlite.log'
137
+ // Cypress videos and screenshot artifacts
138
+ dir(path : ' test/results-sqlite' ) {
139
+ archiveArtifacts allowEmptyArchive : true , artifacts : ' **/*' , excludes : ' **/*.xml'
140
+ }
141
+ junit ' test/results-sqlite/junit/*'
142
+ }
143
+ }
155
144
}
145
+ stage(' Mysql' ) {
146
+ steps {
147
+ // Bring up a stack
148
+ sh ' docker-compose up -d fullstack-mysql'
149
+ sh ' ./scripts/wait-healthy $(docker-compose ps --all -q fullstack-mysql) 120'
156
150
157
- dir(path : ' docs/.vuepress/dist' ) {
158
- sh ' tar -czf ../../docs.tgz *'
151
+ // Run tests
152
+ sh ' rm -rf test/results-mysql'
153
+ sh ' docker-compose up cypress-mysql'
154
+ // Get results
155
+ sh ' docker cp -L "$(docker-compose ps --all -q cypress-mysql):/test/results" test/results-mysql'
156
+ }
157
+ post {
158
+ always {
159
+ // Dumps to analyze later
160
+ sh ' mkdir -p debug/mysql'
161
+ sh ' docker-compose logs fullstack-mysql > debug/mysql/docker_fullstack_mysql.log'
162
+ sh ' docker-compose logs db > debug/mysql/docker_db.log'
163
+ // Cypress videos and screenshot artifacts
164
+ dir(path : ' test/results-mysql' ) {
165
+ archiveArtifacts allowEmptyArchive : true , artifacts : ' **/*' , excludes : ' **/*.xml'
166
+ }
167
+ junit ' test/results-mysql/junit/*'
168
+ }
169
+ }
159
170
}
160
-
161
- archiveArtifacts(artifacts : ' docs/docs.tgz' , allowEmptyArchive : false )
162
171
}
163
172
}
164
173
stage(' MultiArch Build' ) {
@@ -174,31 +183,48 @@ pipeline {
174
183
}
175
184
}
176
185
}
177
- stage(' Docs Deploy' ) {
178
- when {
179
- allOf {
180
- branch ' master'
181
- not {
182
- equals expected : ' UNSTABLE' , actual : currentBuild. result
186
+ stage(' Docs / Comment' ) {
187
+ parallel {
188
+ stage(' Master Docs' ) {
189
+ when {
190
+ allOf {
191
+ branch ' master'
192
+ not {
193
+ equals expected : ' UNSTABLE' , actual : currentBuild. result
194
+ }
195
+ }
196
+ }
197
+ steps {
198
+ npmDocsReleaseMaster()
183
199
}
184
200
}
185
- }
186
- steps {
187
- npmDocsRelease( " $D OCS_BUCKET " , " $D OCS_CDN " )
188
- }
189
- }
190
- stage( ' PR Comment ' ) {
191
- when {
192
- allOf {
193
- changeRequest()
194
- not {
195
- equals expected : ' UNSTABLE ' , actual : currentBuild . result
201
+ stage( ' Develop Docs ' ) {
202
+ when {
203
+ allOf {
204
+ branch ' develop '
205
+ not {
206
+ equals expected : ' UNSTABLE ' , actual : currentBuild . result
207
+ }
208
+ }
209
+ }
210
+ steps {
211
+ npmDocsReleaseDevelop()
196
212
}
197
213
}
198
- }
199
- steps {
200
- script {
201
- npmGithubPrComment(" Docker Image for build ${ BUILD_NUMBER} is available on [DockerHub](https://cloud.docker.com/repository/docker/jc21/${ IMAGE} ) as `jc21/${ IMAGE} :github-${ BRANCH_LOWER} `\n\n **Note:** ensure you backup your NPM instance before testing this PR image! Especially if this PR contains database changes." , true )
214
+ stage(' PR Comment' ) {
215
+ when {
216
+ allOf {
217
+ changeRequest()
218
+ not {
219
+ equals expected : ' UNSTABLE' , actual : currentBuild. result
220
+ }
221
+ }
222
+ }
223
+ steps {
224
+ script {
225
+ npmGithubPrComment(" Docker Image for build ${ BUILD_NUMBER} is available on [DockerHub](https://cloud.docker.com/repository/docker/jc21/${ IMAGE} ) as `jc21/${ IMAGE} :github-${ BRANCH_LOWER} `\n\n **Note:** ensure you backup your NPM instance before testing this PR image! Especially if this PR contains database changes." , true )
226
+ }
227
+ }
202
228
}
203
229
}
204
230
}
@@ -214,12 +240,12 @@ pipeline {
214
240
sh ' figlet "SUCCESS"'
215
241
}
216
242
failure {
217
- archiveArtifacts(artifacts : ' debug/**.*' , allowEmptyArchive : true )
243
+ archiveArtifacts(artifacts : ' debug/**/* .*' , allowEmptyArchive : true )
218
244
juxtapose event : ' failure'
219
245
sh ' figlet "FAILURE"'
220
246
}
221
247
unstable {
222
- archiveArtifacts(artifacts : ' debug/**.*' , allowEmptyArchive : true )
248
+ archiveArtifacts(artifacts : ' debug/**/* .*' , allowEmptyArchive : true )
223
249
juxtapose event : ' unstable'
224
250
sh ' figlet "UNSTABLE"'
225
251
}
0 commit comments