-
Notifications
You must be signed in to change notification settings - Fork 145
/
build.Jenkinsfile
121 lines (119 loc) · 3.52 KB
/
build.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
pipeline {
agent {
kubernetes {
// See comment in deplog-build.sh (gpg:sign-and-deploy-file)
inheritFrom 'ubuntu-2404'
}
}
tools {
maven 'apache-maven-latest'
jdk 'temurin-jdk11-latest'
}
options {
timestamps()
disableConcurrentBuilds()
}
stages {
stage('Clean') {
steps {
timeout(activity: true, time: 20) {
sh '''
git status --ignored
git clean -dfx
git reset --hard HEAD
git status --ignored
'''
}
}
}
stage('Gradle') {
steps {
timeout(activity: true, time: 20) {
sh "echo $JAVA_HOME"
sh "java -version"
sh "which java"
sh "./gradlew \
--no-daemon \
-PignoreTestFailures=true \
--refresh-dependencies \
--continue \
clean build signJar publish \
"
}
}
}
stage('Maven') {
steps {
timeout(activity: true, time: 20) {
sh "mvn \
-f releng/pom.xml \
-Dmaven.repo.local=.repository \
--batch-mode --update-snapshots \
clean install -Psign \
"
}
}
}
stage('japicmp') {
steps {
timeout(activity: true, time: 20) {
sh "./releng/runjapicmp.sh"
}
}
}
stage('Deploy Snapshot') {
steps {
timeout(activity: true, time: 20) {
withCredentials([file(credentialsId: 'secret-subkeys.asc', variable: 'KEYRING')]) {
sh 'gpg --batch --import "${KEYRING}"'
sh 'for fpr in $(gpg --list-keys --with-colons | awk -F: \'/fpr:/ {print $10}\' | sort -u); do echo -e "5\ny\n" | gpg --batch --command-fd 0 --expert --edit-key ${fpr} trust; done'
}
sshagent ( ['projects-storage.eclipse.org-bot-ssh']) {
// Skip Deploy on release builds
// XXX: Can release vs snapshot be detected automatically so that
// the following line does not have to be commented/uncommented
// on each change to/from SNAPSHOT?
sh 'cd releng && ./deploy-build.sh'
}
}
}
}
}
post {
always {
junit '**/build/test-results/test/*.xml'
archiveArtifacts 'build/**'
}
cleanup {
script {
def curResult = currentBuild.currentResult
def lastResult = 'NEW'
if (currentBuild.previousBuild != null) {
lastResult = currentBuild.previousBuild.result
}
if (curResult != 'SUCCESS' || lastResult != 'SUCCESS') {
def color = ''
switch (curResult) {
case 'SUCCESS':
color = '#00FF00'
break
case 'UNSTABLE':
color = '#FFFF00'
break
case 'FAILURE':
color = '#FF0000'
break
default: // e.g. ABORTED
color = '#666666'
}
matrixSendMessage https: true,
hostname: 'matrix.eclipse.org',
accessTokenCredentialsId: "matrix-token",
roomId: '!OVFCkkbjNkALzklVdr:matrix.eclipse.org',
body: "${lastResult} => ${curResult} ${env.BUILD_URL} | ${env.JOB_NAME}#${env.BUILD_NUMBER}",
formattedBody: "<div><font color='${color}'>${lastResult} => ${curResult}</font> | <a href='${env.BUILD_URL}' target='_blank'>${env.JOB_NAME}#${env.BUILD_NUMBER}</a></div>"
}
}
}
}
}