Skip to content

Commit 8dd9e20

Browse files
committed
[RelEng] Create and update maintenance branches in release preparation
In the release preparation pipeline create the R4_XX_maintenance branch for the eclipse.platform.releng.aggregator repo and all submodules. Furthermore create the commit for the maintenance branch in the aggregator repo to move the maintained release's I-build to that maintenance branch and push it as PR against the maintenance branch.
1 parent 779c4b6 commit 8dd9e20

File tree

4 files changed

+76
-94
lines changed

4 files changed

+76
-94
lines changed

JenkinsJobs/Releng/createMaintenanceBranch.groovy

Lines changed: 0 additions & 80 deletions
This file was deleted.

JenkinsJobs/Releng/prepareNextDevCycle.jenkinsfile

Lines changed: 76 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,18 @@ pipeline {
2929
nextVersionMatcher = null // release matcher as it's not serializable
3030

3131
env.PREVIOUS_RELEASE_CANDIDATE_ID = readParameter('PREVIOUS_RELEASE_CANDIDATE_ID')
32-
def previousIdMatcher = env.PREVIOUS_RELEASE_CANDIDATE_ID =~ /(S|R)-(?<major>\d+)\.(?<minor>\d+)(\.\d+)?(?<checkpoint>(M|RC)\d+[a-z]?)?-(?<date>\d{8})(?<time>\d{4})/
32+
def previousIdMatcher = env.PREVIOUS_RELEASE_CANDIDATE_ID =~ /(?<type>[SR])-(?<major>\d+)\.(?<minor>\d+)(\.(?<service>\d+))?(?<checkpoint>(M|RC)\d+[a-z]?)?-(?<date>\d{8})(?<time>\d{4})/
3333
if (!previousIdMatcher.matches()) {
3434
error "Unexpected format for PREVIOUS_RELEASE_CANDIDATE_ID: ${PREVIOUS_RELEASE_CANDIDATE_ID}"
3535
}
36+
def checkpoint = previousIdMatcher.group('checkpoint')
37+
def previousReleaseVersionService = previousIdMatcher.group('service') ?: '0'
3638
assignEnvVariable('PREVIOUS_RELEASE_VERSION_MAJOR', previousIdMatcher.group('major'))
3739
assignEnvVariable('PREVIOUS_RELEASE_VERSION_MINOR', previousIdMatcher.group('minor'))
3840
assignEnvVariable('PREVIOUS_RELEASE_VERSION', "${PREVIOUS_RELEASE_VERSION_MAJOR}.${PREVIOUS_RELEASE_VERSION_MINOR}")
39-
assignEnvVariable('PREVIOUS_RELEASE_CANDIDATE_TAG', "${PREVIOUS_RELEASE_VERSION}${previousIdMatcher.group('checkpoint')}")
41+
assignEnvVariable('PREVIOUS_RELEASE_CANDIDATE_TAG', "${PREVIOUS_RELEASE_VERSION}${checkpoint}")
4042
assignEnvVariable('PREVIOUS_RELEASE_CANDIDATE_I_BUILD', "I${previousIdMatcher.group('date')}-${previousIdMatcher.group('time')}")
43+
assignEnvVariable('PREVIOUS_RELEASE_CANDIDATE_GIT_TAG', "${previousIdMatcher.group('type')}${PREVIOUS_RELEASE_VERSION_MAJOR}_${PREVIOUS_RELEASE_VERSION_MINOR}${(checkpoint || previousReleaseVersionService != '0') ? ('_' + previousReleaseVersionService) : ''}${checkpoint ? ('_' + checkpoint) : ''}")
4144
previousIdMatcher = null // release matcher as it's not serializable
4245

4346
//TODO: Read the dates from the calender instead of provide a structured document somewhere?
@@ -54,6 +57,7 @@ pipeline {
5457
assignEnvVariable('NEXT_RELEASE_YEAR', gaDate.year.toString())
5558
assignEnvVariable('NEXT_RELEASE_MONTH', String.format("%02d", gaDate.monthValue))
5659
assignEnvVariable('NEXT_RELEASE_NAME', "${NEXT_RELEASE_YEAR}-${NEXT_RELEASE_MONTH}")
60+
assignEnvVariable('MAINTENANCE_BRANCH', "R${PREVIOUS_RELEASE_VERSION_MAJOR}_${PREVIOUS_RELEASE_VERSION_MINOR}_maintenance")
5761
}
5862
}
5963
}
@@ -64,10 +68,22 @@ pipeline {
6468
githubAPI = load "JenkinsJobs/shared/githubAPI.groovy"
6569
githubAPI.setDryRun(params.DRY_RUN)
6670
}
67-
sh '''
68-
git submodule update --init --recursive
71+
sh '''#!/bin/bash -xe
72+
git submodule update --init --recursive --remote
6973
git config --global user.email '[email protected]'
7074
git config --global user.name 'Eclipse Releng Bot'
75+
76+
# Create maintenance branch (at RC) and checkout master (to allow switching branches)
77+
function createBranches() {
78+
git checkout -B master HEAD
79+
git fetch origin tag "${PREVIOUS_RELEASE_CANDIDATE_GIT_TAG}"
80+
git branch ${MAINTENANCE_BRANCH} ${PREVIOUS_RELEASE_CANDIDATE_GIT_TAG}
81+
git reflog show master
82+
git reflog show ${MAINTENANCE_BRANCH}
83+
}
84+
createBranches
85+
export -f createBranches
86+
git submodule foreach 'createBranches'
7187
'''
7288
}
7389
}
@@ -162,15 +178,53 @@ pipeline {
162178
'''
163179
}
164180
}
181+
stage('Prepare maintenance branch') {
182+
steps {
183+
// Apply the following changes at a preparation branch, starting at the maintenance branch (to create a PR later)
184+
sh 'git checkout -b prepareMaintenance ${MAINTENANCE_BRANCH}'
185+
186+
replaceInFile('JenkinsJobs/JobDSL.json', [
187+
"\"${PREVIOUS_RELEASE_VERSION}\": \"master\"" : "\"${PREVIOUS_RELEASE_VERSION}\": \"${MAINTENANCE_BRANCH}\"",
188+
])
189+
replaceInFile('JenkinsJobs/Builds/build.jenkinsfile', [
190+
"typeName: 'Integration' , branchLabel: 'master'" : "typeName: 'Integration' , branchLabel: '${MAINTENANCE_BRANCH}'",
191+
])
192+
replaceInFile('JenkinsJobs/Builds/DockerImagesBuild.jenkinsfile', [
193+
'-b master' : "-b ${MAINTENANCE_BRANCH}",
194+
])
195+
replaceAllInFile('JenkinsJobs/Builds/FOLDER.groovy', [
196+
"spec\\('''(?s).+?'''\\)" : "spec('')",
197+
"'master'" : "'${MAINTENANCE_BRANCH}'",
198+
])
199+
replaceInFile('cje-production/buildproperties.txt', [
200+
'BRANCH="master"' : "BRANCH=\"${MAINTENANCE_BRANCH}\"",
201+
])
202+
replaceInFile('cje-production/streams/repositories_java25.txt', [
203+
': master' : ": ${MAINTENANCE_BRANCH}",
204+
])
205+
replaceInFile('cje-production/streams/repositories_master.txt', [
206+
': master' : ": ${MAINTENANCE_BRANCH}",
207+
])
208+
sh "mv cje-production/streams/repositories_master.txt cje-production/streams/repositories_${MAINTENANCE_BRANCH}.txt"
209+
210+
commitAllChangesExcludingSubmodules("Move ${PREVIOUS_RELEASE_VERSION}-I builds to ${MAINTENANCE_BRANCH} branch")
211+
212+
// Switch back to master for subsequent parts of this pipeline
213+
sh 'git checkout master'
214+
}
215+
}
165216
stage('Validate and list changes') {
166217
steps {
167218
sh '''
168219
function printLatestGitHistory() {
169-
git log origin/master..HEAD --patch-with-stat --summary
220+
git log origin/master..master --patch-with-stat --summary
170221
}
171222
printLatestGitHistory
172223
export -f printLatestGitHistory
173224
git submodule foreach 'printLatestGitHistory'
225+
226+
echo 'Print history of maintenance branch'
227+
git log refs/tags/${PREVIOUS_RELEASE_CANDIDATE_GIT_TAG}..prepareMaintenance --patch-with-stat --summary
174228
'''
175229
// Run simple clean build to verify that at least all parent versions are updated correctly
176230
sh 'mvn clean'
@@ -247,7 +301,7 @@ pipeline {
247301
stage('Push preparation branches') {
248302
steps {
249303
sshagent (['github-bot-ssh']) {
250-
sh '''#!/bin/bash -x
304+
sh '''#!/bin/bash -xe
251305
function pushNewCommitsToPreparationBranch() {
252306
pushURL=$(git config remote.origin.url)
253307
# Switch to SSH, if the configured URL uses HTTPS (we can only push with SSH)
@@ -257,11 +311,16 @@ pipeline {
257311
if [[ ${DRY_RUN} == 'true' ]]; then
258312
dryRunFlag='--dry-run'
259313
fi
260-
git push ${dryRunFlag} ${pushURL} HEAD:refs/heads/prepare_R${NEXT_RELEASE_VERSION}
314+
git push ${dryRunFlag} ${pushURL} "master:refs/heads/prepare-R${NEXT_RELEASE_VERSION}"
315+
git push ${dryRunFlag} ${pushURL} "${MAINTENANCE_BRANCH}:refs/heads/${MAINTENANCE_BRANCH}"
261316
}
262317
pushNewCommitsToPreparationBranch
263318
export -f pushNewCommitsToPreparationBranch
264319
git submodule foreach 'pushNewCommitsToPreparationBranch'
320+
321+
# Push preparation of the maintenance to a separate branch (not directly to the maintenance branch),
322+
# to enable creating a PR against the maintenance branch from it.
323+
git push ${dryRunFlag} ${pushURL} "prepareMaintenance:refs/heads/prepare-${MAINTENANCE_BRANCH}"
265324
'''
266325
}
267326
}
@@ -273,7 +332,7 @@ pipeline {
273332
steps {
274333
script {
275334
def prHeadline = "Prepare ${NEXT_RELEASE_VERSION} development"
276-
def prBranch = "prepare_R${NEXT_RELEASE_VERSION}"
335+
def prBranch = "prepare-R${NEXT_RELEASE_VERSION}"
277336
def aggregatorPreparationPR = githubAPI.createPullRequest('eclipse-platform/eclipse.platform.releng.aggregator', prHeadline, """\
278337
Prepare development of Eclipse ${NEXT_RELEASE_VERSION}.
279338
This includes:
@@ -284,7 +343,7 @@ pipeline {
284343

285344
def submodulePaths = sh(script: "git submodule --quiet foreach 'echo \$sm_path'", returnStdout: true).trim().split('\\s')
286345
for (submodulePath in submodulePaths) {
287-
def diff = sh(script:"cd ${submodulePath} && git diff HEAD origin/master --shortstat", returnStdout: true).trim()
346+
def diff = sh(script:"cd ${submodulePath} && git diff master origin/master --shortstat", returnStdout: true).trim()
288347
if (diff.isEmpty()) {
289348
echo "Skipping submodule without changes: ${submodulePath}"
290349
continue
@@ -303,6 +362,14 @@ pipeline {
303362
- ${aggregatorPreparationPR}
304363
""".stripIndent(), prBranch)
305364
}
365+
// Create maintenance branch preparation PR
366+
githubAPI.createPullRequest('eclipse-platform/eclipse.platform.releng.aggregator',
367+
"Move ${PREVIOUS_RELEASE_VERSION}-I builds to ${MAINTENANCE_BRANCH} branch", """\
368+
Prepare the maintenance branch for the ${PREVIOUS_RELEASE_VERSION} release.
369+
370+
This completes the preparation of the subsequent ${NEXT_RELEASE_VERSION} release:
371+
- ${aggregatorPreparationPR}
372+
""".stripIndent(),"prepare-${MAINTENANCE_BRANCH}", "${MAINTENANCE_BRANCH}")
306373
}
307374
}
308375
}

RELEASE.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,6 @@ The release is scheduled for 10AM EST. Typically the jobs are scheduled beforeha
131131
- 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.
132132

133133
#### **Maintenance Branches:**
134-
* **Maintenance Branch Creation:**
135-
- Create the branch from RC2 using the [create maintenance branch](https://ci.eclipse.org/releng/job/Releng/job/createMaintenanceBranch/) job in the Eclipse Platform Releng Jenkins.
136134
* **Update maintenance branch with release version**
137135
- 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/`
138136
- Functionally this means:

scripts/newReleasePrep.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,9 @@ TITLE="Preparation work for ${NEXT_STREAM} (${NEXT_TRAIN}) and open master for d
2424

2525
BODY="This preparation work involves the following tasks. For previous bug please refer to eclipse-platform/eclipse.platform.releng.aggregator#${PREV_ISSUE}.
2626
27-
- [ ] Create R${PREV_MAJOR}_${PREV_MINOR}_maintenance branch
28-
- [ ] Update R${PREV_MAJOR}_${PREV_MINOR}_maintenance branch with release version for ${PREV_MAJOR}.${PREV_MINOR}+ changes
2927
- [ ] Update JenkinsJobs for ${NEXT_STREAM}:
3028
- - [ ] Add ${NEXT_STREAM} to JobDSL.json to create new jobs
3129
- - [ ] Update "Brances" in JobDSL.json to move ${PREV_MAJOR}.${PREV_MINOR}-I builds to R${PREV_MAJOR}_${PREV_MINOR}_maintenance branch
32-
- - [ ] Add R${PREV_MAJOR}_${PREV_MINOR}_maintenance branch to parent pom and target sdk deployment jobs
3330
- - [ ] Update I-build triggers with dates for ${NEXT_STREAM} milestone
3431
- [ ] Splash Screen for ${NEXT_STREAM} (${NEXT_TRAIN})
3532
- [ ] Create ${NEXT_STREAM}-I-builds repo

0 commit comments

Comments
 (0)