forked from eclipse-m2e/m2e-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
86 lines (86 loc) · 2.69 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
pipeline {
options {
timeout(time: 45, unit: 'MINUTES')
buildDiscarder(logRotator(numToKeepStr:'10'))
disableConcurrentBuilds(abortPrevious: true)
timestamps()
}
agent {
label "centos-latest"
}
tools {
maven 'apache-maven-3.8.6'
jdk 'openjdk-jdk17-latest'
}
stages {
stage('get m2e-core-tests') {
steps {
sh 'git submodule update --init --recursive --remote'
}
}
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') {
steps {
withCredentials([string(credentialsId: 'gpg-passphrase', variable: 'KEYRING_PASSPHRASE')]) {
wrap([$class: 'Xvnc', useXauthority: true]) {
sh 'mvn clean verify -B -V \
-Dmaven.test.error.ignore=true -Dmaven.test.failure.ignore=true \
-Peclipse-sign,its -Dgpg.passphrase="${KEYRING_PASSPHRASE}" -Dgpg.keyname="011C526F29B2CE79"'
}}
}
post {
always {
archiveArtifacts artifacts: 'org.eclipse.m2e.repository/target/*.zip,\
*/target/work/data/.metadata/.log,\
m2e-core-tests/*/target/work/data/.metadata/.log,\
m2e-maven-runtime/target/*.properties,\
**/target/artifactcomparison/*'
archiveArtifacts (artifacts: '**/target/products/*.zip,**/target/products/*.tar.gz', onlyIfSuccessful: true)
junit '*/target/surefire-reports/TEST-*.xml,*/*/target/surefire-reports/TEST-*.xml'
}
}
}
stage('Deploy Snapshot') {
when {
branch 'master'
}
steps {
sshagent ( ['projects-storage.eclipse.org-bot-ssh']) {
sh '''
deployM2ERepository()
{
echo Deploy m2e repo to ${1}
ssh [email protected] "\
rm -rf ${1}/* && \
mkdir -p ${1}"
scp -r org.eclipse.m2e.repository/target/repository/* [email protected]:${1}
}
# Read M2E branding version
version=$(xmllint --xpath 'string(/feature/@version)' org.eclipse.m2e.sdk.feature/feature.xml)
if [[ $version =~ ([0-9]\\.[0-9]\\.[0-9])\\.qualifier ]] # backslash itself has to be escaped in Jenkinsfile
then
M2E_VERSION="${BASH_REMATCH[1]}"
else
echo Failed to read M2E_VERSION. Abort deployment.
exit 1
fi
deployM2ERepository /home/data/httpd/download.eclipse.org/technology/m2e/snapshots/${M2E_VERSION}
deployM2ERepository /home/data/httpd/download.eclipse.org/technology/m2e/snapshots/latest
'''
}
}
}
}
}