Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 36 additions & 44 deletions JenkinsJobs/Builds/build.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@groovy.transform.Field
def BUILD = null
@groovy.transform.Field
def BUILD_PROPERTIES = [:]

pipeline {
options {
Expand Down Expand Up @@ -59,29 +61,22 @@ pipeline {

def job = utilities.matchPattern('Job name', "${JOB_BASE_NAME}", [ /(?<type>[IY])-build-(?<major>\d).(?<minor>\d+)/ ])
// Load build properties and configuration from the properties and configuration file
assignEnvVariable('BUILD_TYPE', job.type)
def configurations = readJSON(file: "${WORKSPACE}/JenkinsJobs/buildConfigurations.json")
BUILD = configurations["${BUILD_TYPE}"]
assignEnvVariable('BUILD_TYPE_NAME', BUILD.typeName)
BUILD = readJSON(file: 'JenkinsJobs/buildConfigurations.json')[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)
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(',') : '')
assignEnvVariable('TEST_NAME_PREFIX', "ep${job.major}${job.minor}${BUILD_TYPE}-unit")
assignEnvVariable('TEST_CONFIGURATIONS_EXPECTED', BUILD.tests.collect{ c ->
"${TEST_NAME_PREFIX}-${c.os}-${c.arch}-java${c.javaVersion}_${c.os}.${c.ws}.${c.arch}_${c.javaVersion}"
}.join(','))
}
dir("${CJE_ROOT}") {
sh '''#!/bin/bash -xe
chmod +x mbscripts/*
chmod +x $CJE_ROOT/scripts/notarizeMacApp.sh

./mbscripts/mb010_createEnvfiles.sh ${CJE_ROOT}/buildproperties.shsource 2>&1
'''
}
exportPropertiesAsEnvironmentVariables("${CJE_ROOT}/buildproperties.properties", [
'BUILD_ID',
'STREAM', 'RELEASE_VER',
'PREVIOUS_RELEASE_ID', 'PREVIOUS_RELEASE_VER',
])
}
}
stage('Clone and tag Build Inputs') {
Expand Down Expand Up @@ -119,7 +114,6 @@ pipeline {
// 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
source $CJE_ROOT/buildproperties.shsource
updateSiteRootPath=${EP_ECLIPSE_UPDATES}/${STREAMMajor}.${STREAMMinor}-${BUILD_TYPE}-builds
lastTagList=$(git tag --list "${BUILD_TYPE}*" | tail -n5 | tac)
for lt in ${lastTagList}; do
Expand Down Expand Up @@ -149,8 +143,6 @@ pipeline {
// Create git tags and push changes
sshagent (['github-bot-ssh']) {
sh '''#!/bin/bash -xe
source $CJE_ROOT/buildproperties.shsource

function remoteURL {
git config remote.origin.url | sed --expression 's,https://github.com/,git@github.com:,'
}
Expand Down Expand Up @@ -183,7 +175,6 @@ pipeline {
steps {
dir("${AGG_DIR}") {
sh '''#!/bin/bash -xe
source $CJE_ROOT/buildproperties.shsource
mkdir -p ${TEMP_DIR}

mvn clean install -pl :eclipse-sdk-prereqs,:org.eclipse.jdt.core.compiler.batch \
Expand All @@ -204,6 +195,13 @@ pipeline {
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'))
}
}
}
}
Expand All @@ -213,13 +211,8 @@ pipeline {
}
steps {
sh '''#!/bin/bash -xe
source $CJE_ROOT/scripts/common-functions.shsource
source $CJE_ROOT/buildproperties.shsource

# Gather maven properties
mkdir -p ${DROP_DIR}/$BUILD_ID
cp ${AGG_DIR}/eclipse-platform-parent/target/mavenproperties.properties ${DROP_DIR}/$BUILD_ID/mavenproperties.properties
comparatorRepo=$(grep '^comparator.repo=' ${DROP_DIR}/${BUILD_ID}/mavenproperties.properties | cut -d'=' -f2-)

# Gather artifactcomparisons
pushd ${AGG_DIR}
Expand All @@ -232,23 +225,26 @@ pipeline {
#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=${comparatorRepo} \
-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}"
fn-write-property COMPARATOR_ERRORS_SUBJECT "\\"- Comparator Errors Found\\""
echo "- Comparator Errors Found" > comparatorErrorsSubject
else
echo -e "DEBUG: comparator logSize of $logSize was not greater than comparatorLogMinimumSize of ${comparatorLogMinimumSize}"
fn-write-property COMPARATOR_ERRORS_SUBJECT "\\"\\""
touch comparatorErrorsSubject
fi
'''
exportPropertiesAsEnvironmentVariables("${CJE_ROOT}/buildproperties.properties", [ 'COMPARATOR_ERRORS_SUBJECT' ])
script { // Export subject to signal comparator errors, if any
assignEnvVariable('COMPARATOR_ERRORS_SUBJECT', readFile("${WORKSPACE}/comparatorErrorsSubject").trim())
}
}
}
stage('Promote results') {
Expand All @@ -267,7 +263,6 @@ pipeline {
}
sh '''#!/bin/bash -xe
cp $CJE_ROOT/buildproperties.* ${DROP_DIR}/${BUILD_ID}
source $CJE_ROOT/buildproperties.shsource

mkdir -p ${DROP_DIR}/${BUILD_ID}/testresults/consolelogs

Expand Down Expand Up @@ -303,6 +298,7 @@ pipeline {

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)&
Expand Down Expand Up @@ -419,7 +415,6 @@ pipeline {
}
sh '''#!/bin/bash -xe
cp $CJE_ROOT/buildproperties.* ${EQUINOX_DROP_DIR}/${BUILD_ID}
source $CJE_ROOT/buildproperties.shsource

# Gather Equinox Starter Kit
for file in ${PRODUCTS_DIR}/equinox-starterkit/target/products/*; do
Expand All @@ -430,6 +425,7 @@ pipeline {

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
Expand Down Expand Up @@ -497,7 +493,6 @@ pipeline {
steps {
sshagent(['projects-storage.eclipse.org-bot-ssh']) {
sh '''#!/bin/bash -xe
source $CJE_ROOT/buildproperties.shsource
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}/.
Expand Down Expand Up @@ -555,7 +550,7 @@ pipeline {
steps {
script {
for (c in BUILD.tests) {
build job: "${BUILD.testsFolder}/${TEST_NAME_PREFIX}-${c.os}-${c.arch}-java${c.javaVersion}", wait: false, parameters: [
build job: "${BUILD.testsFolder}/${testJobName(c)}", wait: false, parameters: [
string(name: 'buildId', value: "${BUILD_ID}"),
string(name: 'testAgent', value: "${c.agent}"),
]
Expand Down Expand Up @@ -625,10 +620,7 @@ def assignEnvVariable(String name, String value) {
utilities.assignEnvVariable(name, value)
}

def exportPropertiesAsEnvironmentVariables(String propertiesFile, Collection<String> exportedVariables){
def properties = readProperties(file: propertiesFile, charset: 'UTF-8')
for (envVar in exportedVariables) {
def value = properties[envVar].trim()
assignEnvVariable(envVar, value.startsWith('"') && value.endsWith('"') ? value.substring(1, value.length() - 1) : 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}"
}
2 changes: 1 addition & 1 deletion JenkinsJobs/Builds/markBuild.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,5 @@ pipeline {
def readBuildProperty(String name) {
def buildPropertiesURL = "https://download.eclipse.org/eclipse/downloads/drops4/${buildId}/buildproperties.properties"
def buildProperties = readProperties(text: sh(script: "curl --fail ${buildPropertiesURL}", returnStdout: true))
return buildProperties[name].replace('"','') // Remove surrounding quotes
return buildProperties[name]
}
6 changes: 3 additions & 3 deletions JenkinsJobs/Cleanup/cleanupBuilds.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ pipeline {
utilities = load "JenkinsJobs/shared/utilities.groovy"
utilities.setDryRun(false)
def buildProperties = readProperties(file: 'cje-production/buildproperties.txt')
devVersionMajor = buildProperties.STREAMMajor.replace('"','').toInteger() // Remove surrounding quotes
devVersionMinor = buildProperties.STREAMMinor.replace('"','').toInteger() // Remove surrounding quotes
devVersionService = buildProperties.STREAMService.replace('"','').toInteger() // Remove surrounding quotes
devVersionMajor = buildProperties.STREAMMajor.toInteger()
devVersionMinor = buildProperties.STREAMMinor.toInteger()
devVersionService = buildProperties.STREAMService.toInteger()
}
}
}
Expand Down
27 changes: 12 additions & 15 deletions JenkinsJobs/Releng/prepareNextDevCycle.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,12 @@ pipeline {
assignEnvVariable('NEXT_RELEASE_VERSION_MINOR', nextVersion.minor)

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

def previousRC = utilities.matchBuildIdentifier("${PREVIOUS_RELEASE_CANDIDATE_ID}", { iBuild ->
iBuild.major = buildProperties.STREAMMajor.replace('"','') // Remove surrounding quotes
iBuild.minor = buildProperties.STREAMMinor.replace('"','') // Remove surrounding quotes
iBuild.major = buildProperties.STREAMMajor
iBuild.minor = buildProperties.STREAMMinor
assignEnvVariable('PREVIOUS_RELEASE_CANDIDATE_TAG', "${PREVIOUS_RELEASE_CANDIDATE_ID}")
assignEnvVariable('PREVIOUS_RELEASE_CANDIDATE_GIT_TAG', "${PREVIOUS_RELEASE_CANDIDATE_ID}")
}, { sBuild ->
Expand Down Expand Up @@ -153,11 +152,9 @@ pipeline {
stage('Update build scripts') {
steps {
replaceAllInFile('cje-production/buildproperties.txt', [
"RELEASE_VER=\".*\"" : "RELEASE_VER=\"${NEXT_RELEASE_VERSION}\"",
"STREAM=\".*\"" : "STREAM=\"${NEXT_RELEASE_VERSION}.0\"",
"STREAMMajor=\".*\"" : "STREAMMajor=\"${NEXT_RELEASE_VERSION_MAJOR}\"",
"STREAMMinor=\".*\"" : "STREAMMinor=\"${NEXT_RELEASE_VERSION_MINOR}\"",
"NEXT_JAVA_RELEASE_DATE=\".*\"" : "NEXT_JAVA_RELEASE_DATE=\"${NEXT_JAVA_RELEASE_DATE}\"",
'STREAMMajor=.*' : "STREAMMajor=${NEXT_RELEASE_VERSION_MAJOR}",
'STREAMMinor=.*' : "STREAMMinor=${NEXT_RELEASE_VERSION_MINOR}",
'NEXT_JAVA_RELEASE_DATE=.*' : "NEXT_JAVA_RELEASE_DATE=${NEXT_JAVA_RELEASE_DATE}",
])
replaceInFile('products/eclipse-platform/platform.p2.inf', [
"${PREVIOUS_RELEASE_VERSION} Release" : "${NEXT_RELEASE_VERSION} Release",
Expand Down Expand Up @@ -196,10 +193,10 @@ pipeline {
"-DnewPrevious-release.baseline=https://download.eclipse.org/eclipse/updates/${PREVIOUS_RELEASE_VERSION}-I-builds/${PREVIOUS_RELEASE_CANDIDATE_I_BUILD}/"
'''
replaceAllInFile('cje-production/buildproperties.txt', [
'PREVIOUS_RELEASE_VER=".*"' : "PREVIOUS_RELEASE_VER=\"${PREVIOUS_RELEASE_CANDIDATE_TAG}\"",
'PREVIOUS_RELEASE_REPO_ID=".*"' : "PREVIOUS_RELEASE_REPO_ID=\"${PREVIOUS_RELEASE_VERSION}-I-builds\"",
'BASEBUILD_ID=".*"' : "BASEBUILD_ID=\"${PREVIOUS_RELEASE_CANDIDATE_I_BUILD}\"",
'PREVIOUS_RELEASE_ID=".*"' : "PREVIOUS_RELEASE_ID=\"${PREVIOUS_RELEASE_CANDIDATE_ID}\"",
'PREVIOUS_RELEASE_VER=.*' : "PREVIOUS_RELEASE_VER=${PREVIOUS_RELEASE_CANDIDATE_TAG}",
'PREVIOUS_RELEASE_REPO_ID=.*' : "PREVIOUS_RELEASE_REPO_ID=${PREVIOUS_RELEASE_VERSION}-I-builds",
'BASEBUILD_ID=.*' : "BASEBUILD_ID=${PREVIOUS_RELEASE_CANDIDATE_I_BUILD}",
'PREVIOUS_RELEASE_ID=.*' : "PREVIOUS_RELEASE_ID=${PREVIOUS_RELEASE_CANDIDATE_ID}",
])

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

@NonCPS
def assignEnvVariable(String name, Object value) {
utilities.assignEnvVariable(name, value)
utilities.assignEnvVariable(name, value?.toString())
}

@NonCPS
Expand Down
17 changes: 8 additions & 9 deletions JenkinsJobs/Releng/promoteBuild.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,10 @@ pipeline {
})
assignEnvVariable('REPO_ID', "I${build.date}-${build.time}")

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

if ("${CHECKPOINT}" ==~ /M\d+([a-z])?/ || "${CHECKPOINT}" ==~ /RC\d+([a-z])?/) { // milestone or RC promotion
assignEnvVariable('DL_TYPE', 'S')
Expand Down Expand Up @@ -231,10 +230,10 @@ pipeline {
-DnewPrevious-release.baseline="${RELEASE_P2_REPOSITORY}"
'''
utilities.replaceAllInFile('cje-production/buildproperties.txt', [
'PREVIOUS_RELEASE_VER=".*?"' : "PREVIOUS_RELEASE_VER=\"${BUILD_MAJOR}.${BUILD_MINOR}\"",
'PREVIOUS_RELEASE_REPO_ID=".*?"' : "PREVIOUS_RELEASE_REPO_ID=\"${BUILD_MAJOR}.${BUILD_MINOR}\"",
'BASEBUILD_ID=".*?"' : "BASEBUILD_ID=\"${DL_DROP_ID}\"",
'PREVIOUS_RELEASE_ID=".*?"' : "PREVIOUS_RELEASE_ID=\"${DL_DROP_ID}\"",
'PREVIOUS_RELEASE_VER=.*' : "PREVIOUS_RELEASE_VER=${BUILD_MAJOR}.${BUILD_MINOR}",
'PREVIOUS_RELEASE_REPO_ID=.*' : "PREVIOUS_RELEASE_REPO_ID=${BUILD_MAJOR}.${BUILD_MINOR}",
'BASEBUILD_ID=.*' : "BASEBUILD_ID=${DL_DROP_ID}",
'PREVIOUS_RELEASE_ID=.*' : "PREVIOUS_RELEASE_ID=${DL_DROP_ID}",
])
utilities.modifyJSON('JenkinsJobs/buildConfigurations.json') { builds ->
// Remove old I/Y-build jobs for this release
Expand Down
10 changes: 2 additions & 8 deletions JenkinsJobs/Releng/publishPromotedBuild.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,8 @@ pipeline {
} else {
error "RELEASE_TYPE, ${RELEASE_TYPE}, did not match any expected pattern."
}

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)
def yearMatcher = eclipseParentPOM =~ /<releaseYear>(?<year>\d+)<\/releaseYear>/
def monthMatcher = eclipseParentPOM =~ /<releaseMonth>(?<month>\d+)<\/releaseMonth>/
if (!yearMatcher.find() || !monthMatcher.find()) {
error "Eclipse Parent POM does not contain releaseYear or releaseMonth"
}
assignEnvVariable('TRAIN_NAME', yearMatcher.group('year') + '-' + monthMatcher.group('month'))
def buildProperties = utilities.loadBuildDropProperties(buildId)
assignEnvVariable('TRAIN_NAME', "${buildProperties.RELEASE_YEAR}-${buildProperties.RELEASE_MONTH}")
if (!env.TRAIN_NAME) {
error "TRAIN_NAME is empty."
}
Expand Down
6 changes: 3 additions & 3 deletions JenkinsJobs/seedJob.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ pipeline {

def buildConfigurations = readJSON(file: 'buildConfigurations.json')
buildConfigurations.each{ buildType, buildConfig ->
buildConfig.streams.each{ STREAM, streamConfig ->
def (MAJOR, MINOR) = STREAM.split('\\.')
pipelineJobDefinitions["${buildConfig.folder}/${buildType}-build-${STREAM}"] = [scriptPath: buildJob.scriptPath, branch: streamConfig.branch,
buildConfig.streams.each{ streamName, streamConfig ->
def (MAJOR, MINOR) = streamName.split('\\.')
pipelineJobDefinitions["${buildConfig.folder}/${buildType}-build-${streamName}"] = [scriptPath: buildJob.scriptPath, branch: streamConfig.branch,
description: "Eclipse SDK ${buildConfig.typeName} builds", disabled: streamConfig.disabled, cronTrigger: '''\
TZ=America/Toronto
# Format: Minute Hour Day Month Day-of-week (1-7)
Expand Down
18 changes: 12 additions & 6 deletions JenkinsJobs/shared/utilities.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ def stableBuildGitTag(CharSequence dropID) {
}

@NonCPS
def assignEnvVariable(String name, Object value) {
env[name] = value?.toString()?.trim()
def assignEnvVariable(String name, String value) {
value = value?.trim()
env[name] = value
println("${name}=${value}")
}

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

// --- remote file system operations ---

def Map<String, String> loadBuildDropProperties(String buildId) {
def properties = sh(script: "curl --fail https://download.eclipse.org/eclipse/downloads/drops4/${buildId}/buildproperties.properties", returnStdout: true)
return readProperties(text: properties)
}

def List<String> listBuildDropDirectoriesOnRemote(String remoteDirectory, String dropNamePattern = "*", int major = 0, int minor = 0, int service = 0) {
def versionFilter = major == 0 ? '' :"""\
| xargs grep -l 'STREAMMinor=\\"${minor}\\"' \
| xargs grep -l 'STREAMMajor=\\"${major}\\"' \
| xargs grep -l 'STREAMService=\\"${service}\\"' \
| xargs grep -l 'STREAMMinor *= *\\"\\?${minor}\\"\\?\$' \
| xargs grep -l 'STREAMMajor *= *\\"\\?${major}\\"\\?\$' \
| xargs grep -l 'STREAMService *= *\\"\\?${service}\\"\\?\$' \
""".trim()
def result = sh(script: """ssh genie.releng@projects-storage.eclipse.org "cd ${remoteDirectory} && \
find -maxdepth 2 -type f -path './${dropNamePattern}/buildproperties.txt' \
find -maxdepth 2 -type f -path './${dropNamePattern}/buildproperties.properties' \
${versionFilter} | xargs dirname | sort -u"
""", returnStdout: true).trim()
return result.isEmpty() ? [] : result.split('\\s+').collect{ d -> d.startsWith('./') ? d.substring(2) : d }
Expand Down
Loading
Loading