Skip to content

Commit 5aef6ff

Browse files
committed
[RelEng] Enhance parameter processing in build promotion job
- Remove those parameters that can be derived from others. - Move creation of 'mailtemplate.txt' file to Jenkins pipeline. - Drop creation of unused 'checklist.txt' file. - Drop consideration of 'M'-DROP_IDs, which are not produced anymore.
1 parent 2179a85 commit 5aef6ff

File tree

4 files changed

+132
-270
lines changed

4 files changed

+132
-270
lines changed

JenkinsJobs/Releng/FOLDER.groovy

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,6 @@ It must match the name of the build on the build machine.
112112
stringParam('CHECKPOINT', null, 'M1, M3, RC1, RC2, RC3 etc (blank for final releases).')
113113
stringParam('SIGNOFF_BUG', null, 'The issue that was used to "signoff" the checkpoint. If there are no unit test failures, this can be left blank. Otherwise a link is added to test page explaining that "failing unit tests have been investigated".')
114114
stringParam('TRAIN_NAME', null, 'The name of the release stream, typically yyyy-mm. For example: 2022-09')
115-
stringParam('STREAM', null, 'Needs to be all three files of primary version for the release, such as 4.7.1 or 4.8.0.')
116-
stringParam('DL_TYPE', null, "This is the build type we are promoting TO. I-builds promote to 'S' until 'R'.")
117-
stringParam('TAG', null, ''' For passing to the tagEclipseRelease job.
118-
R is used for release builds. For example: R4_25
119-
S is used for milestones and includes the milestone version. For example: S4_25_0_RC2
120-
''')
121115
}
122116
definition {
123117
cpsScm {

JenkinsJobs/Releng/promoteBuild.jenkinsfile

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,122 @@ pipeline {
88
agent {
99
label 'basic'
1010
}
11+
environment {
12+
HIDE_SITE = 'true'
13+
// Download Server locations (would very seldom change)
14+
BUILD_ROOT = '/home/data/httpd/download.eclipse.org'
15+
EP_ECLIPSE_ROOT = "${BUILD_ROOT}/eclipse"
16+
EP_EQUINOX_ROOT = "${BUILD_ROOT}/equinox"
17+
}
1118
stages {
19+
stage('Process input') {
20+
steps {
21+
script {
22+
env.DROP_ID = readParameter('DROP_ID')
23+
if (!"${DROP_ID}") {
24+
error("Parameter 'DROP_ID' is not specified")
25+
}
26+
env.CHECKPOINT = readParameter('CHECKPOINT')
27+
env.SIGNOFF_BUG = readParameter('SIGNOFF_BUG')
28+
env.TRAIN_NAME = readParameter('TRAIN_NAME')
29+
if (!"${TRAIN_NAME}") {
30+
error("Parameter 'TRAIN_NAME' is not specified")
31+
}
32+
def idMatcher = null
33+
if ((idMatcher = env.DROP_ID =~ /(?<type>I)(?<date>\d{8})-(?<time>\d{4})/).matches()) {
34+
assignEnvVariable('BUILD_LABEL', "${DROP_ID}")
35+
} else if ((idMatcher = env.DROP_ID =~ /(?<type>S)-(?<major>\d+)\.(?<minor>\d+)(?<service>\.\d+)?((M|RC)\d+[a-z]?)?-(?<date>\d{8})(?<time>\d{4})/).matches()) {
36+
assignEnvVariable('BUILD_LABEL', idMatcher.group('major') + '.' + idMatcher.group('minor') + (idMatcher.group('service') ?: ''))
37+
if ("${CHECKPOINT}") {
38+
error "Stable build DROP_ID=${DROP_ID} may only be promoted to release CHECKPOINT, which therefore must be empty: ${CHECKPOINT}"
39+
}
40+
} else {
41+
error "DROP_ID, ${DROP_ID}, did not match any expected pattern."
42+
}
43+
assignEnvVariable('BUILD_TYPE', idMatcher.group('type'))
44+
assignEnvVariable('REPO_BUILD_TYPE', 'I')
45+
assignEnvVariable('BUILD_TIMESTAMP', idMatcher.group('date') + idMatcher.group('time'))
46+
assignEnvVariable('REPO_ID', "I${idMatcher.group('date')}-${idMatcher.group('time')}")
47+
idMatcher = null // release matcher as it's not serializable
48+
49+
assignEnvVariable('BUILD_LABEL_EQ', "${BUILD_LABEL}")
50+
assignEnvVariable('DROP_ID_EQ', "${DROP_ID}")
51+
52+
sh 'curl -o buildproperties.shsource --fail https://download.eclipse.org/eclipse/downloads/drops4/${DROP_ID}/buildproperties.shsource'
53+
def STREAM = sh(returnStdout: true, script: 'source ./buildproperties.shsource && echo ${STREAM}').trim()
54+
def versionMatcher = STREAM =~ /(?<major>\d+)\.(?<minor>\d+).(?<service>\d+)/
55+
if (!versionMatcher.matches()) {
56+
error "STREAM must contain major, minor, and service versions, such as '4.37.0', but found: ${STREAM}"
57+
}
58+
assignEnvVariable('BUILD_MAJOR', versionMatcher.group('major'))
59+
assignEnvVariable('BUILD_MINOR', versionMatcher.group('minor'))
60+
assignEnvVariable('BUILD_SERVICE', versionMatcher.group('service'))
61+
versionMatcher = null // release matcher as it's not serializable
62+
63+
if ("${CHECKPOINT}" ==~ /M\d+([a-z])?/ || "${CHECKPOINT}" ==~ /RC\d+([a-z])?/) { // milestone or RC promotion
64+
assignEnvVariable('DL_TYPE', 'S')
65+
// REPO_SITE_SEGMENT variale not used in this case
66+
} else if(!"${CHECKPOINT}") { // release promotion
67+
assignEnvVariable('DL_TYPE', 'R')
68+
assignEnvVariable('REPO_SITE_SEGMENT', "${BUILD_MAJOR}.${BUILD_MINOR}")
69+
} else {
70+
error "CHECKPOINT, ${CHECKPOINT}, did not match any expected pattern."
71+
}
72+
assignEnvVariable('NEWS_ID', "${BUILD_MAJOR}.${BUILD_MINOR}")
73+
74+
assignEnvVariable('DL_LABEL', "${BUILD_SERVICE}" == '0' // For initial releases, do not include service in label
75+
? "${BUILD_MAJOR}.${BUILD_MINOR}${CHECKPOINT}"
76+
: "${BUILD_MAJOR}.${BUILD_MINOR}.${BUILD_SERVICE}${CHECKPOINT}"
77+
)
78+
assignEnvVariable('DL_LABEL_EQ', "${DL_LABEL}")
79+
80+
// This is DL_DROP_ID for Eclipse. The one for equinox has DL_LABEL_EQ in middle.
81+
assignEnvVariable('DL_DROP_ID', "${DL_TYPE}-${DL_LABEL}-${BUILD_TIMESTAMP}")
82+
assignEnvVariable('DL_DROP_ID_EQ', "${DL_TYPE}-${DL_LABEL_EQ}-${BUILD_TIMESTAMP}")
83+
84+
if (!env.SIGNOFF_BUG) {
85+
echo '''\
86+
[WARNING] SIGNOFF_BUG was not defined. That is valid if no Unit Tests failures but otherwise should be defined.
87+
Can be added by hand to buildproperties.php in drop site, if in fact there were errors, and simply forgot to specify.
88+
'''.stripIndent()
89+
}
90+
91+
def serviceVersionSegment = (env.CHECKPOINT || env.BUILD_SERVICE != '0') ? ('_' + env.BUILD_SERVICE) : ''
92+
assignEnvVariable('TAG', "${DL_TYPE}${BUILD_MAJOR}_${BUILD_MINOR}${serviceVersionSegment}${env.CHECKPOINT ? ('_' + env.CHECKPOINT) : ''}")
93+
}
94+
}
95+
}
1296
stage('Rename and Promote') {
97+
environment {
98+
BUILDMACHINE_BASE_DL = "${EP_ECLIPSE_ROOT}/downloads/drops4"
99+
BUILDMACHINE_BASE_EQ = "${EP_EQUINOX_ROOT}/drops"
100+
BUILD_REPO_ORIGINAL = "${BUILD_MAJOR}.${BUILD_MINOR}-${REPO_BUILD_TYPE}-builds"
101+
BUILDMACHINE_BASE_SITE = "${EP_ECLIPSE_ROOT}/updates/${BUILD_REPO_ORIGINAL}"
102+
// Eclipse and Equinox drop Site (final segment)
103+
ECLIPSE_DL_DROP_DIR_SEGMENT = "${DL_TYPE}-${DL_LABEL}-${BUILD_TIMESTAMP}"
104+
EQUINOX_DL_DROP_DIR_SEGMENT = "${DL_TYPE}-${DL_LABEL_EQ}-${BUILD_TIMESTAMP}"
105+
}
13106
steps {
107+
writeFile(file: "${WORKSPACE}/stage2output${TRAIN_NAME}${CHECKPOINT}/mailtemplate.txt", text: """\
108+
We are pleased to announce that ${TRAIN_NAME} ${CHECKPOINT} is available for download and updates.
109+
110+
Eclipse downloads:
111+
https://download.eclipse.org/eclipse/downloads/drops4/${ECLIPSE_DL_DROP_DIR_SEGMENT}/
112+
113+
New and Noteworthy:
114+
https://www.eclipse.org/eclipse/news/${NEWS_ID}/
115+
116+
Update existing (non-production) installs:
117+
https://download.eclipse.org/eclipse/updates/${DL_TYPE == 'R' ? REPO_SITE_SEGMENT : BUILD_REPO_ORIGINAL}/
118+
119+
Specific repository good for building against:
120+
https://download.eclipse.org/eclipse/updates/${DL_TYPE == 'R' ? (REPO_SITE_SEGMENT + '/' + ECLIPSE_DL_DROP_DIR_SEGMENT) : (BUILD_REPO_ORIGINAL + '/' + DROP_ID)}/
121+
122+
Equinox specific downloads:
123+
https://download.eclipse.org/equinox/drops/${EQUINOX_DL_DROP_DIR_SEGMENT}/
124+
125+
Thank you to everyone who made this checkpoint possible.
126+
""".stripIndent())
14127
sshagent(['projects-storage.eclipse.org-bot-ssh']) {
15128
sh '''#!/bin/bash -x
16129
curl -o promoteSites.sh https://download.eclipse.org/eclipse/relengScripts/cje-production/promotion/promoteSites.sh
@@ -32,3 +145,19 @@ pipeline {
32145
}
33146
}
34147
}
148+
149+
@NonCPS
150+
def assignEnvVariable(String name, String value) {
151+
env."${name}" = value
152+
println("${name}=${value}")
153+
}
154+
155+
@NonCPS
156+
def readParameter(String name) {
157+
//TODO: let jenkins trim the parameters
158+
def value = (params[name] ?: '').trim()
159+
if (value) {
160+
println("${name}: ${value}")
161+
}
162+
return value
163+
}

RELEASE.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@
4040
- CHECKPOINT: M1 etc (blank for final releases)
4141
- SIGNOFF_BUG: Needs to be updated to sign-off issue (numeric part only)
4242
- TRAIN_NAME: Whenever the current GA release is planned for (formatted 4 digit year - 2 digit month, i.e `2022-06`)
43-
- STREAM: 4.24.0 etc
44-
- DL_TYPE: S is used to promote I-builds.
45-
- TAG: Parameter should match stream version, i.e `S4_30_0_RC1` etc
4643
- After the build find and open the mail template [artifact](https://ci.eclipse.org/releng/job/Releng/job/promoteBuild/lastSuccessfulBuild/artifact/) and have it ready.
4744
- This should automatically run [tag Eclipse release](https://ci.eclipse.org/releng/job/Releng/job/tagEclipseRelease/) to tag the source code.
4845
* Contribute to SimRel

0 commit comments

Comments
 (0)