Skip to content

Commit 94ed411

Browse files
committed
[Build] Enhance parameter processing in build promotion job
Drop consideration of 'M'-DROP_IDs, which are not produced anymore.
1 parent 32d8423 commit 94ed411

File tree

4 files changed

+138
-270
lines changed

4 files changed

+138
-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: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,124 @@ 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+
env.CHECKPOINT = readParameter('CHECKPOINT', true)
24+
env.SIGNOFF_BUG = readParameter('SIGNOFF_BUG', true)
25+
env.TRAIN_NAME = readParameter('TRAIN_NAME')
26+
27+
def idMatcher = null
28+
if ((idMatcher = env.DROP_ID =~ /(?<type>I)(?<date>\d{8})-(?<time>\d{4})/).matches()) {
29+
assignEnvVariable('BUILD_LABEL', "${DROP_ID}")
30+
} 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()) {
31+
assignEnvVariable('BUILD_LABEL', idMatcher.group('major') + '.' + idMatcher.group('minor') + (idMatcher.group('service') ?: ''))
32+
//TODO: expect the checkpoint to be a release and thus assert it's empty?
33+
} else {
34+
error "DROP_ID, ${DROP_ID}, did not match any expected pattern."
35+
}
36+
assignEnvVariable('BUILD_TYPE', idMatcher.group('type'))
37+
assignEnvVariable('REPO_BUILD_TYPE', 'I')
38+
assignEnvVariable('BUILD_TIMESTAMP', idMatcher.group('date') + idMatcher.group('time'))
39+
assignEnvVariable('REPO_ID', "I${idMatcher.group('date')}-${idMatcher.group('time')}")
40+
idMatcher = null // release matcher as it's not serializable
41+
42+
assignEnvVariable('BUILD_LABEL_EQ', "${BUILD_LABEL}")
43+
assignEnvVariable('DROP_ID_EQ', "${DROP_ID}")
44+
45+
sh 'curl -o buildproperties.shsource --fail https://download.eclipse.org/eclipse/downloads/drops4/${DROP_ID}/buildproperties.shsource'
46+
def STREAM = sh(returnStdout: true, script: 'source ./buildproperties.shsource && echo ${STREAM}').trim()
47+
def versionMatcher = STREAM =~ /(?<major>\d+)\.(?<minor>\d+).(?<service>\d+)/
48+
if (!versionMatcher.matches()) {
49+
error "STREAM must contain major, minor, and service versions, such as '4.37.0', but found: ${STREAM}"
50+
}
51+
assignEnvVariable('BUILD_MAJOR', versionMatcher.group('major'))
52+
assignEnvVariable('BUILD_MINOR', versionMatcher.group('minor'))
53+
assignEnvVariable('BUILD_SERVICE', versionMatcher.group('service'))
54+
versionMatcher = null // release matcher as it's not serializable
55+
56+
if ("${CHECKPOINT}") { // milestone or RC promotion
57+
assignEnvVariable('DL_TYPE', 'S')
58+
assignEnvVariable('REPO_SITE_SEGMENT', "${BUILD_MAJOR}.${BUILD_MINOR}milestones") //TODO: check this value!
59+
if ("${CHECKPOINT}" ==~ /M\d+([a-z])?/) {
60+
// Nothing more to do
61+
} else if ("${CHECKPOINT}" ==~ /RC\d+([a-z])?/) {
62+
assignEnvVariable('ACK_ID', "${BUILD_MAJOR}.${BUILD_MINOR}")
63+
assignEnvVariable('README_ID', "${BUILD_MAJOR}.${BUILD_MINOR}")
64+
} else {
65+
error "CHECKPOINT, ${CHECKPOINT}, did not match any expected pattern."
66+
}
67+
} else { // release promotion
68+
assignEnvVariable('DL_TYPE', 'R')
69+
70+
assignEnvVariable('REPO_SITE_SEGMENT', "${BUILD_MAJOR}.${BUILD_MINOR}")
71+
assignEnvVariable('ACK_ID', "${BUILD_MAJOR}.${BUILD_MINOR}")
72+
assignEnvVariable('README_ID', "${BUILD_MAJOR}.${BUILD_MINOR}")
73+
}
74+
assignEnvVariable('NEWS_ID', "${BUILD_MAJOR}.${BUILD_MINOR}")
75+
76+
assignEnvVariable('DL_LABEL', "${BUILD_SERVICE}" == '0' // For initial releases, do not include service in label
77+
? "${BUILD_MAJOR}.${BUILD_MINOR}${CHECKPOINT}"
78+
: "${BUILD_MAJOR}.${BUILD_MINOR}.${BUILD_SERVICE}${CHECKPOINT}"
79+
)
80+
assignEnvVariable('DL_LABEL_EQ', "${DL_LABEL}")
81+
82+
// This is DL_DROP_ID for Eclipse. The one for equinox has DL_LABEL_EQ in middle.
83+
assignEnvVariable('DL_DROP_ID', "${DL_TYPE}-${DL_LABEL}-${BUILD_TIMESTAMP}")
84+
assignEnvVariable('DL_DROP_ID_EQ', "${DL_TYPE}-${DL_LABEL_EQ}-${BUILD_TIMESTAMP}")
85+
86+
if (!env.SIGNOFF_BUG) {
87+
echo '''\
88+
[WARNING] SIGNOFF_BUG was not defined. That is valid if no Unit Tests failures but otherwise should be defined.
89+
Can be added by hand to buildproperties.php in drop site, if in fact there were errors, and simply forgot to specify.
90+
'''.stripIndent()
91+
}
92+
93+
def serviceVersionSegment = (env.CHECKPOINT || env.BUILD_SERVICE != '0') ? ('_' + env.BUILD_SERVICE) : ''
94+
assignEnvVariable('TAG', "${DL_TYPE}${BUILD_MAJOR}_${BUILD_MINOR}${serviceVersionSegment}${env.CHECKPOINT ? ('_' + env.CHECKPOINT) : ''}")
95+
}
96+
}
97+
}
1298
stage('Rename and Promote') {
99+
environment {
100+
BUILDMACHINE_BASE_DL = "${EP_ECLIPSE_ROOT}/downloads/drops4"
101+
BUILDMACHINE_BASE_EQ = "${EP_EQUINOX_ROOT}/drops"
102+
BUILD_REPO_ORIGINAL = "${BUILD_MAJOR}.${BUILD_MINOR}-${REPO_BUILD_TYPE}-builds"
103+
BUILDMACHINE_BASE_SITE = "${EP_ECLIPSE_ROOT}/updates/${BUILD_REPO_ORIGINAL}"
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+
writeFile(file: "${WORKSPACE}/stage2output${TRAIN_NAME}${CHECKPOINT}/mailtemplate.txt", text: """\
110+
We are pleased to announce that ${TRAIN_NAME} ${CHECKPOINT} is available for download and updates.
111+
112+
Eclipse downloads:
113+
https://download.eclipse.org/eclipse/downloads/drops4/${ECLIPSE_DL_DROP_DIR_SEGMENT}/
114+
115+
New and Noteworthy:
116+
https://www.eclipse.org/eclipse/news/${NEWS_ID}/
117+
118+
Update existing (non-production) installs:
119+
https://download.eclipse.org/eclipse/updates/${DL_TYPE == 'R' ? REPO_SITE_SEGMENT : BUILD_REPO_ORIGINAL}/
120+
121+
Specific repository good for building against:
122+
https://download.eclipse.org/eclipse/updates/${DL_TYPE == 'R' ? (REPO_SITE_SEGMENT + '/' + ECLIPSE_DL_DROP_DIR_SEGMENT) : (BUILD_REPO_ORIGINAL + '/' + DROP_ID)}/
123+
124+
Equinox specific downloads:
125+
https://download.eclipse.org/equinox/drops/${EQUINOX_DL_DROP_DIR_SEGMENT}/
126+
127+
Thank you to everyone who made this checkpoint possible.
128+
""".stripIndent())
14129
sshagent(['projects-storage.eclipse.org-bot-ssh']) {
15130
sh '''#!/bin/bash -x
16131
curl -o promoteSites.sh https://download.eclipse.org/eclipse/relengScripts/cje-production/promotion/promoteSites.sh
@@ -32,3 +147,23 @@ pipeline {
32147
}
33148
}
34149
}
150+
151+
@NonCPS
152+
def assignEnvVariable(String name, String value) {
153+
env."${name}" = value
154+
println("${name}=${value}")
155+
}
156+
157+
@NonCPS
158+
def readParameter(String name, boolean allowEmpty = false) {
159+
//TODO: let jenkins trim the parameters and handle not allowed absense in the caller
160+
def value = (params[name] ?: '').trim()
161+
if (value) {
162+
println("${name}: ${value}")
163+
} else if (allowEmpty) {
164+
println("[WARNING] ${name} is blank")
165+
} else {
166+
error("${name} is not defined")
167+
}
168+
return value
169+
}

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)