-
Notifications
You must be signed in to change notification settings - Fork 3
/
Jenkinsfile
158 lines (146 loc) · 4.12 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
#!/usr/bin/groovy
@Library(['github.com/indigo-dc/[email protected]']) _
pipeline {
agent {
label 'java'
}
environment {
dockerhub_repo = "indigodatacloud/cloudproviderranker"
dockerhub_image_id = ''
}
stages {
stage('Code fetching') {
steps {
checkout scm
}
}
stage('Style analysis') {
steps {
MavenRun('checkstyle:check')
}
post {
always {
CheckstyleReport()
dir("$WORKSPACE/target") {
deleteDir()
}
}
}
}
stage('Unit testing coverage') {
steps {
MavenRun('cobertura')
}
post {
success {
CoberturaReport('**/target/site/cobertura/coverage.xml')
JUnitReport()
dir("$WORKSPACE/target") {
deleteDir()
}
}
}
}
stage('Metrics gathering') {
agent {
label 'sloc'
}
steps {
checkout scm
SLOCRun()
}
post {
success {
SLOCPublish()
}
}
}
stage('Dependency check') {
agent {
label 'docker-build'
}
steps {
checkout scm
OWASPDependencyCheckRun("$WORKSPACE/CloudProviderRanker/src", project="CloudProviderRanker")
}
post {
always {
OWASPDependencyCheckPublish(report='**/dependency-check-report.xml')
HTMLReport(
"$WORKSPACE/CloudProviderRanker/src",
'dependency-check-report.html',
'OWASP Dependency Report')
deleteDir()
}
}
}
stage('DockerHub delivery') {
when {
anyOf {
branch 'master'
buildingTag()
}
}
agent {
label 'docker-build'
}
steps {
checkout scm
script {
dockerhub_image_id = DockerBuild(dockerhub_repo,
tag: env.BRANCH_NAME)
}
}
post {
success {
echo "Pushing Docker image ${dockerhub_image_id}.."
DockerPush(dockerhub_image_id)
}
failure {
echo 'Docker image building failed, removing dangling images..'
DockerClean()
}
always {
cleanWs()
}
}
}
stage('RPM/DEB package building') {
when {
anyOf {
branch 'master'
buildingTag()
}
}
agent {
label 'bcentos7'
}
steps {
checkout scm
MavenRun('package')
}
post {
success {
archiveArtifacts artifacts: '**/RPMS/noarch/*.rpm'
}
}
}
stage('Notifications') {
when {
buildingTag()
}
steps {
JiraIssueNotification(
'DEEP',
'DPM',
'10204',
"[preview-testbed] New CloudProviderRanker 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\t- RPM package/s: ${env.BUILD_URL}",
['wp3', 'preview-testbed', "CloudProviderRanker-${env.BRANCH_NAME}"],
'Task',
'mariojmdavid'
)
}
}
}
}