-
Notifications
You must be signed in to change notification settings - Fork 41
/
Jenkinsfile
161 lines (148 loc) · 4.36 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
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
pipeline {
agent any
tools {
jdk 'temurin-jdk17-latest'
maven 'apache-maven-latest'
}
options {
disableConcurrentBuilds(abortPrevious: true)
timeout(time: 3, unit: 'HOURS')
timestamps ()
}
environment {
TRAIN_NAME = "2024-12"
STAGING_DIR = "/home/data/httpd/download.eclipse.org/staging/${TRAIN_NAME}"
}
parameters {
choice(
name: 'CBI_TYPE',
choices: ['nightly/latest', 'milestone/latest', 'release/latest'],
description: '''
Choose the type of CBI p2 Aggregator products build to use for aggregation, i.e., the relative path in the <a href="https://download.eclipse.org/cbi/updates/p2-aggregator/products/">products folder</a>.
'''
)
booleanParam(
name: 'PROMOTE',
defaultValue: true,
description: 'Whether to promote the build to the download server.'
)
booleanParam(
name: 'PGP_SIGN',
defaultValue: true,
description: 'Whether to PGP sign the repository contents.'
)
}
stages {
stage('Setup Environment') {
steps {
echo """
> Initial:
CBI_TYPE=${params.CBI_TYPE}
PROMOTE=${params.PROMOTE}
PGP_SIGN=${params.PGP_SIGN}
BRANCH_NAME=${env.BRANCH_NAME}
"""
script {
env.PGP_SIGN = params.PGP_SIGN
env.CBI_TYPE = params.CBI_TYPE
env.PROMOTE = params.PROMOTE
env.PGP_MVN_ARGUMENTS = ''
if (env.BRANCH_NAME == 'main') {
if (params.PGP_SIGN) {
env.PGP_MVN_ARGUMENTS = '-Pgpg-sign'
}
} else {
env.PROMOTE = 'false'
}
}
echo """
> Effective:
PROMOTE=${env.PROMOTE}
"""
}
}
stage('Build clean') {
steps {
script {
if (env.PROMOTE == 'true') {
withCredentials([
file(credentialsId: 'secret-subkeys.asc', variable: 'KEYRING'),
string(credentialsId: 'gpg-passphrase', variable: 'KEYRING_PASSPHRASE')]) {
sh '''
java -version
mvn \
-Dtycho.pgp.signer="bc" \
-Dtycho.pgp.signer.bc.secretKeys="${KEYRING}" \
-Dgpg.passphrase="${KEYRING_PASSPHRASE}" \
-Pbuild \
${PGP_MVN_ARGUMENTS} \
clean \
verify
'''
}
} else {
sh '''
java -version
mvn \
-Pvalidate \
-Pbuild \
clean \
test
'''
}
}
}
}
stage('Deploy to staging') {
when {
environment name: 'PROMOTE', value: 'true'
}
steps {
sshagent(['projects-storage.eclipse.org-bot-ssh']) {
script {
lock('staging-repository') {
sh '''
ssh [email protected] "
mkdir -p ${STAGING_DIR}
rm -rf ${STAGING_DIR}/*
"
scp -r ${WORKSPACE}/target/repository/final/* [email protected]:${STAGING_DIR}/
ssh [email protected] "
ls -sail ${STAGING_DIR}
"
'''
}
}
}
// Trigger EPP job
// Disabled until refactoring in https://github.com/eclipse-packaging/packages/issues/120 is complete
// sh 'curl "https://ci.eclipse.org/packaging/job/simrel.epp-tycho-build/buildWithParameters?delay=600sec&token=Yah6CohtYwO6b?6P"'
}
}
stage('Start repository analysis') {
when {
environment name: 'PROMOTE', value: 'true'
}
steps {
build job: 'simrel.oomph.repository-analyzer.test',
parameters: [
booleanParam(name: 'PROMOTE', value: true),
string(name: 'TRAIN_LOCATION', value: "staging/${env.TRAIN_NAME}")
],
wait: false
}
}
}
post {
failure {
emailext (
subject: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'",
body: """FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]':
Check console output at ${env.BUILD_URL}""",
recipientProviders: [[$class: 'DevelopersRecipientProvider']],
to: '[email protected]'
)
archiveArtifacts artifacts: 'target/eclipserun-work/configuration/*.log', allowEmptyArchive: true
}
}
}