forked from ai4os/DEEPaaS
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
162 lines (150 loc) · 4.24 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
#!/usr/bin/groovy
@Library(['github.com/indigo-dc/jenkins-pipeline-library@release/1.4.0']) _
pipeline {
agent {
label 'python3.6'
}
environment {
dockerhub_repo = "indigodatacloud/deepaas"
dockerhub_image_id = ""
}
stages {
stage('Code fetching') {
steps {
checkout scm
}
}
stage('Style analysis') {
steps {
ToxEnvRun('pep8')
}
post {
always {
WarningsReport('Pep8')
}
}
}
stage('Unit testing coverage') {
steps {
ToxEnvRun('cover')
ToxEnvRun('cobertura')
}
post {
success {
HTMLReport('cover', 'index.html', 'coverage.py report')
CoberturaReport('**/coverage.xml')
}
}
}
stage('Metrics gathering') {
agent {
label 'sloc'
}
steps {
checkout scm
SLOCRun()
}
post {
success {
SLOCPublish()
}
}
}
stage('Security scanner') {
steps {
ToxEnvRun('bandit-report')
script {
if (currentBuild.result == 'FAILURE') {
currentBuild.result = 'UNSTABLE'
}
}
}
post {
always {
HTMLReport("/tmp/bandit", 'index.html', 'Bandit report')
}
}
}
stage('Dependency check') {
agent {
label 'docker-build'
}
steps {
checkout scm
OWASPDependencyCheckRun("$WORKSPACE/DEEPaaS/deepaas", project="DEEPaaS")
}
post {
always {
OWASPDependencyCheckPublish(report='**/dependency-check-report.xml')
HTMLReport(
"$WORKSPACE/DEEPaaS/deepaas",
'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 {
DockerPush(dockerhub_image_id)
}
failure {
DockerClean()
}
always {
cleanWs()
}
}
}
stage('PyPI delivery') {
when {
anyOf {
buildingTag()
}
}
steps {
PyPIDeploy('deepaas', 'indigobot-pypi')
}
}
stage('Notifications') {
when {
buildingTag()
}
steps {
JiraIssueNotification(
'DEEP',
'DPM',
'10204',
"[preview-testbed] New DEEP-as-a-Service 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', "DEEPaaS-${env.BRANCH_NAME}"],
'Task',
'mariojmdavid',
['wgcastell',
'vkozlov',
'dlugo',
'keiichiito',
'laralloret',
'ignacioheredia']
)
}
}
}
}