Skip to content

Commit

Permalink
KOGITO-8497 Add JIRA number to update quarkus PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
radtriste committed Jan 17, 2023
1 parent 71b4241 commit 342db3b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 14 deletions.
19 changes: 16 additions & 3 deletions .ci/jenkins/Jenkinsfile.ecosystem.update-quarkus-all
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ failingRepos = []

pipeline {
agent {
label 'kie-rhel7 && !built-in'
label 'kie-rhel8 && !built-in'
}

// parameters {
Expand Down Expand Up @@ -50,7 +50,7 @@ pipeline {
}

if (githubscm.isThereAnyChanges()) {
String commitMsg = "[${SEED_BRANCH_CONFIG_FILE_GIT_BRANCH}] Bump quarkus version to ${getNewVersion()}"
String commitMsg = "[${SEED_BRANCH_CONFIG_FILE_GIT_BRANCH}] ${getJiraNumber() ? "[${getJiraNumber()}] " : ''}Bump quarkus version to ${getNewVersion()}"
githubscm.commitChanges(commitMsg)
githubscm.pushObject('origin', prBranch, "${SEED_BRANCH_CONFIG_FILE_GIT_AUTHOR_CREDS_ID}")

Expand Down Expand Up @@ -151,6 +151,7 @@ void launchUpdateQuarkusJob(String repo) {
List jobParams = []
jobParams.add(stringParam(name: 'NEW_VERSION', value: getNewVersion()))
jobParams.add(stringParam(name: 'PR_BRANCH', value: params.PR_BRANCH))
jobParams.add(stringParam(name: 'JIRA_NUMBER', value: params.JIRA_NUMBER))

echo "Build ./${jobName} with parameters ${jobParams}"
def job = build(job: "./${jobName}", parameters: jobParams, wait: true, propagate: false)
Expand Down Expand Up @@ -196,6 +197,10 @@ String getSeedPRBranch(String branch) {
return params.PR_BRANCH ? "${params.PR_BRANCH}-seed" : "bump-seed-${branch}-quarkus-${getNewVersion()}"
}

String getJiraNumber() {
return params.JIRA_NUMBER
}

void updateYaml(String filePath, Closure updateClosure) {
def yamlData = readYaml(file: filePath)
updateClosure(yamlData)
Expand All @@ -221,8 +226,16 @@ void finalizePR(String prLink) {
echo "currentBodyjson = ${currentBodyJson}"
String newBody = """
${readJSON(text: currentBodyJson).body}

${getPRLinksSummary()}
"""
if(getJiraNumber()) {
newBody = """
https://issues.redhat.com/browse/${getJiraNumber()}

${newBody}
"""
}
echo "new body = ${newBody}"
writeFile(file: 'prBody', text: newBody)
sh "gh pr edit ${prLink} --body-file prBody ${getReviewers().collect { "--add-reviewer ${it}" }.join(' ')}"
Expand All @@ -235,4 +248,4 @@ String getPRLinksSummary() {

List getReviewers() {
return env.REVIEWERS?.split(',')
}
}
18 changes: 9 additions & 9 deletions .ci/jenkins/Jenkinsfile.tools.update-dependency-version
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ pipelineProperties = [:]

pipeline {
agent {
label 'kie-rhel7 && !built-in'
label 'kie-rhel8 && !built-in'
}

tools {
maven env.BUILD_MAVEN_TOOL
jdk env.BUILD_JDK_TOOL
Expand Down Expand Up @@ -148,7 +148,7 @@ pipeline {
script {
dir(getRepoName()) {
if (githubscm.isThereAnyChanges()) {
String commitMsg = "[${getBuildBranch()}] Bump ${getDependencyName()} version to ${getNewVersion()}"
String commitMsg = "[${getBuildBranch()}] ${getJiraNumber() ? "[${getJiraNumber()}] " : ''}Bump ${getDependencyName()} version to ${getNewVersion()}"
githubscm.commitChanges(commitMsg)
githubscm.pushObject('origin', getPRBranch(), getGitAuthorCredsId())

Expand Down Expand Up @@ -214,23 +214,23 @@ String getRepoName() {
}

List getMavenModules() {
return env.MAVEN_MODULES ? readJSON(text: env.MAVEN_MODULES) : []
return env.MAVEN_MODULES ? readJSON(text: env.MAVEN_MODULES) : []
}

List getMavenCompareDepsRemotePoms() {
return env.MAVEN_COMPARE_DEPS_REMOTE_POMS ? readJSON(text: env.MAVEN_COMPARE_DEPS_REMOTE_POMS) : []
return env.MAVEN_COMPARE_DEPS_REMOTE_POMS ? readJSON(text: env.MAVEN_COMPARE_DEPS_REMOTE_POMS) : []
}

List getMavenProperties() {
return env.MAVEN_PROPERTIES ? readJSON(text: env.MAVEN_PROPERTIES) : []
return env.MAVEN_PROPERTIES ? readJSON(text: env.MAVEN_PROPERTIES) : []
}

List getGradleRegex() {
return env.GRADLE_REGEX ? readJSON(text: env.GRADLE_REGEX) : []
return env.GRADLE_REGEX ? readJSON(text: env.GRADLE_REGEX) : []
}

List getFilepathReplaceRegex() {
return env.FILEPATH_REPLACE_REGEX ? readJSON(text: env.FILEPATH_REPLACE_REGEX) : [:]
return env.FILEPATH_REPLACE_REGEX ? readJSON(text: env.FILEPATH_REPLACE_REGEX) : [:]
}

List getScriptCalls() {
Expand Down Expand Up @@ -259,4 +259,4 @@ void setPipelinePropertyIfNeeded(String key, def value) {
if (value) {
pipelineProperties[key] = value
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ class KogitoJobUtils {
parameters {
stringParam('NEW_VERSION', '', 'Which version to set ?')
stringParam('PR_BRANCH', '', '(Optional) Which PR branch name to use ? If none given, a name will be generated automatically.')
stringParam('JIRA_NUMBER', '', '(Optional) Is there any issues.redhat.com JIRA associated to that change ? .')
}
}
return job
Expand Down Expand Up @@ -174,6 +175,7 @@ class KogitoJobUtils {
parameters {
stringParam('NEW_VERSION', '', 'Which version to set ?')
stringParam('PR_BRANCH', '', '(Optional) Which PR branch name to use ? If none given, a name will be generated automatically.')
stringParam('JIRA_NUMBER', '', '(Optional) Is there any issues.redhat.com JIRA associated to that change ? .')
}
}
return job
Expand Down Expand Up @@ -221,7 +223,7 @@ class KogitoJobUtils {
*/
@Deprecated
static List createAllEnvsPerRepoPRJobs(def script, Closure jobsRepoConfigGetter, Closure defaultParamsGetter = JobParamsUtils.DEFAULT_PARAMS_GETTER) {
PrintUtils.deprecated(script, "createAllEnvsPerRepoPRJobs", 'createAllEnvironmentsPerRepoPRJobs')
PrintUtils.deprecated(script, 'createAllEnvsPerRepoPRJobs', 'createAllEnvironmentsPerRepoPRJobs')
return createPerEnvPerRepoPRJobs(script, Environment.getActiveEnvironments(script), jobsRepoConfigGetter, defaultParamsGetter)
}

Expand All @@ -248,7 +250,7 @@ class KogitoJobUtils {
}

static List createAllEnvironmentsPerRepoPRJobs(def script, Closure jobsRepoConfigGetter, Closure defaultParamsGetter = JobParamsUtils.DEFAULT_PARAMS_GETTER) {
PrintUtils.debug(script, "createAllEnvironmentsPerRepoPRJobs")
PrintUtils.debug(script, 'createAllEnvironmentsPerRepoPRJobs')
return createPerEnvironmentPerRepoPRJobs(script, EnvUtils.getAllAutoGeneratedEnvironments(script), jobsRepoConfigGetter, defaultParamsGetter)
}

Expand Down

0 comments on commit 342db3b

Please sign in to comment.