forked from eclipse-passage/passage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
85 lines (85 loc) · 2.25 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
pipeline {
options {
timeout(time: 40, unit: 'MINUTES')
buildDiscarder(logRotator(numToKeepStr:'10'))
disableConcurrentBuilds(abortPrevious: true)
}
agent {
label "centos-latest"
}
tools {
maven 'apache-maven-latest'
jdk 'openjdk-jdk17-latest'
}
parameters {
choice(
name: 'BUILD_TYPE',
choices: ['nightly', 'milestone', 'release'],
description: '''
Choose the type of build.
Note that a release build will not promote the build, but rather will promote the most recent milestone build.
'''
)
booleanParam(
name: 'PROMOTE',
defaultValue: true,
description: 'Whether to promote the build to the download server.'
)
}
stages {
stage('Display Parameters') {
steps {
echo "BUILD_TYPE=${params.BUILD_TYPE}"
echo "PROMOTE=${params.PROMOTE}"
script {
env.BUILD_TYPE = params.BUILD_TYPE
if (env.BRANCH_NAME == 'master') {
if (params.PROMOTE) {
env.MAVEN_PROFILES = "-Psign -Ppromote"
} else {
env.MAVEN_PROFILES = "-Psign"
}
} else {
env.MAVEN_PROFILES = "-P baseline-check,coverage"
}
}
}
}
stage('Initialize PGP') {
steps {
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'
}
}
}
stage('Build Passage') {
steps {
sshagent (['projects-storage.eclipse.org-bot-ssh']) {
wrap([$class: 'Xvnc', useXauthority: true]) {
sh '''
mvn \
clean \
verify \
-B \
$MAVEN_PROFILES \
-Dmaven.repo.local=$WORKSPACE/.m2/repository \
-Dmaven.test.failure.ignore=true \
-Dmaven.test.error.ignore=true \
-Ddash.fail=false \
-Dorg.eclipse.justj.p2.manager.build.url=$JOB_URL \
-Dbuild.type=$BUILD_TYPE \
-Dgit.commit=$GIT_COMMIT
'''
}
}
}
post {
always {
archiveArtifacts artifacts: '**/target/repository/**/*,**/target/*.zip,**/target/work/data/.metadata/.log'
junit '**/target/surefire-reports/TEST-*.xml'
}
}
}
}
}