Skip to content

Commit 8b27105

Browse files
committed
[RelEng] Update build configurations with release in release promotion
This automates the update of build configurations with the final GA release versions on the master and corresponding maintenance branch, by updating all versions or URLs that were pointing to a RC or specific I-build to point to the final GA release. On the maintenance branch also set a fixed version for ECJ.
1 parent 8eadc0b commit 8b27105

File tree

5 files changed

+154
-43
lines changed

5 files changed

+154
-43
lines changed

JenkinsJobs/Releng/prepareNextDevCycle.jenkinsfile

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ pipeline {
7676
steps {
7777
checkout scm
7878
script { // Always load the script from the very same state this pipeline is loaded (to ensure consistency)
79+
utilities = load "JenkinsJobs/shared/utilities.groovy"
7980
githubAPI = load "JenkinsJobs/shared/githubAPI.groovy"
8081
githubAPI.setDryRun(params.DRY_RUN)
8182
}
@@ -154,7 +155,7 @@ pipeline {
154155
"(?<prefix># Schedule:.*\\R)(?s).*(?<suffix>\\R'''\\))" : "\${prefix}${I_BUILD_SCHEDULE}\${suffix}",
155156
])
156157

157-
commitAllChangesExcludingSubmodules("Update versions to ${NEXT_RELEASE_VERSION} in build scripts")
158+
utilities.commitAllChangesExcludingSubmodules("Update versions to ${NEXT_RELEASE_VERSION} in build scripts")
158159
}
159160
}
160161
stage('Move previous version to current RC') {
@@ -182,7 +183,7 @@ pipeline {
182183
'previousReleaseVersion=.*' : "previousReleaseVersion=${PREVIOUS_RELEASE_CANDIDATE_TAG}",
183184
'previousReleaseVersionRepo=.*' : "previousReleaseVersionRepo=${PREVIOUS_RELEASE_VERSION}-I-builds",
184185
])
185-
commitAllChangesExcludingSubmodules("Move previous version to ${PREVIOUS_RELEASE_CANDIDATE_TAG} in build scripts")
186+
utilities.commitAllChangesExcludingSubmodules("Move previous version to ${PREVIOUS_RELEASE_CANDIDATE_TAG} in build scripts")
186187
}
187188
}
188189
stage('Clear Qualifier-update files') {
@@ -242,7 +243,7 @@ pipeline {
242243
])
243244
sh "mv cje-production/streams/repositories_master.txt cje-production/streams/repositories_${MAINTENANCE_BRANCH}.txt"
244245

245-
commitAllChangesExcludingSubmodules("Move ${PREVIOUS_RELEASE_VERSION}-I builds to ${MAINTENANCE_BRANCH} branch")
246+
utilities.commitAllChangesExcludingSubmodules("Move ${PREVIOUS_RELEASE_VERSION}-I builds to ${MAINTENANCE_BRANCH} branch")
246247

247248
// Switch back to master for subsequent parts of this pipeline
248249
sh 'git checkout master'
@@ -441,6 +442,8 @@ pipeline {
441442
}
442443
}
443444

445+
@groovy.transform.Field
446+
def utilities = null
444447
@groovy.transform.Field
445448
def githubAPI = null
446449

@@ -466,28 +469,9 @@ def parseDate(String dateString) {
466469
}
467470

468471
def replaceInFile(String filePath, Map<String,String> replacements) {
469-
replaceAllInFile(filePath, replacements.collectEntries{ k, v -> [java.util.regex.Pattern.quote(k), v] });
472+
utilities.replaceInFile(filePath, replacements)
470473
}
471474

472475
def replaceAllInFile(String filePath, Map<String,String> replacements) {
473-
def content = readFile(filePath)
474-
for (entry in replacements) {
475-
def newContent = content.replaceAll(entry.key, entry.value)
476-
if (newContent == content && !(content =~ entry.key)) { // pattern matches, but the replacement is equal to the current content
477-
error("Pattern not found in file '${filePath}': ${entry.key}")
478-
}
479-
content = newContent
480-
}
481-
writeFile(file:filePath, text: content)
482-
}
483-
484-
def commitAllChangesExcludingSubmodules(String commitMessage) {
485-
withEnv(["COMMIT_MESSAGE=${commitMessage}"]) {
486-
sh '''
487-
#Commit all changes, except for the updated sub-modules here
488-
git add --all
489-
git restore --staged $(git submodule foreach --quiet 'echo $sm_path')
490-
git commit --message "${COMMIT_MESSAGE}"
491-
'''
492-
}
476+
utilities.replaceAllInFile(filePath, replacements)
493477
}

JenkinsJobs/Releng/promoteBuild.jenkinsfile

Lines changed: 112 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ pipeline {
6767
)
6868
// This is DL_DROP_ID for Eclipse and Equinox
6969
assignEnvVariable('DL_DROP_ID', "${DL_TYPE}-${DL_LABEL}-${buildTimestamp}")
70+
assignEnvVariable('MAINTENANCE_BRANCH', "R${BUILD_MAJOR}_${BUILD_MINOR}_maintenance")
7071

7172
if (!env.SIGNOFF_BUG) {
7273
echo '''\
@@ -79,14 +80,20 @@ pipeline {
7980
}
8081
}
8182
}
82-
stage('Checkout Git') {
83+
stage('Checkout SCM') {
8384
steps {
8485
dir("${WORKSPACE}/repository") {
8586
checkout scm
8687
script { // Always load the script from the very same state this pipeline is loaded (to ensure consistency)
88+
utilities = load "JenkinsJobs/shared/utilities.groovy"
8789
githubAPI = load "JenkinsJobs/shared/githubAPI.groovy"
8890
}
8991
sh '''#!/bin/bash -xe
92+
git branch --force master HEAD
93+
git fetch origin "refs/heads/${MAINTENANCE_BRANCH}"
94+
git reflog show master
95+
git reflog show "origin/${MAINTENANCE_BRANCH}"
96+
9097
git fetch origin tag "${REPO_ID}"
9198
git checkout "${REPO_ID}"
9299
# Check out all submodules at the specified REPO_ID
@@ -187,6 +194,108 @@ pipeline {
187194
]
188195
}
189196
}
197+
stage('Update build configurations') {
198+
when {
199+
environment name: 'DL_TYPE', value: 'R'
200+
}
201+
environment {
202+
RELEASE_P2_REPOSITORY = "https://download.eclipse.org/eclipse/updates/${BUILD_MAJOR}.${BUILD_MINOR}/${DL_DROP_ID}/"
203+
}
204+
steps {
205+
dir("${WORKSPACE}/repository") {
206+
script { // Update the master branch
207+
sh 'git checkout master'
208+
sh '''
209+
mvn -f eclipse-platform-parent/pom.xml org.eclipse.tycho:tycho-versions-plugin:set-property \
210+
-Dproperties=previous-release.baseline \
211+
-DnewPrevious-release.baseline="${RELEASE_P2_REPOSITORY}"
212+
'''
213+
utilities.replaceAllInFile('cje-production/buildproperties.txt', [
214+
'BASEBUILDER_TAG=".*?"' : "BASEBUILDER_TAG=\"${BUILD_MAJOR}.${BUILD_MINOR}\"",
215+
'API_PREV_REF_LABEL=".*?"' : "API_PREV_REF_LABEL=\"${BUILD_MAJOR}.${BUILD_MINOR}\"",
216+
'PREVIOUS_RELEASE_VER=".*?"' : "PREVIOUS_RELEASE_VER=\"${BUILD_MAJOR}.${BUILD_MINOR}\"",
217+
'PREVIOUS_RELEASE_REPO_ID=".*?"' : "PREVIOUS_RELEASE_REPO_ID=\"${BUILD_MAJOR}.${BUILD_MINOR}\"",
218+
'BASEBUILD_ID=".*?"' : "BASEBUILD_ID=\"${DL_DROP_ID}\"",
219+
'PREVIOUS_RELEASE_ID=".*?"' : "PREVIOUS_RELEASE_ID=\"${DL_DROP_ID}\"",
220+
])
221+
utilities.replaceAllInFile('eclipse.platform.releng.tychoeclipsebuilder/eclipse-junit-tests/src/main/resources/equinoxp2tests.properties', [
222+
'eclipse-platform-\\d+.\\d+[^-]*?-' : "eclipse-platform-${BUILD_MAJOR}.${BUILD_MINOR}-",
223+
'org.eclipse.equinox.p2.tests.last.release.build.repo=.*' : "org.eclipse.equinox.p2.tests.last.release.build.repo=https://download.eclipse.org/equinox/drops/${DL_DROP_ID}/",
224+
])
225+
utilities.replaceAllInFile('eclipse.platform.releng.tychoeclipsebuilder/eclipse-junit-tests/src/main/resources/label.properties', [
226+
'previousReleaseVersion=.*' : "previousReleaseVersion=${BUILD_MAJOR}.${BUILD_MINOR}",
227+
])
228+
utilities.replaceAllInFile('eclipse.platform.releng.tychoeclipsebuilder/eclipse-junit-tests/src/main/scripts/getPreviousRelease.sh', [
229+
'R\\/R-\\d+.\\d+-\\d{12}' : "R/${DL_DROP_ID}",
230+
'-\\d+.\\d+-linux-gtk-' : "-${BUILD_MAJOR}.${BUILD_MINOR}-linux-gtk-",
231+
])
232+
utilities.replaceAllInFile('production/testScripts/configuration/streamSpecific.properties', [
233+
'previousReleaseLocation=.*' : 'previousReleaseLocation=https://\\${DOWNLOAD_HOST}/eclipse/downloads/drops4/' + DL_DROP_ID + '/',
234+
'previousReleaseVersion=.*' : "previousReleaseVersion=${BUILD_MAJOR}.${BUILD_MINOR}",
235+
'previousReleaseVersionRepo=.*' : "previousReleaseVersionRepo=${BUILD_MAJOR}.${BUILD_MINOR}",
236+
])
237+
238+
utilities.commitAllChangesExcludingSubmodules("Update previous release version to ${BUILD_MAJOR}.${BUILD_MINOR} GA across build scripts")
239+
}
240+
script { // Update the maintenance branch
241+
sh 'git checkout -b updateMaintenance "origin/${MAINTENANCE_BRANCH}"'
242+
def ecjManifest = sh(script: "curl https://raw.githubusercontent.com/eclipse-jdt/eclipse.jdt.core/refs/tags/${REPO_ID}/org.eclipse.jdt.core.compiler.batch/META-INF/MANIFEST.MF", returnStdout: true).trim()
243+
def bundleVersion = readManifest(text: ecjManifest).main['Bundle-Version']
244+
def ecjVersion = bundleVersion.substring(0, bundleVersion.indexOf('.qualifier'))
245+
sh """
246+
mvn -f eclipse-platform-parent/pom.xml org.eclipse.tycho:tycho-versions-plugin:set-property \
247+
-Dproperties=eclipse-sdk-repo,previous-release.baseline,cbi-ecj-version \
248+
-DnewEclipse-sdk-repo="${RELEASE_P2_REPOSITORY}" \
249+
-DnewPrevious-release.baseline="${RELEASE_P2_REPOSITORY}" \
250+
-DnewCbi-ecj-version="${ecjVersion}"
251+
"""
252+
utilities.replaceAllInFile('cje-production/buildproperties.txt', [
253+
'ECLIPSE_RUN_REPO="https://download.eclipse.org/eclipse/updates/.*"' : "ECLIPSE_RUN_REPO=\"${RELEASE_P2_REPOSITORY}\"",
254+
])
255+
256+
utilities.commitAllChangesExcludingSubmodules("Update ${MAINTENANCE_BRANCH} branch with release version for ${BUILD_MAJOR}_${BUILD_MINOR}+ changes")
257+
}
258+
// Switch back to master for subsequent parts of this pipeline
259+
sh 'git checkout master'
260+
261+
// Display created commits
262+
sh '''#!/bin/bash -xe
263+
git log origin/master..master --patch-with-stat --summary
264+
git log origin/${MAINTENANCE_BRANCH}..updateMaintenance --patch-with-stat --summary
265+
'''
266+
sshagent(['github-bot-ssh']) {
267+
sh '''#!/bin/bash -xe
268+
pushURL=$(git config remote.origin.url)
269+
# Switch to SSH, if the configured URL uses HTTPS (we can only push with SSH)
270+
if [[ "$pushURL" == http* ]]; then
271+
pushURL=$(echo $pushURL|sed --expression 's|https://github.com/|[email protected]:|')
272+
fi
273+
274+
git push ${pushURL} "master:refs/heads/update-build-to-R${BUILD_MAJOR}.${BUILD_MINOR}"
275+
git push ${pushURL} "updateMaintenance:refs/heads/update-${MAINTENANCE_BRANCH}"
276+
'''
277+
}
278+
// Create PRs agains the master and maintenance branch
279+
script { withEnv(['GITHUB_BOT_TOKEN=' + credentials('github-bot-token')]) {
280+
def masterPR = githubAPI.createPullRequest('eclipse-platform/eclipse.platform.releng.aggregator',
281+
"Update previous release version to ${BUILD_MAJOR}.${BUILD_MINOR} GA across build scripts", """\
282+
Update the the `${MAINTENANCE_BRANCH}` branch with final ${BUILD_MAJOR}.${BUILD_MINOR} release version.
283+
284+
**This should not be submitted before ${BUILD_MAJOR}.${BUILD_MINOR} is finally released.**
285+
""".stripIndent(),"update-build-to-R${BUILD_MAJOR}.${BUILD_MINOR}", 'master')
286+
287+
githubAPI.createPullRequest('eclipse-platform/eclipse.platform.releng.aggregator',
288+
"Update ${MAINTENANCE_BRANCH} branch with release version for ${BUILD_MAJOR}_${BUILD_MINOR}+ changes", """\
289+
Update the the `${MAINTENANCE_BRANCH}` branch with final ${BUILD_MAJOR}.${BUILD_MINOR} release version.
290+
This complements:
291+
- ${masterPR}
292+
293+
**This should not be submitted before ${BUILD_MAJOR}.${BUILD_MINOR} is finally released.**
294+
""".stripIndent(),"update-${MAINTENANCE_BRANCH}", "${MAINTENANCE_BRANCH}")
295+
}}
296+
}
297+
}
298+
}
190299
stage('Update acknowledgements') {
191300
environment {
192301
GITHUB_BOT_TOKEN = credentials('github-bot-token')
@@ -292,6 +401,8 @@ EOF
292401
"""
293402
}
294403

404+
@groovy.transform.Field
405+
def utilities = null
295406
@groovy.transform.Field
296407
def githubAPI = null
297408

JenkinsJobs/shared/githubAPI.groovy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ def queryGithubAPI(String method, String endpoint, Map<String, Object> queryPara
6969
query += "-d '" + params + "'"
7070
}
7171
if (IS_DRY_RUN && !method.isEmpty()) {
72+
if (!env.GITHUB_BOT_TOKEN) {
73+
error 'Required GITHUB_BOT_TOKEN not set'
74+
}
7275
echo "Query (not send): ${query}"
7376
return null
7477
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
def replaceInFile(String filePath, Map<String,String> replacements) {
3+
replaceAllInFile(filePath, replacements.collectEntries{ k, v -> [java.util.regex.Pattern.quote(k), v] });
4+
}
5+
6+
def replaceAllInFile(String filePath, Map<String,String> replacements) {
7+
def content = readFile(filePath)
8+
for (entry in replacements) {
9+
def newContent = content.replaceAll(entry.key, entry.value)
10+
if (newContent == content && !(content =~ entry.key)) { // pattern matches, but the replacement is equal to the current content
11+
error("Pattern not found in file '${filePath}': ${entry.key}")
12+
}
13+
content = newContent
14+
}
15+
writeFile(file:filePath, text: content)
16+
}
17+
18+
def commitAllChangesExcludingSubmodules(String commitMessage) {
19+
withEnv(["COMMIT_MESSAGE=${commitMessage}"]) {
20+
sh '''
21+
#Commit all changes, except for the updated sub-modules here
22+
git add --all
23+
git restore --staged $(git submodule foreach --quiet 'echo $sm_path')
24+
git commit --message "${COMMIT_MESSAGE}"
25+
'''
26+
}
27+
}
28+
29+
return this

RELEASE.md

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ The actual steps to release
9393
* #### **Promote to GA**
9494
- After Simrel declares RC2 (usually the Friday before release) run the [Promote Build](https://ci.eclipse.org/releng/job/Releng/job/promoteBuild/) job to promote RC2 (or RC2a).
9595
- `DROP_ID`: Final delease candidate's ID, e.g.: `S-4.36RC2-202505281830/`
96+
- This will create pull requests to update the build configuration on the master and corresponding maintenance branch to the promoted release.
97+
- Only submit them AFTER the release was finally published.
9698
- You can subscribe to [cross-project-issues](https://accounts.eclipse.org/mailing-list/cross-project-issues-dev) to get the notifications on Simrel releases.
9799
* **Contribute to SimRel**
98100
- If SimRel is not updated before the I-builds are cleaned up (specifically the build for RC2/GA) it will break.
@@ -120,29 +122,11 @@ The release is scheduled for 10AM EST. Typically the jobs are scheduled beforeha
120122
- For the Y and P build parameters it's important to know whether or not Y and P builds were run during the release. Since they correspond to java releases on a 6 month cycle, typically they are built in odd-numbered releases.
121123
The existing builds are kept for one release, then cleaned up before the next stream that will have Y and P builds. it's convoluted and I dont want to type it out. Remove Y builds on even releases.
122124
- If something doesn't get cleaned up properly you can use Use the [list artifacts](https://ci.eclipse.org/releng/view/Cleanup/job/list_artifacts_from_download_server/) job to generate ta list of what's on the download server and either create a new job to clean it up or update and rerun the cleanup job as appropriate.
123-
* **Set Previous Release to GA**
124-
- Everything that was updated to RC2 (see below) should now use the released build.
125125

126126
### **Preparation for the next Release**
127127
After RC2 create an issue to track preparation work for the next stream (see [Preparation work for 4.25 (2022-09)](https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/284)).
128128
- A script to create this issue exists [here](scripts/newReleasePrep.sh) for those who have the hub cli tool installed. The process has been in flux recently so please update the script if necessary, but it provides a helpful template since most tasks in the previous release's issue become links.
129129

130-
#### **Maintenance Branches:**
131-
* **Update maintenance branch with release version**
132-
- Once the I-build repo is removed for the previous release the maintenance branch will have to use the release location, i.e. any references to `https://download.eclipse.org/eclipse/updates/4.25-I-builds/` will need to be updated to `https://download.eclipse.org/eclipse/updates/4.26/R-4.26-202211231800/`
133-
- Functionally this means:
134-
- Update the ECLIPSE_RUN_REPO in the [cje-production](cje-production) buildproperties.txt files
135-
- Update `eclipse-sdk-repo` in [eclipse-platform-parent/pom.xml](eclipse-platform-parent/pom.xml)
136-
- This step can be prepared ahead of time but can't be merged until the release build has been promoted and the update site exists.
137-
* **Update ECJ compiler** in the platform build (if it needs to be updated).
138-
* To find the new *unqualified* compiler version:
139-
- Go to the update site for the release candidate
140-
- Click `plugins`
141-
- Find the *unqualified* version of the artifact `org.eclipse.jdt.core.complier.batch_${ecjversion}.jar`, i.e. the version consisting only of the _major_._minor_._service_ part, but without qualifier.
142-
It's the version of the `org.eclipse.jdt:ecj` artifact at Maven-Central, about to be relased.
143-
* Update the `cbi-ecj-version` in [eclipse.platform.releng.aggregator/eclipse-platform-parent/pom.xml](https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/blob/master/eclipse-platform-parent/pom.xml)
144-
to the exact version of the to be released`org.eclipse.jdt.core.complier.batch` bundle, e.g.: `3.40.0`
145-
146130
#### **Update the Build Calendar:**
147131
- Create an [issue](https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/289) and update the [build calendar](https://calendar.google.com/calendar/u/0?cid=cHJmazI2ZmRtcHJ1MW1wdGxiMDZwMGpoNHNAZ3JvdXAuY2FsZW5kYXIuZ29vZ2xlLmNvbQ) for the next GA release based on the [Simultaneous Release schedule](https://wiki.eclipse.org/Simultaneous_Release).
148132
- Each stream has its own [wiki](https://wiki.eclipse.org/Category:SimRel-2022-06) page with a more detailed schedule.

0 commit comments

Comments
 (0)