-
Notifications
You must be signed in to change notification settings - Fork 94
Expand file tree
/
Copy pathbuild.jenkinsfile
More file actions
638 lines (594 loc) · 25.7 KB
/
build.jenkinsfile
File metadata and controls
638 lines (594 loc) · 25.7 KB
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
@groovy.transform.Field
def BUILD = null
@groovy.transform.Field
def BUILD_PROPERTIES = [:]
pipeline {
options {
timeout(time: 360, unit: 'MINUTES')
timestamps()
buildDiscarder(logRotator(numToKeepStr:'25', artifactNumToKeepStr: '3'))
}
agent {
kubernetes {
inheritFrom 'ubuntu-2404'
yaml '''
apiVersion: v1
kind: Pod
spec:
containers:
- name: "jnlp"
resources:
limits:
memory: "8Gi"
cpu: "4000m"
requests:
memory: "6Gi"
cpu: "2000m"
'''.stripIndent()
}
}
tools {
jdk 'temurin-jdk21-latest'
maven 'apache-maven-latest'
}
environment {
CJE_ROOT = "${WORKSPACE}/cje-production"
SCRIPTS = "${WORKSPACE}/scripts"
AGG_DIR = "${CJE_ROOT}/gitCache/eclipse.platform.releng.aggregator"
TEMP_DIR = "${CJE_ROOT}/tmp"
logDir = "$CJE_ROOT/buildlogs"
PRODUCTS_DIR = "${AGG_DIR}/products"
SITES_DIR = "${AGG_DIR}/sites"
PLATFORM_REPO_DIR = "${SITES_DIR}/eclipse-platform-repository/target/repository"
DROP_DIR = "${CJE_ROOT}/siteDir/eclipse/downloads/drops4"
EQUINOX_DROP_DIR = "${CJE_ROOT}/siteDir/equinox/drops"
// Download server paths
EP_ROOT = '/home/data/httpd/download.eclipse.org'
EP_ECLIPSE_UPDATES = "${EP_ROOT}/eclipse/updates"
EP_ECLIPSE_DROPS = "${EP_ROOT}/eclipse/downloads/drops4"
EP_EQUINOX_DROPS = "${EP_ROOT}/equinox/drops"
// Tool configurations
MAVEN_OPTS = "-Xmx4G -Dmaven.repo.local=${TEMP_DIR}/maven-repo"
JDK_JAVA_OPTIONS = "-Djava.io.tmpdir=${TEMP_DIR}"
}
stages {
stage('Set up environment') {
steps {
script {
utilities = load 'JenkinsJobs/shared/utilities.groovy'
def job = utilities.matchPattern('Job name', "${JOB_BASE_NAME}", [ /(?<type>[A-Z])-build-(?<major>\d).(?<minor>\d+)/ ])
// Load build properties and configuration from the properties and configuration file
BUILD = readJSON(file: 'JenkinsJobs/buildConfigurations.json')[job.type]
if (BUILD == null) {
error "Unsupported build type: ${job.type}"
}
def int jobStart = currentBuild.startTimeInMillis.intdiv(1000)
BUILD_PROPERTIES.TIMESTAMP = sh(script: "TZ='America/New_York' date +%Y%m%d-%H%M --date='@${jobStart}'", returnStdout: true).trim()
BUILD_PROPERTIES.BUILD_TYPE = job.type
BUILD_PROPERTIES.BUILD_TYPE_NAME = BUILD.typeName
BUILD_PROPERTIES.BUILD_ID = "${BUILD_PROPERTIES.BUILD_TYPE}${BUILD_PROPERTIES.TIMESTAMP}"
BUILD_PROPERTIES += readProperties(file: "${CJE_ROOT}/buildproperties.txt", interpolate: true)
BUILD_PROPERTIES.TEST_CONFIGURATIONS_EXPECTED = BUILD.tests.collect{ c ->
"${testJobName(c)}_${c.os}.${c.ws}.${c.arch}_${c.javaVersion}"
}.join(',')
// Export build properties
BUILD_PROPERTIES.each{ key, value -> assignEnvVariable(key, value) }
assignEnvVariable('GIT_SUBMODULE_BRANCHES', BUILD.branches ? BUILD.branches.collect{ name, branch -> "${name}:${branch}" }.join(',') : '')
}
}
}
stage('Clone and tag Build Inputs') {
environment {
AGGREGATOR_LOCAL_BRANCH = "${scm.branches[0].name}"
AGGREGATOR_REPOSITORY_URL = "${scm.userRemoteConfigs[0].url}" // http(s) URL expected
}
steps {
dir("${AGG_DIR}") {
sh '''#!/bin/bash -xe
git config --global user.email 'releng-bot@eclipse.org'
git config --global user.name 'Eclipse Releng Bot'
# Clone this repo and all submodules into the 'AGG_DIR' directory
git clone --branch=${AGGREGATOR_LOCAL_BRANCH} --recurse-submodules --remote-submodules \
${AGGREGATOR_REPOSITORY_URL} .
if [ -n "${GIT_SUBMODULE_BRANCHES}" ]; then
for submodule in ${GIT_SUBMODULE_BRANCHES//,/ }; do
path=$(echo "$submodule" | cut -d: -f1)
branch=$(echo "$submodule" | cut -d: -f2)
pushd "${path}"
git checkout ${branch}
git pull
popd
done
fi
# Create 'Build input' commit (considering commits potentially submitted to the aggregator BRANCH in the meantime)
git checkout ${AGGREGATOR_LOCAL_BRANCH}
git pull
git commit --all --message="Build input for build $BUILD_ID" || echo 'No submodule changes'
'''
sshagent (['projects-storage.eclipse.org-bot-ssh']) {
// Try to find the last tag of the current build type that is available as a promoted build
// by checking the most recent 5 tags and seeing if an update site for it exists
sh '''#!/bin/bash -xe
updateSiteRootPath=${EP_ECLIPSE_UPDATES}/${STREAMMajor}.${STREAMMinor}-${BUILD_TYPE}-builds
lastTagList=$(git tag --list "${BUILD_TYPE}*" | tail -n5 | tac)
for lt in ${lastTagList}; do
if ssh genie.releng@projects-storage.eclipse.org test -d ${updateSiteRootPath}/${lt} ; then
echo "$lt" > "${WORKSPACE}/lastTag"
exit 0
fi
done
# if no build is promoted yet, then just fallback to the last tag of the current build type
git describe --tags --match "${BUILD_TYPE}*" --abbrev=0 > "${WORKSPACE}/lastTag"
'''
}
script {
assignEnvVariable('GIT_BASELINE_TAG', readFile("${WORKSPACE}/lastTag").trim())
// Check for changes and abort if nothing changed since the last build
def boolean isScheduledBuild = !currentBuild.getBuildCauses('hudson.triggers.TimerTrigger$TimerTriggerCause').isEmpty()
if (isScheduledBuild && sh(script: 'git diff ${GIT_BASELINE_TAG}..HEAD --name-only', returnStdout: true).trim().isEmpty()) {
emailext subject: "${RELEASE_VER} ${BUILD_TYPE}-Build: ${BUILD_ID} - Build skipped", body: """\
No changes have been made since the last successful ${BUILD_TYPE}-Build and therefore this scheduled build was skipped:
${BUILD_URL}console
""".stripIndent(), mimeType: 'text/plain',
to: "${BUILD.mailingList}", from: 'genie.releng@eclipse.org'
currentBuild.result = 'ABORTED'
error('Abort scheduled build due to no changes')
}
}
// Create git tags and push changes
sshagent (['github-bot-ssh']) {
sh '''#!/bin/bash -xe
function remoteURL {
git config remote.origin.url | sed --expression 's,https://github.com/,git@github.com:,'
}
export -f remoteURL
if [ "${BUILD_TYPE}" == "I" ]; then
git push --verbose $(remoteURL) ${AGGREGATOR_LOCAL_BRANCH}
fi
function tagAndPush {
git tag ${BUILD_ID} HEAD
git push --verbose $(remoteURL) tag ${BUILD_ID}
}
export -f tagAndPush
git submodule foreach 'tagAndPush'
tagAndPush
'''
}
// Git log creation
script {
def gitReposChanged = utilities.listChangedGitRepositoryURLs("${GIT_BASELINE_TAG}", "${BUILD_ID}")
assignEnvVariable('GIT_REPOS_CHANGED', gitReposChanged.join(','))
}
}
}
}
stage('Aggregator maven build') {
environment {
KEYRING = credentials('secret-subkeys-releng.asc')
MAVEN_GPG_PASSPHRASE = credentials('secret-subkeys-releng.asc-passphrase')
}
steps {
dir("${AGG_DIR}") {
sh '''#!/bin/bash -xe
mkdir -p ${TEMP_DIR}
mvn clean install -pl :eclipse-sdk-prereqs,:org.eclipse.jdt.core.compiler.batch \
-DlocalEcjVersion=99.99 \
-DcompilerBaselineMode=disable -DcompilerBaselineReplace=none
set -o pipefail
mkdir -p ${logDir}
mvn clean verify -DskipTests=true -Pbree-libs -Peclipse-sign \
-Dtycho.debug.artifactcomparator -Dtycho.localArtifacts=ignore \
-Dcbi.jarsigner.continueOnFail=true \
-Dtycho.pgp.signer=bc -Dtycho.pgp.signer.bc.secretKeys="${KEYRING}" \
-Djgit.dirtyWorkingTree=error \
-Dcbi-ecj-version=99.99 \
-DbuildType=${BUILD_TYPE} -DbuildId=${BUILD_ID} -DbuildTimestamp=${TIMESTAMP} \
-e -T 1C \
2>&1 | tee ${logDir}/mb220_buildSdkPatch.sh.log
# Capture the build log for the subsequent scan for comparator errors
'''
script {
def mavenProperties = readProperties(file: 'eclipse-platform-parent/target/mavenproperties.properties')
mavenProperties.each{ key, value -> assignEnvVariable(key, value) }
BUILD_PROPERTIES += mavenProperties
// Store now complete build-properties
writeFile(file: "${CJE_ROOT}/buildproperties.properties", text: BUILD_PROPERTIES.collect{ key, value -> "${key}=${value}"}.join('\n'))
}
}
}
}
stage('Check for comparator errors') {
tools {
jdk 'temurin-jdk25-latest'
}
steps {
sh '''#!/bin/bash -xe
# Gather maven properties
mkdir -p ${DROP_DIR}/$BUILD_ID
# Gather artifactcomparisons
pushd ${AGG_DIR}
comparatorlogsDir=${DROP_DIR}/${BUILD_ID}/buildlogs/comparatorlogs
mkdir -p $comparatorlogsDir
find . -regex .*target/artifactcomparison -type d -exec zip -r $comparatorlogsDir/artifactcomparisons.zip '{}' \\;
popd
# Verify comparatorlogs
#TODO: Generally try to avoid the need to capture the build log in a file/for teeing
cp ${logDir}/mb220_buildSdkPatch.sh.log ${DROP_DIR}/$BUILD_ID/buildlogs/
#TODO: when outputting comparator error logs, add the baseline repository in the metadata (even on non-failure?) so that it doesn't have to be set here explicitly
java \
-DbuildDirectory=${DROP_DIR}/$BUILD_ID \
-DcomparatorRepo=${COMPARATOR_BASELINE} \
${WORKSPACE}/scripts/releng/ComparatorSummaryExtractor.java
comparatorLogMinimumSize=350
comparatorLog=${comparatorlogsDir}/buildtimeComparatorUnanticipated.log.txt
logSize=$(stat --format='%s' ${comparatorLog})
if [[ ${logSize} -gt ${comparatorLogMinimumSize} ]]; then
echo -e "DEBUG: found logsize greater an minimum. preparing message using ${link}"
echo "- Comparator Errors Found" > comparatorErrorsSubject
else
echo -e "DEBUG: comparator logSize of $logSize was not greater than comparatorLogMinimumSize of ${comparatorLogMinimumSize}"
touch comparatorErrorsSubject
fi
'''
script { // Export subject to signal comparator errors, if any
assignEnvVariable('COMPARATOR_ERRORS_SUBJECT', readFile("${WORKSPACE}/comparatorErrorsSubject").trim())
}
}
}
stage('Promote results') {
parallel {
stage('Eclipse') {
stages {
stage('Gather Eclipse parts') {
tools {
jdk 'temurin-jdk25-latest'
}
steps {
dir("${DROP_DIR}/${BUILD_ID}") {
script {
utilities.copyStaticWebsiteFiles("${AGG_DIR}", 'eclipse/build')
}
}
sh '''#!/bin/bash -xe
cp $CJE_ROOT/buildproperties.* ${DROP_DIR}/${BUILD_ID}
mkdir -p ${DROP_DIR}/${BUILD_ID}/testresults/consolelogs
# Gather p2-repository
pushd ${SITES_DIR}/eclipse-platform-repository/target
cp eclipse-platform-repository.eclipse-repository-*.zip ${DROP_DIR}/${BUILD_ID}/repository-${BUILD_ID}.zip
popd
# Gather sdk product
for file in ${PRODUCTS_DIR}/eclipse-sdk/target/products/*; do
if [[ "$file" =~ /org.eclipse.sdk.ide-([^.]+).([^.]+).([^.]+).(.*)$ ]]; then
cp ${file} ${DROP_DIR}/${BUILD_ID}/eclipse-SDK-$BUILD_ID-${BASH_REMATCH[1]}-${BASH_REMATCH[2]}-${BASH_REMATCH[3]}.${BASH_REMATCH[4]}
fi
done
# Gather platform product
for file in ${PRODUCTS_DIR}/eclipse-platform/target/products/*; do
if [[ "$file" =~ /org.eclipse.platform.ide-([^.]+).([^.]+).([^.]+).(.*)$ ]]; then
cp ${file} ${DROP_DIR}/${BUILD_ID}/eclipse-platform-$BUILD_ID-${BASH_REMATCH[1]}-${BASH_REMATCH[2]}-${BASH_REMATCH[3]}.${BASH_REMATCH[4]}
fi
done
notarizeLogDir=$CJE_ROOT/notarizeLog
mkdir -p $notarizeLogDir
chmod +x ${CJE_ROOT}/scripts/notarizeMacApp.sh
pushd ${DROP_DIR}/${BUILD_ID}
for macProduct in *.dmg; do
(/bin/bash ${CJE_ROOT}/scripts/notarizeMacApp.sh ${macProduct} > $notarizeLogDir/${macProduct}.log 2>&1)&
sleep 18s
done
popd
# Gather swt zips
pushd ${AGG_DIR}/eclipse.platform.swt/binaries
cp */target/*.zip ${DROP_DIR}/${BUILD_ID}
popd
# Gather test zips
pushd ${SITES_DIR}/eclipse-junit-tests/target
cp eclipse-junit-tests-bundle.zip ${DROP_DIR}/${BUILD_ID}/eclipse-Automated-Tests-$BUILD_ID.zip
popd
# Slice repos
pushd ${PRODUCTS_DIR}/eclipse-platform/target
cp org.eclipse.platform.ide-*.zip ${DROP_DIR}/${BUILD_ID}/org.eclipse.platform-${BUILD_ID}.zip
popd
# Gather ECJ jars
pushd ${AGG_DIR}/eclipse.jdt.core/org.eclipse.jdt.core.compiler.batch/target
cp org.eclipse.jdt.core.compiler.batch-*-SNAPSHOT.jar ${DROP_DIR}/${BUILD_ID}/ecj-$BUILD_ID.jar
cp org.eclipse.jdt.core.compiler.batch-*-SNAPSHOT-sources.jar ${DROP_DIR}/${BUILD_ID}/ecjsrc-$BUILD_ID.jar
popd
# Gather buildnotes
pushd ${AGG_DIR}
buildnotesDir=${DROP_DIR}/${BUILD_ID}/buildnotes
mkdir -p $buildnotesDir
find . -name buildnotes_*.html -exec rsync '{}' $buildnotesDir \\;
popd
# Gather compilelogs
pushd ${AGG_DIR}
compilelogsDir=${DROP_DIR}/${BUILD_ID}/compilelogs
mkdir -p ${compilelogsDir}
for log in $(find . -name "compilelogs" -type d ); do
targetDir=$( dirname $log )
fullName=$(awk -F '[:;[:space:]]+' '/^Bundle-SymbolicName/ {name=$2} /^Bundle-Version/ {version=$2} END {print name "_" version}' $targetDir/MANIFEST.MF)
cp -r "${log}" "${compilelogsDir}/${fullName}/"
done
popd
# Generate repository reports
mvn tycho-eclipse:eclipse-run@generate-repo-report -f eclipse-platform-parent \
-Declipse-sdk-repo=file://${PLATFORM_REPO_DIR} \
-Declipserun.workArea=${TEMP_DIR}/repo-report \
-DreportRepoDir=${PLATFORM_REPO_DIR} \
-DreportOutputDir=${DROP_DIR}/${BUILD_ID}/buildlogs
# Generate API-tools reports
mkdir -p ${DROP_DIR}/${BUILD_ID}/apitools
# Collect .api_filters files
for filter in $(find ${AGG_DIR} -type f -path '*/.settings/.api_filters'); do
IFS='/' read -ra PATH_SEGMENTS <<< "${filter}"
pluginName="${PATH_SEGMENTS[-3]}"
target=${TEMP_DIR}/apifilters/${pluginName}
mkdir -p ${target}
cp ${filter} ${target}
done
baseline=${TEMP_DIR}/apitoolingreference/repository-${PREVIOUS_RELEASE_VER}.zip
mkdir -p $(dirname ${baseline})
curl -o ${baseline} https://download.eclipse.org/eclipse/downloads/drops4/${PREVIOUS_RELEASE_ID}/repository-${PREVIOUS_RELEASE_VER}.zip
mvn tycho-eclipse:eclipse-run@generate-api-report -f eclipse-platform-parent \
-Declipse-sdk-repo=file://${PLATFORM_REPO_DIR} \
-Declipserun.workArea=${TEMP_DIR}/apitoolings-logs \
-DgitRepoRoot=${AGG_DIR} \
-Dbaseline=${baseline} \
-Dcurrent_location=${PLATFORM_REPO_DIR} \
-Dreport=${DROP_DIR}/${BUILD_ID}/apitools \
-Dfilter_store=${TEMP_DIR}/apifilters \
# Wait for notarization to complete before checksums are generated.
wait
for f in $notarizeLogDir/*.log; do
echo $f
cat $f
done
# Publish Eclipse
java \
-DdropDirectory=${DROP_DIR}/${BUILD_ID} \
-DgitBaselineTag=${GIT_BASELINE_TAG} \
-DgitReposChanged=${GIT_REPOS_CHANGED} \
${SCRIPTS}/releng/BuildDropDataGenerator.java mainEclipse
java \
-DdropDirectory=${DROP_DIR}/${BUILD_ID} \
${SCRIPTS}/releng/CompilerSummaryGenerator.java
'''
script {
utilities.pgpSignFile("${DROP_DIR}/${BUILD_ID}/eclipse-${BUILD_ID}-checksums", 'eclipse')
}
}
}
stage('Promote Eclipse') {
steps {
sshagent(['projects-storage.eclipse.org-bot-ssh']) {
sh '''#!/bin/bash -xe
dropDir=${DROP_DIR}/${BUILD_ID}
if [ -n "${COMPARATOR_ERRORS_SUBJECT}" ]; then
echo "This build has been marked unstable due to <a href='buildlogs/comparatorlogs/buildtimeComparatorUnanticipated.log.txt'>unanticipated comparator errors</a>." > ${dropDir}/buildUnstable
fi
scp -r ${dropDir} genie.releng@projects-storage.eclipse.org:${EP_ECLIPSE_DROPS}/.
'''
}
build job: 'Releng/updateIndex', wait: false
}
}
}
}
stage('Equinox') {
when {
environment name: 'BUILD_TYPE', value: 'I'
}
stages {
stage('Gather Equinox parts') {
tools {
jdk 'temurin-jdk25-latest'
}
steps {
dir("${EQUINOX_DROP_DIR}/${BUILD_ID}") {
script {
utilities.copyStaticWebsiteFiles("${AGG_DIR}", 'equinox/build')
}
}
sh '''#!/bin/bash -xe
cp $CJE_ROOT/buildproperties.* ${EQUINOX_DROP_DIR}/${BUILD_ID}
# Gather Equinox Starter Kit
for file in ${PRODUCTS_DIR}/equinox-starterkit/target/products/*; do
if [[ "$file" =~ /org.eclipse.rt.osgistarterkit.product-([^.]+).([^.]+).([^.]+).(.*)$ ]]; then
cp ${file} ${EQUINOX_DROP_DIR}/${BUILD_ID}/EclipseRT-OSGi-StarterKit-$BUILD_ID-${BASH_REMATCH[1]}-${BASH_REMATCH[2]}-${BASH_REMATCH[3]}.${BASH_REMATCH[4]}
fi
done
notarizeLogDir=$CJE_ROOT/notarizeEqLog
mkdir -p $notarizeLogDir
chmod +x ${CJE_ROOT}/scripts/notarizeMacApp.sh
pushd ${EQUINOX_DROP_DIR}/${BUILD_ID}
(/bin/bash ${CJE_ROOT}/scripts/notarizeMacApp.sh EclipseRT-OSGi-StarterKit-$BUILD_ID-macosx-cocoa-x86_64.dmg > $notarizeLogDir/equinoxX64.log 2>&1)&
popd
# Gather Equinox SDK
pushd ${SITES_DIR}/equinox-sdk-repository/target
cp equinox-sdk-repository.eclipse-repository-*.zip ${EQUINOX_DROP_DIR}/${BUILD_ID}/equinox-SDK-${BUILD_ID}.zip
popd
pushd ${EQUINOX_DROP_DIR}/${BUILD_ID}
unzip -o -j equinox-SDK-$BUILD_ID.zip plugins/*.jar -x plugins/*.source_*
popd
# Wait for notarization to complete before checksums are generated.
wait
for f in $notarizeLogDir/*.log; do
echo $f
cat $f
done
# Build Equinox Launcher archives
pushd ${PRODUCTS_DIR}/equinox-launcher/target
for launcher in products/equinox-launcher/*/*/*; do
if [[ "${launcher}" =~ /equinox-launcher/([^/]+)/([^/]+)/([^/]+)$ ]]; then
os="${BASH_REMATCH[1]}"
if [[ ${os} == 'macosx' ]]; then installDir='Eclipse.app/Contents/Eclipse'; else installDir='eclipse'; fi
mkdir -p "${launcher}/${installDir}/binary/"
cp repository/binary/org.eclipse.equinox.executable_root.${BASH_REMATCH[2]}.${os}.${BASH_REMATCH[3]}_* "${launcher}/${installDir}/binary/"
archivePath="${EQUINOX_DROP_DIR}/${BUILD_ID}/launchers-${os}.${BASH_REMATCH[2]}.${BASH_REMATCH[3]}.${BUILD_ID}"
pushd "${launcher}/${installDir}"
if [[ ${os} == 'win32' ]]; then
zip -r "${archivePath}.zip" binary/ features/ plugins/
else
tar -czf "${archivePath}.tar.gz" binary/ features/ plugins/
fi
popd
fi
done
popd
java \
-DdropDirectory=${EQUINOX_DROP_DIR}/${BUILD_ID} \
${SCRIPTS}/releng/BuildDropDataGenerator.java mainEquinox
'''
script {
utilities.pgpSignFile("${EQUINOX_DROP_DIR}/${BUILD_ID}/equinox-${BUILD_ID}-checksums", 'equinox')
}
}
}
stage('Promote Equinox') {
steps {
sshagent(['projects-storage.eclipse.org-bot-ssh']) {
sh '''#!/bin/bash -xe
dropDir=${EQUINOX_DROP_DIR}/${BUILD_ID}
if [ -n "${COMPARATOR_ERRORS_SUBJECT}" ]; then
echo "This build has been marked unstable due to <a href='https://download.eclipse.org/eclipse/downloads/drops4/${BUILD_ID}/buildlogs/comparatorlogs/buildtimeComparatorUnanticipated.log.txt'>unanticipated comparator errors</a>." > ${dropDir}/buildUnstable
fi
scp -r ${dropDir} genie.releng@projects-storage.eclipse.org:${EP_EQUINOX_DROPS}/.
'''
}
}
}
}
}
stage('Promote Update Site') {
steps {
sshagent(['projects-storage.eclipse.org-bot-ssh']) {
sh '''#!/bin/bash -xe
repoPath=${EP_ECLIPSE_UPDATES}/${STREAMMajor}.${STREAMMinor}-${BUILD_TYPE}-builds/${BUILD_ID}
ssh genie.releng@projects-storage.eclipse.org mkdir -p ${repoPath}
scp -r ${PLATFORM_REPO_DIR}/. genie.releng@projects-storage.eclipse.org:${repoPath}/.
'''
}
script {
if ("${COMPARATOR_ERRORS_SUBJECT}" != '' && "${BUILD_TYPE}" == 'I') {
echo 'Skip adding unstable build to composite repository.'
return
}
build job: 'Releng/modifyP2CompositeRepository', wait: true, propagate: true, parameters: [
string(name: 'repositoryPath', value: "eclipse/updates/${RELEASE_VER}-${BUILD_TYPE}-builds"),
string(name: 'add', value: "${BUILD_ID}"),
string(name: 'sizeLimit', value: '3')
]
}
}
}
}
}
stage('Archive build logs') {
tools {
jdk 'temurin-jdk25-latest'
}
environment {
JENKINS_API_TOKEN = credentials('jenkins-api') // username:password
}
steps {
script {
// See https://github.com/jenkinsci/pipeline-stage-view-plugin/tree/master/rest-api#get-jobjob-namewfapiruns
def description = readJSON(text: sh(script: 'curl --fail ${BUILD_URL}/wfapi/describe --user "${JENKINS_API_TOKEN}"', returnStdout: true))
int stageIndex = 0
for (jobStage in description['stages']) {
if (jobStage.status != 'IN_PROGRESS') {
def prefix = 's' + String.format('%03d', stageIndex++) // prefix with index to establish stable order
def logFileName = "${DROP_DIR}/${BUILD_ID}/buildlogs/" + prefix + '_' + jobStage.name.replace(' ', '_').replace('Declarative:_', '') + '.log'
sh """
curl --fail --silent --output '${logFileName}' --user "\${JENKINS_API_TOKEN}" ${BUILD_URL}/stages/log?nodeId=${jobStage.id}
# Test (efficiently) if the file starts with the no-logs message and if yes, ensure it doesn't contain more other lines
if [ "\$(head --lines 1 '${logFileName}' | xargs)" == 'No logs found' ] && [ "\$(wc --lines < '${logFileName}')" -le 1 ]; then
rm -f "${logFileName}"
fi
"""
}
}
}
sshagent(['projects-storage.eclipse.org-bot-ssh']) {
sh '''#!/bin/bash -xe
java \
-DdropDirectory=${DROP_DIR}/${BUILD_ID} \
${SCRIPTS}/releng/BuildDropDataGenerator.java buildLogs
rsync -avzh ${DROP_DIR}/${BUILD_ID}/buildlogs/ genie.releng@projects-storage.eclipse.org:${EP_ECLIPSE_DROPS}/${BUILD_ID}/buildlogs/
'''
}
}
}
stage('Trigger tests') {
steps {
script {
for (c in BUILD.tests) {
build job: "${BUILD.testsFolder}/${testJobName(c)}", wait: false, parameters: [
string(name: 'buildId', value: "${BUILD_ID}"),
string(name: 'testAgent', value: "${c.agent}"),
]
}
}
build job: 'AutomatedTests/smokeTests', wait: false, parameters: [
string(name: 'buildId', value: "${BUILD_ID}")
]
}
}
stage('Trigger publication to Maven snapshots repo') {
when {
allOf {
environment name: 'BUILD_TYPE', value: 'I'
environment name: 'COMPARATOR_ERRORS_SUBJECT', value: ''
// On comparator-erros, skip the deployment of snapshot version to the 'eclipse-snapshots' maven repository to prevent that ECJ snapshot
// from being used in verification builds. Similar to how the p2-repository is not added to the I-build composite in that case.
}
}
steps {
build job: 'Releng/deployToMaven', wait: false, parameters: [
string(name: 'sourceRepository', value: "https://download.eclipse.org/eclipse/updates/${RELEASE_VER}-${BUILD_TYPE}-builds/${BUILD_ID}")
]
}
}
}
post {
always {
archiveArtifacts artifacts: 'cje-production/siteDir/**', excludes: 'cje-production/siteDir/eclipse/updates/**'
}
failure {
emailext subject: "${RELEASE_VER} ${BUILD_TYPE}-Build: ${BUILD_ID} - BUILD FAILED",
body: "Please go to ${BUILD_URL}console and check the build failure.", mimeType: 'text/plain',
to: "${BUILD.mailingList}", from:'genie.releng@eclipse.org'
}
success {
emailext subject: "${RELEASE_VER} ${BUILD_TYPE}-Build: ${BUILD_ID} ${COMPARATOR_ERRORS_SUBJECT}",
body: ("""\
Eclipse downloads:
https://download.eclipse.org/eclipse/downloads/drops4/${BUILD_ID}
Build logs and/or test results (eventually):
https://download.eclipse.org/eclipse/downloads/drops4/${BUILD_ID}/reports.html
""" + (env.COMPARATOR_ERRORS_SUBJECT == '' ? '' : """
Check unanticipated comparator messages:
https://download.eclipse.org/eclipse/downloads/drops4/${BUILD_ID}/buildlogs/comparatorlogs/buildtimeComparatorUnanticipated.log.txt
(If appropriate, affected projects can be touched using: ${JENKINS_URL}job/Releng/job/touchCompatorErrorProjects)
""") + """
Software site repository:
https://download.eclipse.org/eclipse/updates/${RELEASE_VER}-${BUILD_TYPE}-builds
Specific (simple) site repository:
https://download.eclipse.org/eclipse/updates/${RELEASE_VER}-${BUILD_TYPE}-builds/${BUILD_ID}
Equinox downloads:
https://download.eclipse.org/equinox/drops/${BUILD_ID}
""").stripIndent(), mimeType: 'text/plain',
to: "${BUILD.mailingList}", from:'genie.releng@eclipse.org'
}
}
}
@groovy.transform.Field
def utilities = null
@NonCPS
def assignEnvVariable(String name, String value) {
utilities.assignEnvVariable(name, value)
}
@NonCPS
def testJobName(Map<String, String> c) {
return "ep${BUILD_PROPERTIES.STREAMMajor}${BUILD_PROPERTIES.STREAMMinor}${BUILD_PROPERTIES.BUILD_TYPE}-unit-${c.os}-${c.arch}-java${c.javaVersion}"
}