-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile
207 lines (189 loc) · 6.35 KB
/
Jenkinsfile
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
203
204
205
206
207
#!/usr/bin/groovy
@Library(['github.com/indigo-dc/jenkins-pipeline-library@1.3.6']) _
pipeline {
agent {
label 'java-a4c'
}
environment {
dockerhub_repo = "indigodatacloud/alien4cloud-deep"
dockerhub_image_id = ''
docker_image_name = "automated_testing_alien4cloud-deep"
}
stages {
stage('Code fetching') {
steps {
checkout scm
dir("$WORKSPACE/spring-social-oidc") {
checkout([$class: 'GitSCM', branches: [[name: 'master']], extensions: [[$class: 'CleanCheckout']], userRemoteConfigs: [[url: 'https://github.com/indigo-dc/spring-social-oidc.git']]])
}
dir("$WORKSPACE/alien4cloud") {
checkout([$class: 'GitSCM', branches: [[name: 'deep-dev']], extensions: [[$class: 'CleanCheckout']], userRemoteConfigs: [[url: 'https://github.com/indigo-dc/alien4cloud.git']]])
}
}
}
stage('Build Spring OIDC') {
steps {
dir("$WORKSPACE/spring-social-oidc") {
MavenRun('-U clean install')
}
}
}
stage('Build local A4C (DEEP flavour)') {
steps {
dir("$WORKSPACE/alien4cloud") {
MavenRun('-U clean install -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true')
}
}
}
stage('Build plugin') {
steps {
dir("$WORKSPACE/indigodc-orchestrator-plugin") {
MavenRun('-U clean package')
}
}
}
stage('Style analysis') {
steps {
dir("indigodc-orchestrator-plugin") {
sh 'wget https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-8.33/src/main/resources/google_checks.xml'
sh 'wget https://github.com/checkstyle/checkstyle/releases/download/checkstyle-8.33/checkstyle-8.33-all.jar'
sh 'java -jar checkstyle-8.33-all.jar -c google_checks.xml src/ -e src/test/ -e src/main/assembly/ -f xml -o checkstyle-result.xml'
}
}
post {
always {
CheckstyleReport('**/checkstyle-result.xml')
}
}
}
stage('Unit testing coverage') {
steps {
dir("$WORKSPACE/indigodc-orchestrator-plugin") {
MavenRun('clean test')
}
}
post {
always {
jacoco()
}
}
}
stage('Metrics gathering') {
agent {
label 'sloc'
}
steps {
checkout scm
dir("indigodc-orchestrator-plugin") {
SLOCRun()
}
}
post {
success {
dir("indigodc-orchestrator-plugin") {
SLOCPublish()
}
}
}
}
stage('Dependency check') {
agent {
label 'docker-build'
}
steps {
checkout scm
OWASPDependencyCheckRun("${env.WORKSPACE}/indigodc-orchestrator-plugin/src", project="alien4cloud-deep")
}
post {
always {
OWASPDependencyCheckPublish(report='**/dependency-check-report.xml')
HTMLReport(
"${env.WORKSPACE}/indigodc-orchestrator-plugin/src",
'dependency-check-report.html',
'OWASP Dependency Report')
deleteDir()
}
}
}
stage('Docker build') {
when {
anyOf {
branch 'master'
buildingTag()
}
}
agent {
label 'docker-build'
}
steps {
checkout scm
script {
dockerhub_image_id = DockerBuild(dockerhub_repo,
tag: env.BRANCH_NAME)
}
}
post {
failure {
DockerClean()
}
always {
cleanWs()
}
}
}
/*
stage('Functional testing') {
steps {
dir("integration_testing") {
sh 'npm install puppeteer commander'
sh 'docker run -d --name ${docker_image_name} -p 8088:8088 dockerhub_image_id'
sh 'while : ; do ; $c=`docker logs --tail 2 alien4cloud-deep | grep -E "Started.*Bootstrap.*in"` ; if [[ ! -z ${c} ]] ; then ; break ; fi ; done ;'
sh 'nodejs ui_a4c.js -h \'http://localhost:8088\' -u admin -p admin -t ./AutomatedApp.yml'
}
}
post {
always {
sh 'docker kill ${docker_image_name}'
sh 'docker rm ${docker_image_name}'
}
}
}*/
stage('DockerHub delivery') {
when {
anyOf {
branch 'master'
buildingTag()
}
}
agent {
label 'docker-build'
}
steps {
DockerPush(dockerhub_image_id)
}
}
stage('Notifications') {
when {
buildingTag()
}
steps {
JiraIssueNotification(
'DEEP',
'DPM',
'10204',
"[preview-testbed] New alien4cloud version ${env.BRANCH_NAME} available",
"Check new artifacts at:\n\t- Docker image: [${dockerhub_image_id}:${env.BRANCH_NAME}|https://hub.docker.com/r/${dockerhub_image_id}/tags/]\n",
['wp3', 'preview-testbed', "alien4cloud-${env.BRANCH_NAME}"],
'Task',
'mariojmdavid',
['wgcastell',
'vkozlov',
'dlugo',
'keiichiito',
'laralloret',
'ignacioheredia']
)
}
}
}
}