Skip to content

Commit

Permalink
jobs/bump-jenkins-plugins: Create PR against f-c-c main
Browse files Browse the repository at this point in the history
The bump-jenkins-plugins job PR was getting opened against the
main branch of coreosbot-releng's fedora-coreos-config. We are making
changes to open the PR against the 'main' branch of 'coreos'
fedora-coreos-config.
  • Loading branch information
aaradhak committed Nov 26, 2024
1 parent dc58259 commit 61d4308
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions jobs/bump-jenkins-plugins.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def getVersionFromPluginUrl(pluginUrl) {
def parts = pluginUrl.split("/")
def pluginVersion
if (parts.size() >= 4) {
def groupId = parts[-3]
pluginVersion = parts[-2]
} else {
error("Unable to extract plugin version from the URL.")
Expand Down Expand Up @@ -121,11 +120,20 @@ node {
withCredentials([usernamePassword(credentialsId: botCreds,
usernameVariable: 'GHUSER',
passwordVariable: 'GHTOKEN')]) {
shwrap("""
cd fedora-coreos-pipeline
git push -f https://\${GHUSER}:\${GHTOKEN}@github.com/${fork_repo} main:${pr_branch}
curl -H "Authorization: token ${GHTOKEN}" -X POST -d '{ "title": "${message}", "head": "${pr_branch}", "base": "main" }' https://api.github.com/repos/${fork_repo}/pulls
""")
// Push to the forked repo
shwrap("""
cd fedora-coreos-pipeline
git push -f https://\${GHUSER}:\${GHTOKEN}@github.com/${fork_repo} main:${pr_branch}
""")

// Create a PR against "coreos: fedora-coreos-pipeline:main" repo
def response = shwrapCapture("""
curl -H "Authorization: token ${GHTOKEN}" -X POST -d '{ "title": "${message}", "head": "coreosbot-releng:${pr_branch}", "base": "main" }' https://api.github.com/repos/${repo}/pulls --fail
""")

if (response.contains("\"message\": \"Validation Failed\"")) {
error("GitHub API request failed: ${response}")
}
}
}
}
Expand Down

0 comments on commit 61d4308

Please sign in to comment.