-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
113 lines (107 loc) · 3.01 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
pipeline {
agent {
docker {
label 'controller'
image 'nexus.intranda.com:4443/goobi-viewer-testing-index:latest'
alwaysPull true
args '-v $HOME/.m2:/var/maven/.m2:z -v $HOME/.config:/var/maven/.config -v $HOME/.sonar:/var/maven/.sonar -u 1000 -ti -e _JAVA_OPTIONS=-Duser.home=/var/maven -e MAVEN_CONFIG=/var/maven/.m2'
registryUrl 'https://nexus.intranda.com:4443/'
registryCredentialsId 'jenkins-docker'
}
}
options {
buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '15', daysToKeepStr: '90', numToKeepStr: '')
}
stages {
stage('prepare') {
steps {
sh 'git clean -fdx'
}
}
stage('build develop') {
when {
not {
anyOf {
branch 'master';
tag "v*"
}
}
}
steps {
sh 'mvn -f goobi-viewer-connector/pom.xml -DskipTests=false -DskipDependencyCheck=false -DskipCheckstyle=false clean verify -U'
}
}
stage('build release') {
when {
anyOf {
branch 'master';
tag "v*"
}
}
steps {
sh 'mvn -f goobi-viewer-connector/pom.xml -DskipTests=false -DskipDependencyCheck=false -DskipCheckstyle=false -DfailOnSnapshot=true clean verify -U'
}
}
stage('sonarcloud') {
when {
anyOf {
tag "v*"
branch 'sonar_*'
}
}
steps {
withCredentials([string(credentialsId: 'jenkins-sonarcloud', variable: 'TOKEN')]) {
sh 'mvn -f goobi-viewer-connector/pom.xml verify sonar:sonar -Dsonar.token=$TOKEN'
}
}
}
stage('deployment of artifacts to maven repository') {
when {
anyOf {
tag "v*"
branch 'develop'
}
}
steps {
sh 'mvn -f goobi-viewer-connector/pom.xml deploy'
}
}
}
post {
always {
junit "**/target/surefire-reports/*.xml"
step([
$class : 'JacocoPublisher',
execPattern : 'goobi-viewer-connector/target/jacoco.exec',
classPattern : 'goobi-viewer-connector/target/classes/',
sourcePattern : 'goobi-viewer-connector/src/main/java',
exclusionPattern : '**/*Test.class'
])
recordIssues (
enabledForFailure: true, aggregatingResults: false,
tools: [checkStyle(pattern: '**/target/checkstyle-result.xml', reportEncoding: 'UTF-8')]
)
dependencyCheckPublisher pattern: '**/target/dependency-check-report.xml'
}
success {
archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true
}
changed {
emailext(
subject: '${DEFAULT_SUBJECT}',
body: '${DEFAULT_CONTENT}',
recipientProviders: [requestor(),culprits()],
attachLog: true
)
}
failure {
emailext(
subject: '${DEFAULT_SUBJECT}',
body: '${DEFAULT_CONTENT}',
to: '[email protected]',
attachLog: true
)
}
}
}
/* vim: set ts=2 sw=2 tw=120 et :*/