11@groovy.transform.Field
22def BUILD = null
3+ @groovy.transform.Field
4+ def BUILD_PROPERTIES = [:]
35
46pipeline {
57 options {
@@ -59,35 +61,28 @@ pipeline {
5961
6062 def job = utilities.matchPattern('Job name', "${JOB_BASE_NAME}", [ /(?<type>[IY])-build-(?<major>\d).(?<minor>\d+)/ ])
6163 // Load build properties and configuration from the properties and configuration file
62- assignEnvVariable('BUILD_TYPE', job.type)
63- def configurations = readJSON(file: "${WORKSPACE}/JenkinsJobs/buildConfigurations.json")
64- BUILD = configurations["${BUILD_TYPE}"]
65- assignEnvVariable('BUILD_TYPE_NAME', BUILD.typeName)
66- assignEnvVariable('GIT_SUBMODULE_BRANCHES', BUILD.branches ? BUILD.branches.collect{ name, branch -> "${name}:${branch}" }.join(',') : '')
67- assignEnvVariable('TEST_NAME_PREFIX', "ep${job.major}${job.minor}${BUILD_TYPE}-unit")
68- assignEnvVariable('TEST_CONFIGURATIONS_EXPECTED', BUILD.tests.collect{ c ->
69- "${TEST_NAME_PREFIX}-${c.os}-${c.arch}-java${c.javaVersion}_${c.os}.${c.ws}.${c.arch}_${c.javaVersion}"
70- }.join(','))
71- }
72- dir("${CJE_ROOT}") {
73- sh '''#!/bin/bash -xe
74- chmod +x mbscripts/*
75- chmod +x $CJE_ROOT/scripts/notarizeMacApp.sh
76-
77- ./mbscripts/mb010_createEnvfiles.sh ${CJE_ROOT}/buildproperties.shsource 2>&1
78- '''
64+ BUILD = readJSON(file: 'JenkinsJobs/buildConfigurations.json')[job.type]
65+
66+ def int jobStart = currentBuild.startTimeInMillis.intdiv(1000)
67+ BUILD_PROPERTIES.TIMESTAMP = sh(script: "TZ='America/New_York' date +%Y%m%d-%H%M --date='@${jobStart}'", returnStdout: true)
68+ BUILD_PROPERTIES.BUILD_TYPE = job.type
69+ BUILD_PROPERTIES.BUILD_TYPE_NAME = BUILD.typeName
70+ BUILD_PROPERTIES.BUILD_ID = "${BUILD_PROPERTIES.BUILD_TYPE}${BUILD_PROPERTIES.TIMESTAMP}"
71+ BUILD_PROPERTIES += readProperties(file: "${CJE_ROOT}/buildproperties.txt", interpolate: true)
72+ BUILD_PROPERTIES.TEST_CONFIGURATIONS_EXPECTED = BUILD.tests.collect{ c ->
73+ "${testJobName(c)}_${c.os}.${c.ws}.${c.arch}_${c.javaVersion}"
74+ }.join(',')
75+
76+ // Export build properties
77+ BUILD_PROPERTIES.each{ key, value -> assignEnvVariable(key, value) }
7978 }
80- exportPropertiesAsEnvironmentVariables("${CJE_ROOT}/buildproperties.properties", [
81- 'BUILD_ID',
82- 'STREAM', 'RELEASE_VER',
83- 'PREVIOUS_RELEASE_ID', 'PREVIOUS_RELEASE_VER',
84- ])
8579 }
8680 }
8781 stage('Clone and tag Build Inputs') {
8882 environment {
8983 AGGREGATOR_LOCAL_BRANCH = "${scm.branches[0].name}"
9084 AGGREGATOR_REPOSITORY_URL = "${scm.userRemoteConfigs[0].url}" // http(s) URL expected
85+ GIT_SUBMODULE_BRANCHES = gitSubmoduleBranches()
9186 }
9287 steps {
9388 dir("${AGG_DIR}") {
@@ -119,7 +114,6 @@ pipeline {
119114 // Try to find the last tag of the current build type that is available as a promoted build
120115 // by checking the most recent 5 tags and seeing if an update site for it exists
121116 sh '''#!/bin/bash -xe
122- source $CJE_ROOT/buildproperties.shsource
123117 updateSiteRootPath=${EP_ECLIPSE_UPDATES}/${STREAMMajor}.${STREAMMinor}-${BUILD_TYPE}-builds
124118 lastTagList=$(git tag --list "${BUILD_TYPE}*" | tail -n5 | tac)
125119 for lt in ${lastTagList}; do
@@ -149,8 +143,6 @@ pipeline {
149143 // Create git tags and push changes
150144 sshagent (['github-bot-ssh']) {
151145 sh '''#!/bin/bash -xe
152- source $CJE_ROOT/buildproperties.shsource
153-
154146 function remoteURL {
155147 git config remote.origin.url | sed --expression 's,https://github.com/,git@github.com:,'
156148 }
@@ -183,7 +175,6 @@ pipeline {
183175 steps {
184176 dir("${AGG_DIR}") {
185177 sh '''#!/bin/bash -xe
186- source $CJE_ROOT/buildproperties.shsource
187178 mkdir -p ${TEMP_DIR}
188179
189180 mvn clean install -pl :eclipse-sdk-prereqs,:org.eclipse.jdt.core.compiler.batch \
@@ -204,6 +195,13 @@ pipeline {
204195 2>&1 | tee ${logDir}/mb220_buildSdkPatch.sh.log
205196 # Capture the build log for the subsequent scan for comparator errors
206197 '''
198+ script {
199+ def mavenProperties = readProperties(file: 'eclipse-platform-parent/target/mavenproperties.properties')
200+ mavenProperties.each{ key, value -> assignEnvVariable(key, value) }
201+ BUILD_PROPERTIES += mavenProperties
202+ // Store now complete build-properties
203+ writeFile(file: "${CJE_ROOT}/buildproperties.properties", text: BUILD_PROPERTIES.collect{ key, value -> "${key}=${value}"}.join('\n'))
204+ }
207205 }
208206 }
209207 }
@@ -213,13 +211,8 @@ pipeline {
213211 }
214212 steps {
215213 sh '''#!/bin/bash -xe
216- source $CJE_ROOT/scripts/common-functions.shsource
217- source $CJE_ROOT/buildproperties.shsource
218-
219214 # Gather maven properties
220215 mkdir -p ${DROP_DIR}/$BUILD_ID
221- cp ${AGG_DIR}/eclipse-platform-parent/target/mavenproperties.properties ${DROP_DIR}/$BUILD_ID/mavenproperties.properties
222- comparatorRepo=$(grep '^comparator.repo=' ${DROP_DIR}/${BUILD_ID}/mavenproperties.properties | cut -d'=' -f2-)
223216
224217 # Gather artifactcomparisons
225218 pushd ${AGG_DIR}
@@ -232,23 +225,26 @@ pipeline {
232225 #TODO: Generally try to avoid the need to capture the build log in a file/for teeing
233226 cp ${logDir}/mb220_buildSdkPatch.sh.log ${DROP_DIR}/$BUILD_ID/buildlogs/
234227
228+ #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
235229 java \
236230 -DbuildDirectory=${DROP_DIR}/$BUILD_ID \
237- -DcomparatorRepo=${comparatorRepo } \
231+ -DcomparatorRepo=${COMPARATOR_BASELINE } \
238232 ${WORKSPACE}/scripts/releng/ComparatorSummaryExtractor.java
239233
240234 comparatorLogMinimumSize=350
241235 comparatorLog=${comparatorlogsDir}/buildtimeComparatorUnanticipated.log.txt
242236 logSize=$(stat --format='%s' ${comparatorLog})
243237 if [[ ${logSize} -gt ${comparatorLogMinimumSize} ]]; then
244238 echo -e "DEBUG: found logsize greater an minimum. preparing message using ${link}"
245- fn-write-property COMPARATOR_ERRORS_SUBJECT "\\" - Comparator Errors Found\\""
239+ echo " - Comparator Errors Found" > comparatorErrorsSubject
246240 else
247241 echo -e "DEBUG: comparator logSize of $logSize was not greater than comparatorLogMinimumSize of ${comparatorLogMinimumSize}"
248- fn-write-property COMPARATOR_ERRORS_SUBJECT "\\"\\""
242+ touch comparatorErrorsSubject
249243 fi
250244 '''
251- exportPropertiesAsEnvironmentVariables("${CJE_ROOT}/buildproperties.properties", [ 'COMPARATOR_ERRORS_SUBJECT' ])
245+ script { // Export subject to signal comparator errors, if any
246+ assignEnvVariable('COMPARATOR_ERRORS_SUBJECT', readFile("${WORKSPACE}/comparatorErrorsSubject").trim())
247+ }
252248 }
253249 }
254250 stage('Promote results') {
@@ -267,7 +263,6 @@ pipeline {
267263 }
268264 sh '''#!/bin/bash -xe
269265 cp $CJE_ROOT/buildproperties.* ${DROP_DIR}/${BUILD_ID}
270- source $CJE_ROOT/buildproperties.shsource
271266
272267 mkdir -p ${DROP_DIR}/${BUILD_ID}/testresults/consolelogs
273268
@@ -303,6 +298,7 @@ pipeline {
303298
304299 notarizeLogDir=$CJE_ROOT/notarizeLog
305300 mkdir -p $notarizeLogDir
301+ chmod +x ${CJE_ROOT}/scripts/notarizeMacApp.sh
306302 pushd ${DROP_DIR}/${BUILD_ID}
307303 for macProduct in *.dmg; do
308304 (/bin/bash ${CJE_ROOT}/scripts/notarizeMacApp.sh ${macProduct} > $notarizeLogDir/${macProduct}.log 2>&1)&
@@ -419,7 +415,6 @@ pipeline {
419415 }
420416 sh '''#!/bin/bash -xe
421417 cp $CJE_ROOT/buildproperties.* ${EQUINOX_DROP_DIR}/${BUILD_ID}
422- source $CJE_ROOT/buildproperties.shsource
423418
424419 # Gather Equinox Starter Kit
425420 for file in ${PRODUCTS_DIR}/equinox-starterkit/target/products/*; do
@@ -430,6 +425,7 @@ pipeline {
430425
431426 notarizeLogDir=$CJE_ROOT/notarizeEqLog
432427 mkdir -p $notarizeLogDir
428+ chmod +x ${CJE_ROOT}/scripts/notarizeMacApp.sh
433429 pushd ${EQUINOX_DROP_DIR}/${BUILD_ID}
434430 (/bin/bash ${CJE_ROOT}/scripts/notarizeMacApp.sh EclipseRT-OSGi-StarterKit-$BUILD_ID-macosx-cocoa-x86_64.dmg > $notarizeLogDir/equinoxX64.log 2>&1)&
435431 popd
@@ -497,7 +493,6 @@ pipeline {
497493 steps {
498494 sshagent(['projects-storage.eclipse.org-bot-ssh']) {
499495 sh '''#!/bin/bash -xe
500- source $CJE_ROOT/buildproperties.shsource
501496 repoPath=${EP_ECLIPSE_UPDATES}/${STREAMMajor}.${STREAMMinor}-${BUILD_TYPE}-builds/${BUILD_ID}
502497 ssh genie.releng@projects-storage.eclipse.org mkdir -p ${repoPath}
503498 scp -r ${PLATFORM_REPO_DIR}/. genie.releng@projects-storage.eclipse.org:${repoPath}/.
@@ -555,7 +550,7 @@ pipeline {
555550 steps {
556551 script {
557552 for (c in BUILD.tests) {
558- build job: "${BUILD.testsFolder}/${TEST_NAME_PREFIX}-${c.os}-${c.arch}-java${c.javaVersion }", wait: false, parameters: [
553+ build job: "${BUILD.testsFolder}/${testJobName(c) }", wait: false, parameters: [
559554 string(name: 'buildId', value: "${BUILD_ID}"),
560555 string(name: 'testAgent', value: "${c.agent}"),
561556 ]
@@ -625,10 +620,12 @@ def assignEnvVariable(String name, String value) {
625620 utilities.assignEnvVariable(name, value)
626621}
627622
628- def exportPropertiesAsEnvironmentVariables(String propertiesFile, Collection<String> exportedVariables){
629- def properties = readProperties(file: propertiesFile, charset: 'UTF-8')
630- for (envVar in exportedVariables) {
631- def value = properties[envVar].trim()
632- assignEnvVariable(envVar, value.startsWith('"') && value.endsWith('"') ? value.substring(1, value.length() - 1) : value)
633- }
623+ @NonCPS
624+ def testJobName(Map<String, String> c) {
625+ return "ep${BUILD_PROPERTIES.STREAMMajor}${BUILD_PROPERTIES.STREAMMinor}${BUILD_PROPERTIES.BUILD_TYPE}-unit-${c.os}-${c.arch}-java${c.javaVersion}"
626+ }
627+
628+ @NonCPS
629+ def gitSubmoduleBranches() {
630+ return BUILD.branches ? BUILD.branches.collect{ name, branch -> "${name}:${branch}" }.join(',') : ''
634631}
0 commit comments