Skip to content

Commit e6cf309

Browse files
committed
[RelEng] Unify GH-Bot token access in promotion/preparation pipelines
This also fixes the PR creation in release promotions, because the previous approach to access the GitHub bot token was not working. It was introduced in: - eclipse-platform#3284
1 parent 8833772 commit e6cf309

File tree

3 files changed

+5
-16
lines changed

3 files changed

+5
-16
lines changed

JenkinsJobs/Releng/prepareNextDevCycle.jenkinsfile

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,6 @@ pipeline {
362362
}
363363
}
364364
stage('Create preparation Pull-Requests') {
365-
environment {
366-
GITHUB_BOT_TOKEN = credentials('github-bot-token')
367-
}
368365
steps {
369366
script {
370367
def prHeadline = "Prepare ${NEXT_RELEASE_VERSION} development"
@@ -410,9 +407,6 @@ pipeline {
410407
}
411408
}
412409
stage('Create Github milestones') {
413-
environment {
414-
GITHUB_BOT_TOKEN = credentials('github-bot-token')
415-
}
416410
steps {
417411
script {
418412
def organisations = [ 'eclipse-platform', 'eclipse-jdt', 'eclipse-pde', 'eclipse-equinox' ]

JenkinsJobs/Releng/promoteBuild.jenkinsfile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,7 @@ pipeline {
265265
git push --force ${pushURL} "updateMaintenance:refs/heads/update-${MAINTENANCE_BRANCH}"
266266
'''
267267
}
268-
// Create PRs agains the master and maintenance branch
269-
script { withEnv(['GITHUB_BOT_TOKEN=' + credentials('github-bot-token')]) {
268+
script { // Create PRs agains the master and maintenance branch
270269
def masterPR = githubAPI.createPullRequest('eclipse-platform/eclipse.platform.releng.aggregator',
271270
"Update previous release version to ${BUILD_MAJOR}.${BUILD_MINOR} GA across build scripts", """\
272271
Update the the `${MAINTENANCE_BRANCH}` branch with final ${BUILD_MAJOR}.${BUILD_MINOR} release version.
@@ -282,7 +281,7 @@ pipeline {
282281

283282
**This should not be submitted before ${BUILD_MAJOR}.${BUILD_MINOR} is finally released.**
284283
""".stripIndent(),"update-${MAINTENANCE_BRANCH}", "${MAINTENANCE_BRANCH}", /*skipExistingPR*/ true)
285-
}}
284+
}
286285
}
287286
}
288287
}
@@ -297,9 +296,6 @@ pipeline {
297296
}
298297
}
299298
stage('Update acknowledgements') {
300-
environment {
301-
GITHUB_BOT_TOKEN = credentials('github-bot-token')
302-
}
303299
steps {
304300
script {
305301
githubAPI.triggerWorkflow('eclipse-platform/www.eclipse.org-eclipse', 'generateAcknowledgements.yml', [ 'eclipse-version': "${BUILD_MAJOR}.${BUILD_MINOR}" ])

JenkinsJobs/shared/githubAPI.groovy

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,12 @@ def queryGithubAPI(String method, String endpoint, Map<String, Object> queryPara
7373
query += "-d '" + params + "'"
7474
}
7575
if (IS_DRY_RUN && !method.isEmpty()) {
76-
if (!env.GITHUB_BOT_TOKEN) {
77-
error 'Required GITHUB_BOT_TOKEN not set'
78-
}
7976
echo "Query (not send): ${query}"
8077
return null
8178
}
82-
def response = sh(script: query, returnStdout: true)
79+
def response = withCredentials([string(credentialsId: 'github-bot-token', variable: 'GITHUB_BOT_TOKEN')]) {
80+
return sh(script: query, returnStdout: true)
81+
}
8382
if (response == null || response.isEmpty()) {
8483
if (allowEmptyReponse) {
8584
return null

0 commit comments

Comments
 (0)