-
Notifications
You must be signed in to change notification settings - Fork 57
/
Jenkinsfile
78 lines (71 loc) · 2.12 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
pipeline {
options {
timeout(time: 20, unit: 'MINUTES')
buildDiscarder(logRotator(numToKeepStr: '10'))
}
agent {
label 'centos-latest'
}
tools {
jdk 'temurin-jdk17-latest'
}
stages {
stage('initialize PGP') {
when {
branch 'main'
}
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') {
steps {
wrap([$class: 'Xvnc', useXauthority: true]) {
script {
if (env.BRANCH_NAME == 'main') {
withCredentials([string(credentialsId: 'gpg-passphrase', variable: 'KEYRING_PASSPHRASE')]) {
sh '''./mvnw clean deploy -B \
-Dmaven.test.failure.ignore=true \
-Dsurefire.rerunFailingTestsCount=3 \
-Psign -Dgpg.passphrase="${KEYRING_PASSPHRASE}"
'''
}
} else {
sh '''./mvnw clean verify -B \
-Dmaven.test.failure.ignore=true \
-Dsurefire.rerunFailingTestsCount=3
'''
}
}
}
}
post {
always {
archiveArtifacts artifacts: 'org.eclipse.tm4e.repository/target/repository/**/*,org.eclipse.tm4e.repository/target/*.zip,*/target/work/data/.metadata/.log'
junit '*/target/surefire-reports/TEST-*.xml'
}
}
}
stage('Deploy Snapshot') {
when {
branch 'main'
}
steps {
sshagent (['projects-storage.eclipse.org-bot-ssh']) {
sh '''
DOWNLOAD_AREA=/home/data/httpd/download.eclipse.org/tm4e/snapshots/
echo DOWNLOAD_AREA=$DOWNLOAD_AREA
ssh [email protected] "\
rm -rf ${DOWNLOAD_AREA}/* && \
mkdir -p ${DOWNLOAD_AREA}"
scp -r org.eclipse.tm4e.repository/target/repository/* [email protected]:${DOWNLOAD_AREA}
scp org.eclipse.tm4e.repository/target/org.eclipse.tm4e.repository-*-SNAPSHOT.zip [email protected]:${DOWNLOAD_AREA}/repository.zip
'''
}
}
}
}
}