Skip to content

Commit 67a1b47

Browse files
committed
[I/Y-Build] Streamline environment variable computation and export
Replace common-functions.shsource and buildproperties.shsource and mb010_createEnvfiles.sh script. Remove quotes around values in 'buildproperties' files.
1 parent 8210d25 commit 67a1b47

File tree

17 files changed

+105
-263
lines changed

17 files changed

+105
-263
lines changed

JenkinsJobs/Builds/build.jenkinsfile

Lines changed: 42 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
@groovy.transform.Field
22
def BUILD = null
3+
@groovy.transform.Field
4+
def BUILD_PROPERTIES = [:]
35

46
pipeline {
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
}

JenkinsJobs/Builds/markBuild.jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,5 @@ pipeline {
7777
def readBuildProperty(String name) {
7878
def buildPropertiesURL = "https://download.eclipse.org/eclipse/downloads/drops4/${buildId}/buildproperties.properties"
7979
def buildProperties = readProperties(text: sh(script: "curl --fail ${buildPropertiesURL}", returnStdout: true))
80-
return buildProperties[name].replace('"','') // Remove surrounding quotes
80+
return buildProperties[name]
8181
}

JenkinsJobs/Cleanup/cleanupBuilds.jenkinsfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ pipeline {
4343
utilities = load "JenkinsJobs/shared/utilities.groovy"
4444
utilities.setDryRun(false)
4545
def buildProperties = readProperties(file: 'cje-production/buildproperties.txt')
46-
devVersionMajor = buildProperties.STREAMMajor.replace('"','').toInteger() // Remove surrounding quotes
47-
devVersionMinor = buildProperties.STREAMMinor.replace('"','').toInteger() // Remove surrounding quotes
48-
devVersionService = buildProperties.STREAMService.replace('"','').toInteger() // Remove surrounding quotes
46+
devVersionMajor = buildProperties.STREAMMajor.toInteger()
47+
devVersionMinor = buildProperties.STREAMMinor.toInteger()
48+
devVersionService = buildProperties.STREAMService.toInteger()
4949
}
5050
}
5151
}

JenkinsJobs/Releng/prepareNextDevCycle.jenkinsfile

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,12 @@ pipeline {
4747
assignEnvVariable('NEXT_RELEASE_VERSION_MINOR', nextVersion.minor)
4848

4949
echo "PREVIOUS_RELEASE_CANDIDATE_ID: ${PREVIOUS_RELEASE_CANDIDATE_ID}"
50-
def buildPropertiesTxt = sh(script: "curl --fail https://download.eclipse.org/eclipse/downloads/drops4/${PREVIOUS_RELEASE_CANDIDATE_ID}/buildproperties.txt", returnStdout: true)
51-
def buildProperties = readProperties(text: buildPropertiesTxt)
52-
assignEnvVariable('IS_JAVA_RELEASE_IMMINENT', !buildProperties.NEXT_JAVA_RELEASE_DATE.replace('"','').isEmpty()) // Remove surrounding quotes
50+
def buildProperties = utilities.loadBuildDropProperties("${PREVIOUS_RELEASE_CANDIDATE_ID}")
51+
assignEnvVariable('IS_JAVA_RELEASE_IMMINENT', !buildProperties.NEXT_JAVA_RELEASE_DATE.trim().isEmpty()) // Remove surrounding quotes
5352

5453
def previousRC = utilities.matchBuildIdentifier("${PREVIOUS_RELEASE_CANDIDATE_ID}", { iBuild ->
55-
iBuild.major = buildProperties.STREAMMajor.replace('"','') // Remove surrounding quotes
56-
iBuild.minor = buildProperties.STREAMMinor.replace('"','') // Remove surrounding quotes
54+
iBuild.major = buildProperties.STREAMMajor
55+
iBuild.minor = buildProperties.STREAMMinor
5756
assignEnvVariable('PREVIOUS_RELEASE_CANDIDATE_TAG', "${PREVIOUS_RELEASE_CANDIDATE_ID}")
5857
assignEnvVariable('PREVIOUS_RELEASE_CANDIDATE_GIT_TAG', "${PREVIOUS_RELEASE_CANDIDATE_ID}")
5958
}, { sBuild ->
@@ -153,11 +152,9 @@ pipeline {
153152
stage('Update build scripts') {
154153
steps {
155154
replaceAllInFile('cje-production/buildproperties.txt', [
156-
"RELEASE_VER=\".*\"" : "RELEASE_VER=\"${NEXT_RELEASE_VERSION}\"",
157-
"STREAM=\".*\"" : "STREAM=\"${NEXT_RELEASE_VERSION}.0\"",
158-
"STREAMMajor=\".*\"" : "STREAMMajor=\"${NEXT_RELEASE_VERSION_MAJOR}\"",
159-
"STREAMMinor=\".*\"" : "STREAMMinor=\"${NEXT_RELEASE_VERSION_MINOR}\"",
160-
"NEXT_JAVA_RELEASE_DATE=\".*\"" : "NEXT_JAVA_RELEASE_DATE=\"${NEXT_JAVA_RELEASE_DATE}\"",
155+
'STREAMMajor=.*' : "STREAMMajor=${NEXT_RELEASE_VERSION_MAJOR}",
156+
'STREAMMinor=.*' : "STREAMMinor=${NEXT_RELEASE_VERSION_MINOR}",
157+
'NEXT_JAVA_RELEASE_DATE=.*' : "NEXT_JAVA_RELEASE_DATE=${NEXT_JAVA_RELEASE_DATE}",
161158
])
162159
replaceInFile('products/eclipse-platform/platform.p2.inf', [
163160
"${PREVIOUS_RELEASE_VERSION} Release" : "${NEXT_RELEASE_VERSION} Release",
@@ -196,10 +193,10 @@ pipeline {
196193
"-DnewPrevious-release.baseline=https://download.eclipse.org/eclipse/updates/${PREVIOUS_RELEASE_VERSION}-I-builds/${PREVIOUS_RELEASE_CANDIDATE_I_BUILD}/"
197194
'''
198195
replaceAllInFile('cje-production/buildproperties.txt', [
199-
'PREVIOUS_RELEASE_VER=".*"' : "PREVIOUS_RELEASE_VER=\"${PREVIOUS_RELEASE_CANDIDATE_TAG}\"",
200-
'PREVIOUS_RELEASE_REPO_ID=".*"' : "PREVIOUS_RELEASE_REPO_ID=\"${PREVIOUS_RELEASE_VERSION}-I-builds\"",
201-
'BASEBUILD_ID=".*"' : "BASEBUILD_ID=\"${PREVIOUS_RELEASE_CANDIDATE_I_BUILD}\"",
202-
'PREVIOUS_RELEASE_ID=".*"' : "PREVIOUS_RELEASE_ID=\"${PREVIOUS_RELEASE_CANDIDATE_ID}\"",
196+
'PREVIOUS_RELEASE_VER=.*' : "PREVIOUS_RELEASE_VER=${PREVIOUS_RELEASE_CANDIDATE_TAG}",
197+
'PREVIOUS_RELEASE_REPO_ID=.*' : "PREVIOUS_RELEASE_REPO_ID=${PREVIOUS_RELEASE_VERSION}-I-builds",
198+
'BASEBUILD_ID=.*' : "BASEBUILD_ID=${PREVIOUS_RELEASE_CANDIDATE_I_BUILD}",
199+
'PREVIOUS_RELEASE_ID=.*' : "PREVIOUS_RELEASE_ID=${PREVIOUS_RELEASE_CANDIDATE_ID}",
203200
])
204201

205202
gitCommitAllExcludingSubmodules("Move previous version to ${PREVIOUS_RELEASE_CANDIDATE_TAG} in build scripts")
@@ -430,7 +427,7 @@ def githubAPI = null
430427

431428
@NonCPS
432429
def assignEnvVariable(String name, Object value) {
433-
utilities.assignEnvVariable(name, value)
430+
utilities.assignEnvVariable(name, value?.toString())
434431
}
435432

436433
@NonCPS

JenkinsJobs/Releng/promoteBuild.jenkinsfile

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,10 @@ pipeline {
7676
})
7777
assignEnvVariable('REPO_ID', "I${build.date}-${build.time}")
7878

79-
def buildPropertiesTxt = sh(script: "curl --fail https://download.eclipse.org/eclipse/downloads/drops4/${DROP_ID}/buildproperties.txt", returnStdout: true)
80-
def buildProperties = readProperties(text: buildPropertiesTxt)
81-
assignEnvVariable('BUILD_MAJOR', buildProperties.STREAMMajor.replace('"','')) // Remove surrounding quotes
82-
assignEnvVariable('BUILD_MINOR', buildProperties.STREAMMinor.replace('"','')) // Remove surrounding quotes
83-
assignEnvVariable('BUILD_SERVICE', buildProperties.STREAMService.replace('"','')) // Remove surrounding quotes
79+
def buildProperties = utilities.loadBuildDropProperties("${DROP_ID}")
80+
assignEnvVariable('BUILD_MAJOR', buildProperties.STREAMMajor)
81+
assignEnvVariable('BUILD_MINOR', buildProperties.STREAMMinor)
82+
assignEnvVariable('BUILD_SERVICE', buildProperties.STREAMService)
8483

8584
if ("${CHECKPOINT}" ==~ /M\d+([a-z])?/ || "${CHECKPOINT}" ==~ /RC\d+([a-z])?/) { // milestone or RC promotion
8685
assignEnvVariable('DL_TYPE', 'S')
@@ -231,10 +230,10 @@ pipeline {
231230
-DnewPrevious-release.baseline="${RELEASE_P2_REPOSITORY}"
232231
'''
233232
utilities.replaceAllInFile('cje-production/buildproperties.txt', [
234-
'PREVIOUS_RELEASE_VER=".*?"' : "PREVIOUS_RELEASE_VER=\"${BUILD_MAJOR}.${BUILD_MINOR}\"",
235-
'PREVIOUS_RELEASE_REPO_ID=".*?"' : "PREVIOUS_RELEASE_REPO_ID=\"${BUILD_MAJOR}.${BUILD_MINOR}\"",
236-
'BASEBUILD_ID=".*?"' : "BASEBUILD_ID=\"${DL_DROP_ID}\"",
237-
'PREVIOUS_RELEASE_ID=".*?"' : "PREVIOUS_RELEASE_ID=\"${DL_DROP_ID}\"",
233+
'PREVIOUS_RELEASE_VER=.*' : "PREVIOUS_RELEASE_VER=${BUILD_MAJOR}.${BUILD_MINOR}",
234+
'PREVIOUS_RELEASE_REPO_ID=.*' : "PREVIOUS_RELEASE_REPO_ID=${BUILD_MAJOR}.${BUILD_MINOR}",
235+
'BASEBUILD_ID=.*' : "BASEBUILD_ID=${DL_DROP_ID}",
236+
'PREVIOUS_RELEASE_ID=.*' : "PREVIOUS_RELEASE_ID=${DL_DROP_ID}",
238237
])
239238
utilities.modifyJSON('JenkinsJobs/buildConfigurations.json') { builds ->
240239
// Remove old I/Y-build jobs for this release

JenkinsJobs/Releng/publishPromotedBuild.jenkinsfile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,8 @@ pipeline {
5757
} else {
5858
error "RELEASE_TYPE, ${RELEASE_TYPE}, did not match any expected pattern."
5959
}
60-
61-
def eclipseParentPOM = sh(script: "curl --fail https://raw.githubusercontent.com/eclipse-platform/eclipse.platform.releng.aggregator/refs/tags/${buildId}/eclipse-platform-parent/pom.xml", returnStdout: true)
62-
def yearMatcher = eclipseParentPOM =~ /<releaseYear>(?<year>\d+)<\/releaseYear>/
63-
def monthMatcher = eclipseParentPOM =~ /<releaseMonth>(?<month>\d+)<\/releaseMonth>/
64-
if (!yearMatcher.find() || !monthMatcher.find()) {
65-
error "Eclipse Parent POM does not contain releaseYear or releaseMonth"
66-
}
67-
assignEnvVariable('TRAIN_NAME', yearMatcher.group('year') + '-' + monthMatcher.group('month'))
60+
def buildProperties = utilities.loadBuildDropProperties(buildId)
61+
assignEnvVariable('TRAIN_NAME', "${buildProperties.RELEASE_YEAR}-${buildProperties.RELEASE_MONTH}")
6862
if (!env.TRAIN_NAME) {
6963
error "TRAIN_NAME is empty."
7064
}

JenkinsJobs/seedJob.jenkinsfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ pipeline {
4040

4141
def buildConfigurations = readJSON(file: 'buildConfigurations.json')
4242
buildConfigurations.each{ buildType, buildConfig ->
43-
buildConfig.streams.each{ STREAM, streamConfig ->
44-
def (MAJOR, MINOR) = STREAM.split('\\.')
45-
pipelineJobDefinitions["${buildConfig.folder}/${buildType}-build-${STREAM}"] = [scriptPath: buildJob.scriptPath, branch: streamConfig.branch,
43+
buildConfig.streams.each{ streamName, streamConfig ->
44+
def (MAJOR, MINOR) = streamName.split('\\.')
45+
pipelineJobDefinitions["${buildConfig.folder}/${buildType}-build-${streamName}"] = [scriptPath: buildJob.scriptPath, branch: streamConfig.branch,
4646
description: "Eclipse SDK ${buildConfig.typeName} builds", disabled: streamConfig.disabled, cronTrigger: '''\
4747
TZ=America/Toronto
4848
# Format: Minute Hour Day Month Day-of-week (1-7)

JenkinsJobs/shared/utilities.groovy

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ def stableBuildGitTag(CharSequence dropID) {
4242
}
4343

4444
@NonCPS
45-
def assignEnvVariable(String name, Object value) {
46-
env[name] = value?.toString()?.trim()
45+
def assignEnvVariable(String name, String value) {
46+
value = value?.trim()
47+
env[name] = value
4748
println("${name}=${value}")
4849
}
4950

@@ -208,14 +209,19 @@ private void gitPush(String refSpec, boolean force) {
208209

209210
// --- remote file system operations ---
210211

212+
def Map<String, String> loadBuildDropProperties(String buildId) {
213+
def properties = sh(script: "curl --fail https://download.eclipse.org/eclipse/downloads/drops4/${buildId}/buildproperties.properties", returnStdout: true)
214+
return readProperties(text: properties)
215+
}
216+
211217
def List<String> listBuildDropDirectoriesOnRemote(String remoteDirectory, String dropNamePattern = "*", int major = 0, int minor = 0, int service = 0) {
212218
def versionFilter = major == 0 ? '' :"""\
213-
| xargs grep -l 'STREAMMinor=\\"${minor}\\"' \
214-
| xargs grep -l 'STREAMMajor=\\"${major}\\"' \
215-
| xargs grep -l 'STREAMService=\\"${service}\\"' \
219+
| xargs grep -l 'STREAMMinor=\\"?${minor}\\"?' \
220+
| xargs grep -l 'STREAMMajor=\\"?${major}\\"?' \
221+
| xargs grep -l 'STREAMService=\\"?${service}\\"?' \
216222
""".trim()
217223
def result = sh(script: """ssh genie.releng@projects-storage.eclipse.org "cd ${remoteDirectory} && \
218-
find -maxdepth 2 -type f -path './${dropNamePattern}/buildproperties.txt' \
224+
find -maxdepth 2 -type f -path './${dropNamePattern}/buildproperties.properties' \
219225
${versionFilter} | xargs dirname | sort -u"
220226
""", returnStdout: true).trim()
221227
return result.isEmpty() ? [] : result.split('\\s+').collect{ d -> d.startsWith('./') ? d.substring(2) : d }

0 commit comments

Comments
 (0)