Skip to content

Commit 5de62f7

Browse files
committed
[RelEng] Introduce dry-run parameter in promotion pipeline
1 parent 1f9fdba commit 5de62f7

File tree

3 files changed

+40
-13
lines changed

3 files changed

+40
-13
lines changed

JenkinsJobs/Releng/FOLDER.groovy

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ pipelineJob('Releng/prepareNextDevCycle'){
7575
displayName('Prepare Next Development Cycle')
7676
description('Perform all steps to prepare the next development cycle of Eclipse.')
7777
parameters {
78-
booleanParam('DRY_RUN', true, 'If enabled, the final publication of all changes is skipped. Useful for debugging and to very that the pipeline behaves as intended.')
78+
booleanParam('DRY_RUN', true, '''\
79+
If enabled, the final publication of all changes is skipped respectivly all changes at the download-server happen in a 'try-out' area at https://download.eclipse.org/eclipse/try-outs/.
80+
This area is cleaned on each dry-run and should be cleaned after a try-out session is completed.
81+
Useful for debugging and to very that the pipeline behaves as intended.
82+
''')
7983
stringParam('NEXT_RELEASE_VERSION', null, 'Version of the release to prepare, for example: 4.37')
8084
stringParam('PREVIOUS_RELEASE_CANDIDATE_ID', null, 'Id of the current release-candiate for the previous release, for example: S-4.36RC2-202505281830')
8185
stringParam('M1_DATE', null, 'Milestone 1 end date in the format yyyy-mm-dd, for example: 2025-07-04')
@@ -106,6 +110,7 @@ But also, allows the sites and repositories to be examined for correctness befor
106110
The second (deferred) step that makes things visible works, in part, based on some output of this first step. Hence, they must "share a workspace".
107111
''')
108112
parameters {
113+
booleanParam('DRY_RUN', true, 'If enabled, the final publication of all changes is skipped. Useful for debugging and to very that the pipeline behaves as intended.')
109114
stringParam('DROP_ID', null, '''\
110115
The name (or, build id) of the build to promote. Typically would be a value such as 'I20250714-1800'.
111116
It must match the name of the build on the build machine.

JenkinsJobs/Releng/promoteBuild.jenkinsfile

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pipeline {
1111
environment {
1212
// Download Server locations (would very seldom change)
1313
EP_ROOT = '/home/data/httpd/download.eclipse.org'
14+
DRY_RUN_PREFIX = "${params.DRY_RUN ? 'eclipse/try-outs/' : ''}"
1415
}
1516
tools {
1617
jdk 'temurin-jdk21-latest'
@@ -20,6 +21,7 @@ pipeline {
2021
stage('Process input') {
2122
steps {
2223
script {
24+
echo "DRY_RUN: ${DRY_RUN}"
2325
env.DROP_ID = readParameter('DROP_ID')
2426
if (!"${DROP_ID}") {
2527
error("Parameter 'DROP_ID' is not specified")
@@ -71,6 +73,12 @@ pipeline {
7173
} else if (env.SIGNOFF_BUG ==~ '\\d+') {
7274
assignEnvVariable('SIGNOFF_BUG', "https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/${SIGNOFF_BUG}")
7375
}
76+
77+
if (params.DRY_RUN) { // Clear 'try-outs' area on the starge server
78+
sshagent(['projects-storage.eclipse.org-bot-ssh']) {
79+
sh 'ssh [email protected] "rm -rf ${EP_ROOT}/eclipse/try-outs/"'
80+
}
81+
}
7482
}
7583
}
7684
}
@@ -81,6 +89,7 @@ pipeline {
8189
script { // Always load the script from the very same state this pipeline is loaded (to ensure consistency)
8290
utilities = load "JenkinsJobs/shared/utilities.groovy"
8391
githubAPI = load "JenkinsJobs/shared/githubAPI.groovy"
92+
githubAPI.setDryRun(params.DRY_RUN)
8493
}
8594
sh '''#!/bin/bash -xe
8695
git branch --force master HEAD
@@ -143,9 +152,12 @@ pipeline {
143152
# Change to SSH, if the configured URL uses HTTPS (we can only push with SSH)
144153
pushURL=$(echo $pushURL|sed --expression 's|https://github.com/|[email protected]:|')
145154
fi
155+
if [[ ${DRY_RUN} == 'true' ]]; then
156+
dryRunFlag='--dry-run'
157+
fi
146158
# Enforce the (re-)creation of the tag in case of a very late respin
147159
git tag --force -a -m "${SIGNOFF_BUG}" ${TAG} HEAD
148-
git push --force --verbose ${pushURL} tag ${TAG}
160+
git push --force --verbose ${dryRunFlag} ${pushURL} tag ${TAG}
149161
}
150162
tagBuild
151163
export -f tagBuild
@@ -164,7 +176,8 @@ pipeline {
164176
sshagent(['projects-storage.eclipse.org-bot-ssh']) {
165177
sh '''#!/bin/bash -xe
166178
sourceRepo="eclipse/updates/${BUILD_MAJOR}.${BUILD_MINOR}-I-builds/${REPO_ID}"
167-
targetRepo="eclipse/updates/${BUILD_MAJOR}.${BUILD_MINOR}/${DL_DROP_ID}"
179+
targetRepo="${DRY_RUN_PREFIX}eclipse/updates/${BUILD_MAJOR}.${BUILD_MINOR}/${DL_DROP_ID}"
180+
ssh [email protected] mkdir -p "${EP_ROOT}/${targetRepo}/.."
168181
ssh [email protected] cp -r "${EP_ROOT}/${sourceRepo}/." "${EP_ROOT}/${targetRepo}"
169182

170183
MIRRORS_URL="https://www.eclipse.org/downloads/download.php?file=/${targetRepo}"
@@ -257,9 +270,11 @@ pipeline {
257270
if [[ "$pushURL" == http* ]]; then
258271
pushURL=$(echo $pushURL|sed --expression 's|https://github.com/|[email protected]:|')
259272
fi
260-
261-
git push --force ${pushURL} "master:refs/heads/update-build-to-R${BUILD_MAJOR}.${BUILD_MINOR}"
262-
git push --force ${pushURL} "updateMaintenance:refs/heads/update-${MAINTENANCE_BRANCH}"
273+
if [[ ${DRY_RUN} == 'true' ]]; then
274+
dryRunFlag='--dry-run'
275+
fi
276+
git push --force ${dryRunFlag} ${pushURL} "master:refs/heads/update-build-to-R${BUILD_MAJOR}.${BUILD_MINOR}"
277+
git push --force ${dryRunFlag} ${pushURL} "updateMaintenance:refs/heads/update-${MAINTENANCE_BRANCH}"
263278
'''
264279
}
265280
script { // Create PRs agains the master and maintenance branch
@@ -284,7 +299,10 @@ pipeline {
284299
}
285300
stage('Stage to Maven-Central') {
286301
when {
287-
environment name: 'DL_TYPE', value: 'R'
302+
allOf {
303+
environment name: 'DL_TYPE', value: 'R'
304+
not { expression { params.DRY_RUN } }
305+
}
288306
}
289307
steps {
290308
build job: 'Releng/deployToMaven', wait: true, propagate: true, parameters: [
@@ -293,16 +311,20 @@ pipeline {
293311
}
294312
}
295313
stage('Update acknowledgements') {
314+
when {
315+
not { expression { params.DRY_RUN } }
316+
}
296317
steps {
297318
script {
298319
githubAPI.triggerWorkflow('eclipse-platform/www.eclipse.org-eclipse', 'generateAcknowledgements.yml', [ 'eclipse-version': "${BUILD_MAJOR}.${BUILD_MINOR}" ])
299320
}
300321
}
301322
}
302-
stage('Trigger publication') {
323+
stage('Publish promoted build') {
303324
when {
304-
not {
305-
environment name: 'DL_TYPE', value: 'R'
325+
allOf {
326+
not { environment name: 'DL_TYPE', value: 'R' }
327+
not { expression { params.DRY_RUN } }
306328
}
307329
}
308330
steps {
@@ -321,7 +343,7 @@ pipeline {
321343

322344
def renameBuildDrop(String baseDropPath, String oldDropID, String oldBuildLabel, String newDropID, String newBuildLabel, Closure extraTasks=null) {
323345
def sourcePath="${EP_ROOT}/${baseDropPath}/${oldDropID}"
324-
def targetPath="${EP_ROOT}/${baseDropPath}/${newDropID}"
346+
def targetPath="${EP_ROOT}/${DRY_RUN_PREFIX}${baseDropPath}/${newDropID}"
325347

326348
sh """#!/bin/bash -xe
327349

@@ -386,7 +408,7 @@ EOF
386408
# Copy locally modified files to the download server
387409
scp -r . [email protected]:${targetPath}/
388410

389-
if [[ '${DL_TYPE}' == 'R' ]]; then
411+
if [[ '${DL_TYPE}' == 'R' ]] && [[ '${DRY_RUN}' == 'false' ]]; then
390412
echo 'Creating archive'
391413
ssh [email protected] cp -r '${targetPath}' /home/data/httpd/archive.eclipse.org/${baseDropPath}/
392414
fi

JenkinsJobs/shared/githubAPI.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
@groovy.transform.Field
3-
def boolean IS_DRY_RUN = false
3+
def boolean IS_DRY_RUN = true
44

55
def setDryRun(boolean isDryRun) {
66
IS_DRY_RUN = isDryRun

0 commit comments

Comments
 (0)