Skip to content

Commit e870a00

Browse files
committed
[Build] Enhance parameter processing in build promotion job
Don't consider 'M'-DROP_IDs anymore?????
1 parent eeeaf1f commit e870a00

File tree

4 files changed

+185
-291
lines changed

4 files changed

+185
-291
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: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,158 @@ pipeline {
99
label 'basic'
1010
}
1111
stages {
12+
stage('Process input') {
13+
steps {
14+
script {
15+
env.DROP_ID = readParameter('DROP_ID')
16+
env.CHECKPOINT = readParameter('CHECKPOINT', true)
17+
env.SIGNOFF_BUG = readParameter('SIGNOFF_BUG', true)
18+
env.TRAIN_NAME = readParameter('TRAIN_NAME')
19+
20+
def idMatcher = null
21+
if ((idMatcher = env.DROP_ID =~ /(?<type>I)(?<date>\d{8})-(?<time>\d{4})/).matches()) {
22+
assignEnvVariable('BUILD_LABEL', "${DROP_ID}")
23+
} 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()) {
24+
assignEnvVariable('BUILD_LABEL', idMatcher.group('major') + '.' + idMatcher.group('minor') + (idMatcher.group('service') ?: ''))
25+
//TODO: expect the checkpoint to be a release and thus assert it's empty?
26+
} else {
27+
error "DROP_ID, ${DROP_ID}, did not match any expected pattern."
28+
}
29+
assignEnvVariable('BUILD_TYPE', idMatcher.group('type'))
30+
assignEnvVariable('REPO_BUILD_TYPE', 'I')
31+
assignEnvVariable('BUILD_TIMESTAMP', idMatcher.group('date') + idMatcher.group('time'))
32+
assignEnvVariable('REPO_ID', "I${idMatcher.group('date')}-${idMatcher.group('time')}")
33+
idMatcher = null // release matcher as it's not serializable
34+
35+
assignEnvVariable('BUILD_LABEL_EQ', "${BUILD_LABEL}")
36+
assignEnvVariable('DROP_ID_EQ', "${DROP_ID}")
37+
38+
def STREAM = sh(returnStdout: true, script: '''#!/bin/sh +xe
39+
curl -o buildproperties.shsource https://download.eclipse.org/eclipse/downloads/drops4/${DROP_ID}/buildproperties.shsource
40+
source ./buildproperties.shsource
41+
echo ${STREAM}
42+
''').trim()
43+
def versionMatcher = STREAM =~ /(?<major>\d+)\.(?<minor>\d+).(?<service>\d+)/
44+
if (!versionMatcher.matches()) {
45+
error "STREAM must contain major, minor, and service versions, such as '4.37.0', but found: ${STREAM}"
46+
}
47+
assignEnvVariable('BUILD_MAJOR', versionMatcher.group('major'))
48+
assignEnvVariable('BUILD_MINOR', versionMatcher.group('minor'))
49+
assignEnvVariable('BUILD_SERVICE', versionMatcher.group('service'))
50+
versionMatcher = null // release matcher as it's not serializable
51+
52+
if ("${CHECKPOINT}") { // milestone or RC promotion
53+
assignEnvVariable('DL_TYPE', 'S')
54+
assignEnvVariable('REPO_SITE_SEGMENT', "${BUILD_MAJOR}.${BUILD_MINOR}milestones") //TODO: check this value!
55+
if ("${CHECKPOINT}" ==~ /M\d+([a-z])?/) {
56+
// Nothing more to do
57+
} else if ("${CHECKPOINT}" ==~ /RC\d+([a-z])?/) {
58+
assignEnvVariable('ACK_ID', "${BUILD_MAJOR}.${BUILD_MINOR}")
59+
assignEnvVariable('README_ID', "${BUILD_MAJOR}.${BUILD_MINOR}")
60+
} else {
61+
error "CHECKPOINT, ${CHECKPOINT}, did not match any expected pattern."
62+
}
63+
} else { // release promotion
64+
assignEnvVariable('DL_TYPE', 'R')
65+
66+
assignEnvVariable('REPO_SITE_SEGMENT', "${BUILD_MAJOR}.${BUILD_MINOR}")
67+
assignEnvVariable('ACK_ID', "${BUILD_MAJOR}.${BUILD_MINOR}")
68+
assignEnvVariable('README_ID', "${BUILD_MAJOR}.${BUILD_MINOR}")
69+
}
70+
assignEnvVariable('NEWS_ID', "${BUILD_MAJOR}.${BUILD_MINOR}")
71+
72+
assignEnvVariable('DL_LABEL', "${BUILD_SERVICE}" == '0' // For initial releases, do not include service in label
73+
? "${BUILD_MAJOR}.${BUILD_MINOR}${CHECKPOINT}"
74+
: "${BUILD_MAJOR}.${BUILD_MINOR}.${BUILD_SERVICE}${CHECKPOINT}"
75+
)
76+
assignEnvVariable('DL_LABEL_EQ', "${DL_LABEL}")
77+
78+
// This is DL_DROP_ID for Eclipse. The one for equinox has DL_LABEL_EQ in middle.
79+
assignEnvVariable('DL_DROP_ID', "${DL_TYPE}-${DL_LABEL}-${BUILD_TIMESTAMP}")
80+
assignEnvVariable('DL_DROP_ID_EQ', "${DL_TYPE}-${DL_LABEL_EQ}-${BUILD_TIMESTAMP}")
81+
82+
if (!env.SIGNOFF_BUG) {
83+
echo '''\
84+
[WARNING] SIGNOFF_BUG was not defined. That is valid if no Unit Tests failures but otherwise should be defined.
85+
Can be added by hand to buildproperties.php in drop site, if in fact there were errors, and simply forgot to specify.
86+
'''.stripIndent()
87+
}
88+
89+
def serviceVersionSegment = (env.CHECKPOINT || env.BUILD_SERVICE != '0') ? ('_' + env.BUILD_SERVICE) : ''
90+
assignEnvVariable('TAG', "${DL_TYPE}${BUILD_MAJOR}_${BUILD_MINOR}${serviceVersionSegment}${env.CHECKPOINT ? ('_' + env.CHECKPOINT) : ''}")
91+
}
92+
}
93+
}
1294
stage('Rename and Promote') {
95+
environment {
96+
HIDE_SITE = 'true'
97+
CL_SITE = "${WORKSPACE}/stage2output${TRAIN_NAME}${CHECKPOINT}"
98+
// Build machine locations (would very seldom change)
99+
BUILD_ROOT = '/home/data/httpd/download.eclipse.org'
100+
BUILD_REPO_ORIGINAL = "${BUILD_MAJOR}.${BUILD_MINOR}-${REPO_BUILD_TYPE}-builds"
101+
BUILDMACHINE_BASE_SITE = "${BUILD_ROOT}/eclipse/updates/${BUILD_REPO_ORIGINAL}"
102+
BUILDMACHINE_BASE_DL = "${BUILD_ROOT}/eclipse/downloads/drops4"
103+
BUILDMACHINE_BASE_EQ = "${BUILD_ROOT}/equinox/drops"
104+
// Eclipse and Equinox drop Site (final segment)
105+
ECLIPSE_DL_DROP_DIR_SEGMENT = "${DL_TYPE}-${DL_LABEL}-${BUILD_TIMESTAMP}"
106+
EQUINOX_DL_DROP_DIR_SEGMENT = "${DL_TYPE}-${DL_LABEL_EQ}-${BUILD_TIMESTAMP}"
107+
}
13108
steps {
109+
//TODO: check if CL_SITE dir has to be created before?
110+
//TODO: is this file necessary?
111+
writeFile(file: "${CL_SITE}/checklist.txt", text: """\
112+
Promoted on: ${new Date()}
113+
114+
DROP_ID${DROP_ID.padLeft(25)}
115+
BUILD_LABEL${BUILD_LABEL.padLeft(25)}
116+
DROP_ID_EQ${DROP_ID_EQ.padLeft(25)}
117+
BUILD_LABEL_EQ${BUILD_LABEL_EQ.padLeft(25)}
118+
119+
DL_TYPE${DL_TYPE.padLeft(25)}
120+
DL_LABEL${DL_LABEL.padLeft(25)}
121+
DL_LABEL_EQ${DL_LABEL_EQ.padLeft(25)}
122+
ECLIPSE_DL_DROP_DIR_SEGMENT${ECLIPSE_DL_DROP_DIR_SEGMENT.padLeft(25)}
123+
EQUINOX_DL_DROP_DIR_SEGMENT${EQUINOX_DL_DROP_DIR_SEGMENT.padLeft(25)}
124+
REPO_SITE_SEGMENT${REPO_SITE_SEGMENT.padLeft(25)}
125+
HIDE_SITE${HIDE_SITE.padLeft(25)}
126+
127+
Eclipse downloads:
128+
https://download.eclipse.org/eclipse/downloads/drops4/${ECLIPSE_DL_DROP_DIR_SEGMENT}/
129+
130+
Update existing (non-production) installs:
131+
https://download.eclipse.org/eclipse/updates/${DL_TYPE == 'R' ? REPO_SITE_SEGMENT : BUILD_REPO_ORIGINAL}/
132+
133+
Specific repository good for building against:
134+
https://download.eclipse.org/eclipse/updates/${DL_TYPE == 'R' ? (REPO_SITE_SEGMENT + '/' + ECLIPSE_DL_DROP_DIR_SEGMENT) : (BUILD_REPO_ORIGINAL + '/' + DROP_ID)}/
135+
136+
Equinox specific downloads:
137+
https://download.eclipse.org/equinox/drops/${EQUINOX_DL_DROP_DIR_SEGMENT}/
138+
""".stripIndent())
139+
writeFile(file: "${CL_SITE}/mailtemplate.txt", text: """\
140+
Hello everyone,
141+
142+
We are pleased to announce that ${TRAIN_NAME} ${CHECKPOINT} is available for download and updates.
143+
144+
Eclipse downloads:
145+
https://download.eclipse.org/eclipse/downloads/drops4/${ECLIPSE_DL_DROP_DIR_SEGMENT}/
146+
147+
New and Noteworthy:
148+
https://www.eclipse.org/eclipse/news/${NEWS_ID}/
149+
150+
Update existing (non-production) installs:
151+
https://download.eclipse.org/eclipse/updates/${DL_TYPE == 'R' ? REPO_SITE_SEGMENT : BUILD_REPO_ORIGINAL}/
152+
153+
Specific repository good for building against:
154+
https://download.eclipse.org/eclipse/updates/${DL_TYPE == 'R' ? (REPO_SITE_SEGMENT + '/' + ECLIPSE_DL_DROP_DIR_SEGMENT) : (BUILD_REPO_ORIGINAL + '/' + DROP_ID)}/
155+
156+
Equinox specific downloads:
157+
https://download.eclipse.org/equinox/drops/${EQUINOX_DL_DROP_DIR_SEGMENT}/
158+
159+
Thank you to everyone who made this checkpoint possible.
160+
161+
Thanks and Regards,
162+
The Eclipse Contributors
163+
""".stripIndent())
14164
sshagent(['projects-storage.eclipse.org-bot-ssh']) {
15165
sh '''#!/bin/bash -x
16166
curl -o promoteSites.sh https://download.eclipse.org/eclipse/relengScripts/cje-production/promotion/promoteSites.sh
@@ -32,3 +182,23 @@ pipeline {
32182
}
33183
}
34184
}
185+
186+
@NonCPS
187+
def assignEnvVariable(String name, String value) {
188+
env."${name}" = value
189+
println("${name}=${value}")
190+
}
191+
192+
@NonCPS
193+
def readParameter(String name, boolean allowEmpty = false) {
194+
//TODO: let jenkins trim the parameters and handle not allowed absense in the caller
195+
def value = (params[name] ?: '').trim()
196+
if (value) {
197+
println("${name}: ${value}")
198+
} else if (allowEmpty) {
199+
println("[WARNING] ${name} is blank")
200+
} else {
201+
error("${name} is not defined")
202+
}
203+
return value
204+
}

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)