forked from eea/eionet.webq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
56 lines (56 loc) · 1.47 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
pipeline {
agent { node { label 'docker-1.13' } }
tools {
maven 'maven3'
jdk 'Java8'
}
options {
disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '4', artifactNumToKeepStr: '2'))
timeout(time: 60, unit: 'MINUTES')
}
stages {
stage('Project Build') {
steps {
sh 'mvn clean -B -V verify'
}
post {
success {
archive 'target/*.war'
}
}
}
stage('Docker push') {
when {
branch 'master'
beforeAgent true
}
steps {
script {
def date = sh(returnStdout: true, script: 'echo $(date "+%Y-%m-%dT%H%M")').trim()
image = docker.build("eworxeea/webq2:latest")
docker.withRegistry('https://index.docker.io/v1/', 'sofiageo-hub') {
image.push()
image.push(date)
}
}
}
}
stage('Static analysis') {
steps {
sh 'mvn clean -B -V -Pcobertura verify cobertura:cobertura pmd:pmd pmd:cpd findbugs:findbugs checkstyle:checkstyle'
}
post {
always {
junit '**/target/surefire-reports/*.xml'
pmd canComputeNew: false
dry canComputeNew: false
checkstyle canComputeNew: false
findbugs pattern: '**/findbugsXml.xml'
openTasks canComputeNew: false
cobertura coberturaReportFile: '**/target/site/cobertura/coverage.xml', failNoReports: true
}
}
}
}
}