-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathJenkinsfile
More file actions
103 lines (102 loc) · 4.08 KB
/
Jenkinsfile
File metadata and controls
103 lines (102 loc) · 4.08 KB
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
pipeline {
agent any
tools {
jdk "OpenJDK21"
}
stages {
stage('Update dependencies') {
steps {
withMaven(maven: 'M3', mavenLocalRepo: '.repository', publisherStrategy: 'EXPLICIT') {
sh 'mvn -s releng/osate.releng/seisettings.xml org.codehaus.mojo:versions-maven-plugin:use-reactor \
-DgenerateBackupPoms=false -Dtycho.mode=maven -Dcodecoverage=true'
}
}
}
stage('Build Pull Request') {
when {
branch pattern: "PR-\\d+", comparator: "REGEXP"
}
steps {
withMaven(maven: 'M3', mavenLocalRepo: '.repository', publisherStrategy: 'EXPLICIT') {
withCredentials([string(credentialsId: 'osate-ci_sonarcloud', variable: 'SONARTOKEN')]) {
wrap([$class: 'Xvnc', takeScreenshot: false, useXauthority: true]) {
sh 'mvn -s releng/osate.releng/seisettings.xml clean verify \
-Plocal -Dsonar.token=$SONARTOKEN \
-Dsonar.pullrequest.provider=GitHub \
-Dsonar.pullrequest.github.repository=$(echo $CHANGE_URL | cut -d/ -f4,5) \
-Dsonar.pullrequest.key=$CHANGE_ID \
-Dsonar.pullrequest.branch=$CHANGE_BRANCH \
-Dsonar.pullrequest.base=$CHANGE_TARGET \
-Declipse.p2.mirrors=false -DfailIfNoTests=false \
-Dcodecoverage=true -Dspotbugs=true -Djavadoc=false -Dpr.build=true'
}
}
}
}
}
stage('Build Products') {
when {
expression { env.GIT_BRANCH == 'origin/master' }
}
steps {
withMaven(maven: 'M3', mavenLocalRepo: '.repository') {
withCredentials([string(credentialsId: 'osate-ci_sonarcloud', variable: 'SONARTOKEN')]) {
wrap([$class: 'Xvnc', takeScreenshot: false, useXauthority: true]) {
sh 'mvn -s releng/osate.releng/seisettings.xml clean verify \
-Pfull -Dsonar.token=$SONARTOKEN \
-Declipse.p2.mirrors=false -DfailIfNoTests=false \
-Dcodecoverage=true -Dspotbugs=true -Djavadoc=true'
}
}
}
}
}
stage('Deploy') {
when {
expression { env.GIT_BRANCH == 'origin/master' }
}
steps {
sh 'bash ./deploy.sh'
}
}
}
post {
always {
recordCoverage(tools: [[parser: 'JACOCO']], id: 'jacoco', name: 'JaCoCo Coverage')
recordIssues tool: spotBugs(pattern: '**/spotbugsXml.xml', reportEncoding: 'UTF-8'), sourceCodeEncoding: 'UTF-8'
junit '**/target/surefire-reports/*.xml'
}
success {
emailext (
subject: "SUCCESS: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'",
body: """<p>SUCCESS: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]':</p>
<p>Check console output at "<a href="${env.BUILD_URL}">${env.JOB_NAME} [${env.BUILD_NUMBER}]</a>"</p>""",
recipientProviders: [[$class: 'DevelopersRecipientProvider']]
)
}
failure {
emailext (
subject: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'",
body: """<p>FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]':</p>
<p>Check console output at "<a href="${env.BUILD_URL}">${env.JOB_NAME} [${env.BUILD_NUMBER}]</a>"</p>""",
recipientProviders: [[$class: 'DevelopersRecipientProvider']]
)
}
unstable {
emailext (
subject: "UNSTABLE: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'",
body: """<p>UNSTABLE: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]':</p>
<p>Check console output at "<a href="${env.BUILD_URL}">${env.JOB_NAME} [${env.BUILD_NUMBER}]</a>"</p>""",
recipientProviders: [[$class: 'DevelopersRecipientProvider']]
)
}
fixed {
emailext (
subject: "FIXED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'",
body: """<p>FIXED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]':</p>
<p>Check console output at "<a href="${env.BUILD_URL}">${env.JOB_NAME} [${env.BUILD_NUMBER}]</a>"</p>""",
recipientProviders: [[$class: 'DevelopersRecipientProvider']]
)
}
}
}