11@groovy.transform.Field
22def BUILD = null
3+ @groovy.transform.Field
4+ def BUILD_PROPERTIES = null
35
46pipeline {
57 options {
@@ -36,11 +38,13 @@ pipeline {
3638 CJE_ROOT = "${WORKSPACE}/cje-production"
3739 SCRIPTS = "${WORKSPACE}/scripts"
3840 AGG_DIR = "${CJE_ROOT}/gitCache/eclipse.platform.releng.aggregator"
41+ TMP_DIR = 'tmp'
3942 logDir = "$CJE_ROOT/buildlogs"
4043
4144 PRODUCTS_DIR = "${AGG_DIR}/products"
4245 SITES_DIR = "${AGG_DIR}/sites"
4346 PLATFORM_REPO_DIR = "${SITES_DIR}/eclipse-platform-repository/target/repository"
47+ ECLIPSE_BUILDER_DIR = "${AGG_DIR}/eclipse.platform.releng.tychoeclipsebuilder"
4448
4549 DROP_DIR = "${CJE_ROOT}/siteDir/eclipse/downloads/drops4"
4650 EQUINOX_DROP_DIR = "${CJE_ROOT}/siteDir/equinox/drops"
@@ -58,29 +62,24 @@ pipeline {
5862
5963 def job = utilities.matchPattern('Job name', "${JOB_BASE_NAME}", [ /(?<type>[IY])-build-(?<major>\d).(?<minor>\d+)/ ])
6064 // Load build properties and configuration from the properties and configuration file
61- assignEnvVariable('BUILD_TYPE', job.type)
62- def configurations = readJSON(file: "${WORKSPACE}/JenkinsJobs/buildConfigurations.json")
63- BUILD = configurations["${BUILD_TYPE}"]
64- assignEnvVariable('BUILD_TYPE_NAME', BUILD.typeName)
65+ def int epochSeconds = currentBuild.startTimeInMillis.intdiv(1000)
66+ def TIMESTAMP = sh(script: """TZ="America/New_York" date +%Y%m%d-%H%M --date='@${epochSeconds}'""", returnStdout: true)
67+ BUILD = readJSON(file: 'JenkinsJobs/buildConfigurations.json')["${job.type}"]
68+ BUILD_PROPERTIES = [
69+ TIMESTAMP: TIMESTAMP,
70+ BUILD_TYPE: job.type,
71+ BUILD_TYPE_NAME: BUILD.typeName,
72+ BUILD_ID: "${job.type}${TIMESTAMP}",
73+ ]
74+ BUILD_PROPERTIES += readProperties(file: "${CJE_ROOT}/buildproperties.txt")
75+ BUILD_PROPERTIES.TEST_CONFIGURATIONS_EXPECTED = BUILD.tests.collect{ c ->
76+ "${testJobName(c)}_${c.os}.${c.ws}.${c.arch}_${c.javaVersion}"
77+ }.join(',')
78+
79+ // Export build properties
80+ BUILD_PROPERTIES.each{ key, value -> assignEnvVariable(key, value) }
6581 assignEnvVariable('GIT_SUBMODULE_BRANCHES', BUILD.branches ? BUILD.branches.collect{ name, branch -> "${name}:${branch}" }.join(',') : '')
66- assignEnvVariable('TEST_NAME_PREFIX', "ep${job.major}${job.minor}${BUILD_TYPE}-unit")
67- assignEnvVariable('TEST_CONFIGURATIONS_EXPECTED', BUILD.tests.collect{ c ->
68- "${TEST_NAME_PREFIX}-${c.os}-${c.arch}-java${c.javaVersion}_${c.os}.${c.ws}.${c.arch}_${c.javaVersion}"
69- }.join(','))
7082 }
71- dir("${CJE_ROOT}") {
72- sh '''#!/bin/bash -xe
73- chmod +x mbscripts/*
74- chmod +x $CJE_ROOT/scripts/notarizeMacApp.sh
75-
76- ./mbscripts/mb010_createEnvfiles.sh ${CJE_ROOT}/buildproperties.shsource 2>&1
77- '''
78- }
79- exportPropertiesAsEnvironmentVariables("${CJE_ROOT}/buildproperties.properties", [
80- 'BUILD_ID',
81- 'STREAM', 'RELEASE_VER',
82- 'PREVIOUS_RELEASE_ID', 'PREVIOUS_RELEASE_VER',
83- ])
8483 }
8584 }
8685 stage('Clone and tag Build Inputs') {
@@ -118,7 +117,6 @@ pipeline {
118117 // Try to find the last tag of the current build type that is available as a promoted build
119118 // by checking the most recent 5 tags and seeing if an update site for it exists
120119 sh '''#!/bin/bash -xe
121- source $CJE_ROOT/buildproperties.shsource
122120 updateSiteRootPath=${EP_ECLIPSE_UPDATES}/${STREAMMajor}.${STREAMMinor}-${BUILD_TYPE}-builds
123121 lastTagList=$(git tag --list "${BUILD_TYPE}*" | tail -n5 | tac)
124122 for lt in ${lastTagList}; do
@@ -148,8 +146,6 @@ pipeline {
148146 // Create git tags and push changes
149147 sshagent (['github-bot-ssh']) {
150148 sh '''#!/bin/bash -xe
151- source $CJE_ROOT/buildproperties.shsource
152-
153149 function remoteURL {
154150 git config remote.origin.url | sed --expression 's,https://github.com/,git@github.com:,'
155151 }
@@ -181,8 +177,8 @@ pipeline {
181177 def exe = utilities.installDownloadableTool('eclipse', eclipsePlatformLatestRelease) + '/eclipse'
182178 assignEnvVariable('BASE_BUILDER_ECLIPSE_EXE', "${exe} -nosplash --launcher.suppressErrors")
183179 sh '''
184- source $CJE_ROOT/buildproperties.shsource
185180 mkdir -p $CJE_ROOT/$TMP_DIR
181+ #TODO: How to treat old releases of p2-analyzers on maintanance branches?
186182 $BASE_BUILDER_ECLIPSE_EXE \
187183 -debug -consolelog -data $CJE_ROOT/$TMP_DIR/workspace-toolsinstall \
188184 -application org.eclipse.equinox.p2.director \
@@ -202,8 +198,6 @@ pipeline {
202198 steps {
203199 dir("${AGG_DIR}") {
204200 sh '''#!/bin/bash -xe
205- source $CJE_ROOT/buildproperties.shsource
206-
207201 mvn clean install -pl :eclipse-sdk-prereqs,:org.eclipse.jdt.core.compiler.batch \
208202 -Dmaven.repo.local=${LOCAL_REPO} -DlocalEcjVersion=99.99 \
209203 -DcompilerBaselineMode=disable -DcompilerBaselineReplace=none
@@ -223,6 +217,13 @@ pipeline {
223217 2>&1 | tee ${logDir}/mb220_buildSdkPatch.sh.log
224218 # Capture the build log for the subsequent scan for comparator errors
225219 '''
220+ script {
221+ def mavenProperties = readProperties(file: 'eclipse-platform-parent/target/mavenproperties.properties')
222+ mavenProperties.each{ key, value -> assignEnvVariable(key, value) }
223+ BUILD_PROPERTIES += mavenProperties
224+ // Store complete build-properties
225+ writeFile(file: "${CJE_ROOT}/buildproperties.properties", text: BUILD_PROPERTIES.collect{ key, value -> "${key}=${value}"}.join('\n'))
226+ }
226227 }
227228 }
228229 }
@@ -232,13 +233,8 @@ pipeline {
232233 }
233234 steps {
234235 sh '''#!/bin/bash -xe
235- source $CJE_ROOT/scripts/common-functions.shsource
236- source $CJE_ROOT/buildproperties.shsource
237-
238236 # Gather maven properties
239237 mkdir -p ${DROP_DIR}/$BUILD_ID
240- cp ${AGG_DIR}/eclipse-platform-parent/target/mavenproperties.properties ${DROP_DIR}/$BUILD_ID/mavenproperties.properties
241- comparatorRepo=$(grep '^comparator.repo=' ${DROP_DIR}/${BUILD_ID}/mavenproperties.properties | cut -d'=' -f2-)
242238
243239 # Gather artifactcomparisons
244240 pushd ${AGG_DIR}
@@ -251,9 +247,10 @@ pipeline {
251247 #TODO: Generally try to avoid the need to capture the build log in a file/for teeing
252248 cp ${logDir}/mb220_buildSdkPatch.sh.log ${DROP_DIR}/$BUILD_ID/buildlogs/
253249
250+ #TODO: when outputting comparator error logs, add the baseline repository in the metadata (even on non-failure?)
254251 java \
255252 -DbuildDirectory=${DROP_DIR}/$BUILD_ID \
256- -DcomparatorRepo=${comparatorRepo } \
253+ -DcomparatorRepo=${COMPARATOR_BASELINE } \
257254 -Djava.io.tmpdir=$CJE_ROOT/$TMP_DIR \
258255 ${WORKSPACE}/scripts/releng/ComparatorSummaryExtractor.java
259256
@@ -262,13 +259,15 @@ pipeline {
262259 logSize=$(stat --format='%s' ${comparatorLog})
263260 if [[ ${logSize} -gt ${comparatorLogMinimumSize} ]]; then
264261 echo -e "DEBUG: found logsize greater an minimum. preparing message using ${link}"
265- fn-write-property COMPARATOR_ERRORS_SUBJECT "\\" - Comparator Errors Found\\""
262+ echo " - Comparator Errors Found" > comparatorErrorsSubject
266263 else
267264 echo -e "DEBUG: comparator logSize of $logSize was not greater than comparatorLogMinimumSize of ${comparatorLogMinimumSize}"
268- fn-write-property COMPARATOR_ERRORS_SUBJECT "\\"\\""
265+ touch comparatorErrorsSubject
269266 fi
270267 '''
271- exportPropertiesAsEnvironmentVariables("${CJE_ROOT}/buildproperties.properties", [ 'COMPARATOR_ERRORS_SUBJECT' ])
268+ script { // Export subject to signal comparator errors, if any
269+ assignEnvVariable('COMPARATOR_ERRORS_SUBJECT', readFile("${WORKSPACE}/comparatorErrorsSubject").trim())
270+ }
272271 }
273272 }
274273 stage('Promote results') {
@@ -287,7 +286,6 @@ pipeline {
287286 }
288287 sh '''#!/bin/bash -xe
289288 cp $CJE_ROOT/buildproperties.* ${DROP_DIR}/${BUILD_ID}
290- source $CJE_ROOT/buildproperties.shsource
291289
292290 mkdir -p ${DROP_DIR}/${BUILD_ID}/testresults/consolelogs
293291
@@ -323,6 +321,7 @@ pipeline {
323321
324322 notarizeLogDir=$CJE_ROOT/notarizeLog
325323 mkdir -p $notarizeLogDir
324+ chmod +x ${CJE_ROOT}/scripts/notarizeMacApp.sh
326325 pushd ${DROP_DIR}/${BUILD_ID}
327326 for macProduct in *.dmg; do
328327 (/bin/bash ${CJE_ROOT}/scripts/notarizeMacApp.sh ${macProduct} > $notarizeLogDir/${macProduct}.log 2>&1)&
@@ -388,7 +387,7 @@ pipeline {
388387 -DbuildId=$BUILD_ID \
389388 -DbuildLabel=$BUILD_ID \
390389 -DbuildWorkingArea=${AGG_DIR} \
391- -DpreviousBaseURL=https://$DOWNLOAD_HOST /eclipse/downloads/drops4/$PREVIOUS_RELEASE_ID/eclipse-SDK-$PREVIOUS_RELEASE_VER-win32-x86_64.zip \
390+ -DpreviousBaseURL=https://download.eclipse.org /eclipse/downloads/drops4/$PREVIOUS_RELEASE_ID/eclipse-SDK-$PREVIOUS_RELEASE_VER-win32-x86_64.zip \
392391 -DpreviousBaselineName=Eclipse-SDK-$PREVIOUS_RELEASE_VER \
393392 -DpreviousBaselineFilename=eclipse-SDK-$PREVIOUS_RELEASE_VER-win32-x86_64.zip \
394393 -Djava.io.tmpdir=$CJE_ROOT/$TMP_DIR \
@@ -449,7 +448,6 @@ pipeline {
449448 }
450449 sh '''#!/bin/bash -xe
451450 cp $CJE_ROOT/buildproperties.* ${EQUINOX_DROP_DIR}/${BUILD_ID}
452- source $CJE_ROOT/buildproperties.shsource
453451
454452 # Gather Equinox Starter Kit
455453 for file in ${PRODUCTS_DIR}/equinox-starterkit/target/products/*; do
@@ -460,6 +458,7 @@ pipeline {
460458
461459 notarizeLogDir=$CJE_ROOT/notarizeEqLog
462460 mkdir -p $notarizeLogDir
461+ chmod +x ${CJE_ROOT}/scripts/notarizeMacApp.sh
463462 pushd ${EQUINOX_DROP_DIR}/${BUILD_ID}
464463 (/bin/bash ${CJE_ROOT}/scripts/notarizeMacApp.sh EclipseRT-OSGi-StarterKit-$BUILD_ID-macosx-cocoa-x86_64.dmg > $notarizeLogDir/equinoxX64.log 2>&1)&
465464 popd
@@ -522,7 +521,6 @@ pipeline {
522521 steps {
523522 sshagent(['projects-storage.eclipse.org-bot-ssh']) {
524523 sh '''#!/bin/bash -xe
525- source $CJE_ROOT/buildproperties.shsource
526524 repoPath=${EP_ECLIPSE_UPDATES}/${STREAMMajor}.${STREAMMinor}-${BUILD_TYPE}-builds/${BUILD_ID}
527525 ssh genie.releng@projects-storage.eclipse.org mkdir -p ${repoPath}
528526 scp -r ${PLATFORM_REPO_DIR}/. genie.releng@projects-storage.eclipse.org:${repoPath}/.
@@ -580,7 +578,7 @@ pipeline {
580578 steps {
581579 script {
582580 for (c in BUILD.tests) {
583- build job: "${BUILD.testsFolder}/${TEST_NAME_PREFIX}-${c.os}-${c.arch}-java${c.javaVersion }", wait: false, parameters: [
581+ build job: "${BUILD.testsFolder}/${testJobName(c) }", wait: false, parameters: [
584582 string(name: 'buildId', value: "${BUILD_ID}"),
585583 string(name: 'testAgent', value: "${c.agent}"),
586584 ]
@@ -650,10 +648,7 @@ def assignEnvVariable(String name, String value) {
650648 utilities.assignEnvVariable(name, value)
651649}
652650
653- def exportPropertiesAsEnvironmentVariables(String propertiesFile, Collection<String> exportedVariables){
654- def properties = readProperties(file: propertiesFile, charset: 'UTF-8')
655- for (envVar in exportedVariables) {
656- def value = properties[envVar].trim()
657- assignEnvVariable(envVar, value.startsWith('"') && value.endsWith('"') ? value.substring(1, value.length() - 1) : value)
658- }
651+ @NonCPS
652+ def testJobName(Map<String, String> c) {
653+ return "ep${BUILD_PROPERTIES.STREAMMajor}${BUILD_PROPERTIES.STREAMMinor}${BUILD_PROPERTIES.BUILD_TYPE}-unit-${c.os}-${c.arch}-java${c.javaVersion}"
659654}
0 commit comments