Skip to content

Commit 0ca0e41

Browse files
authored
Merge pull request #992 from aaradhak/jp
jobs/bump-jenkins-plugins: read plugins from 'main' branch
2 parents d914320 + 2c92d06 commit 0ca0e41

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

jobs/bump-jenkins-plugins.Jenkinsfile

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def getVersionFromPluginUrl(pluginUrl) {
3232
node {
3333
checkout scm: [
3434
$class: 'GitSCM',
35-
branches: [[name: "${pr_branch}"]],
35+
branches: [[name: "main"]],
3636
userRemoteConfigs: [[url: "https://github.com/${fork_repo}.git"]],
3737
extensions: [[$class: 'WipeWorkspace']]
3838
]
@@ -61,15 +61,10 @@ node {
6161
def plugins_lockfile = "jenkins/controller/plugins.txt"
6262

6363
stage("Read plugins.txt") {
64-
/* Clone the repository and switch to the '${pr_branch}' branch */
64+
/* Clone the repository and switch to the 'main' branch */
6565
shwrapCapture("""
66-
git clone --depth=1 --branch ${pr_branch} https://github.com/${fork_repo}.git
67-
cd fedora-coreos-pipeline
68-
git remote add upstream https://github.com/${repo}.git
69-
git fetch upstream
70-
git reset --hard upstream/main
66+
git clone --depth=1 --branch main https://github.com/${fork_repo}.git
7167
""")
72-
7368
/* Read the plugins from the lockfile */
7469
pluginslist = shwrapCapture("grep -v ^# ${plugins_lockfile}").split('\n')
7570
}
@@ -128,7 +123,7 @@ node {
128123
passwordVariable: 'GHTOKEN')]) {
129124
shwrap("""
130125
cd fedora-coreos-pipeline
131-
git push -f https://\${GHUSER}:\${GHTOKEN}@github.com/${fork_repo} ${pr_branch}
126+
git push -f https://\${GHUSER}:\${GHTOKEN}@github.com/${fork_repo} main:${pr_branch}
132127
curl -H "Authorization: token ${GHTOKEN}" -X POST -d '{ "title": "${message}", "head": "${pr_branch}", "base": "main" }' https://api.github.com/repos/${fork_repo}/pulls
133128
""")
134129
}
@@ -139,13 +134,15 @@ node {
139134
currentBuild.result = 'FAILURE'
140135
throw e
141136
} finally {
137+
def message = "bump-jenkins-plugins #${env.BUILD_NUMBER} <${env.BUILD_URL}|:jenkins:> <${env.RUN_DISPLAY_URL}|:ocean:>"
142138
if (currentBuild.result == 'SUCCESS') {
143139
currentBuild.description = "bump-jenkins-plugins ⚡"
140+
message = ":sparkles: ${message}"
144141
} else {
145142
currentBuild.description = "bump-jenkins-plugins ❌"
146143
}
147144
if (currentBuild.result != 'SUCCESS') {
148-
message = "bump-jenkins-plugins #${env.BUILD_NUMBER} <${env.BUILD_URL}|:jenkins:> <${env.RUN_DISPLAY_URL}|:ocean:>"
145+
message = ":fire: ${message}"
149146
pipeutils.trySlackSend(message: message)
150147
}
151148
}

0 commit comments

Comments
 (0)