Skip to content

Commit

Permalink
Push the changes to the coreos main repo
Browse files Browse the repository at this point in the history
  • Loading branch information
aaradhak committed Nov 25, 2024
1 parent dc58259 commit 7fa472c
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 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,22 @@ 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 the "coreos: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
""")

println("GitHub API response: ${response}")

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

0 comments on commit 7fa472c

Please sign in to comment.