-
Notifications
You must be signed in to change notification settings - Fork 1
/
JenkinsfileNightly
202 lines (198 loc) · 7.84 KB
/
JenkinsfileNightly
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
#!/usr/bin/env groovy
/**
* Copyright 2017-2023 CNES - CENTRE NATIONAL d'ETUDES SPATIALES
*
* This file is part of REGARDS.
*
* REGARDS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* REGARDS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with REGARDS. If not, see <http://www.gnu.org/licenses/>.
**/
/**
* Declaratve Jenkinsfile. The language is Groovy.
* Contains the definition of a Jenkins Pipeline, is checked into source control
* and is expected to be the reference.
* To fully support multibranch builds without issues, we are using docker-compose to setup cots for each build.
*
* @author Léo Mieulet
* @see https://jenkins.io/doc/book/pipeline/jenkinsfile/
*/
pipeline {
agent { label 'unix-integration' }
stages {
stage('Preparation') {
steps {
echo "Jenkins node name = ${env.NODE_NAME}"
echo "Current workspace = ${env.WORKSPACE}"
sh 'docker pull 172.26.46.158/regards-node-jenkins:16 && chmod -R 0777 ${WORKSPACE}/webapp'
}
}
stage('Install') {
steps {
runFrontDockerImg("install", "")
}
}
stage('Parallel build') {
parallel {
stage('-1-') {
stages {
stage('Build webapp') {
steps {
runFrontDockerImg("build_webapp", "")
}
}
}
}
stage('-2-') {
stages {
stage('Build data-with-picture-only') {
steps {
runFrontDockerImg("build_plugin", "criterion/data-with-picture-only")
}
}
stage('Build last-version-only') {
steps {
runFrontDockerImg("build_plugin", "criterion/last-version-only")
}
}
stage('Build enumerated') {
steps {
runFrontDockerImg("build_plugin", "criterion/enumerated")
}
}
stage('Build fem-notify') {
steps {
runFrontDockerImg("build_plugin", "service/fem-notify")
}
}
stage('Build temporal') {
steps {
runFrontDockerImg("build_plugin", "criterion/temporal")
}
}
}
}
stage('-3-') {
stages {
stage('Build full-text') {
steps {
runFrontDockerImg("build_plugin", "criterion/full-text")
}
}
stage('Build numerical') {
steps {
runFrontDockerImg("build_plugin", "criterion/numerical")
}
}
stage('Build numerical-range-criteria') {
steps {
runFrontDockerImg("build_plugin", "criterion/numerical-range-criteria")
}
}
stage('Build string') {
steps {
runFrontDockerImg("build_plugin", "criterion/string")
}
}
stage('Build fem-edit') {
steps {
runFrontDockerImg("build_plugin", "service/fem-edit")
}
}
stage('Build SNR-criterion') {
steps {
runFrontDockerImg("build_plugin", "criterion/SNR-criterion")
}
}
}
}
stage('-4-') {
stages {
stage('Build two-numerical') {
steps {
runFrontDockerImg("build_plugin", "criterion/two-numerical")
}
}
stage('Build two-temporal') {
steps {
runFrontDockerImg("build_plugin", "criterion/two-temporal")
}
}
stage('Build toponym') {
steps {
runFrontDockerImg("build_plugin", "criterion/toponym")
}
}
stage('Build example') {
steps {
runFrontDockerImg("build_plugin", "service/example")
}
}
stage('Build fem-delete') {
steps {
runFrontDockerImg("build_plugin", "service/fem-delete")
}
}
stage('Build geo-zone') {
steps {
runFrontDockerImg("build_plugin", "criterion/geo-zone")
}
}
}
}
}
}
stage('Lint webapp') {
steps {
runFrontDockerImg("lint_webapp", "")
}
}
stage('Sonar analyse') {
steps {
parallel(
sonar: {
runFrontDockerImg("run_coverage", "")
sh 'sed -i s/app_to_build/data/g webapp/reports/coverage/lcov.info'
sh 'TAG=$(./jenkins/nginx/getPackageVersion.sh ./webapp) && \
docker run --rm \
-w /data \
-v ${WORKSPACE}:/data \
skilldlabs/sonar-scanner:4.0.0 \
sonar-scanner \
-Dsonar.projectVersion=${TAG} \
-Dsonar.branch.name=develop \
-Dsonar.projectBaseDir=/data/webapp \
-Dsonar.host.url=http://172.26.47.129:9000/ \
-Dsonar.working.directory=/tmp/'
}
)
}
}
}
post {
cleanup {
echo 'POST-CLEANUP-TASK -- Rewrire owner and access rights, to avoid future build having files issues'
sh 'chown -R jenkins:jenkins .'
sh 'chmod -R u+rwx .'
sh 'chmod -R g+rwx .'
}
}
}
// Run a docker image
// @params script script to execute
// @params pluginFolder the path to the plugin folder
@NonCPS
runFrontDockerImg(script, pluginFolder) {
sh 'docker run --rm -i --tmpfs /tmp:exec \
-v ${WORKSPACE}/webapp:/app_to_build \
172.26.46.158/regards-node-jenkins:16 ./' + script + '.sh ' + pluginFolder
}