From 577b72405c245c284648d593abc6db342f09bfe2 Mon Sep 17 00:00:00 2001 From: Michael Biarnes Kiefer Date: Wed, 9 Aug 2023 09:35:22 +0200 Subject: [PATCH] KOGITO-5386: added a new parameter for unique branch name --- .ci/jenkins/Jenkinsfile.deploy | 5 ++++- .ci/jenkins/dsl/jobs.groovy | 5 +++-- .ci/jenkins/project/Jenkinsfile.release | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy index 28a80019059..d0ca543160f 100644 --- a/.ci/jenkins/Jenkinsfile.deploy +++ b/.ci/jenkins/Jenkinsfile.deploy @@ -82,6 +82,9 @@ pipeline { steps { script { dir(getRepoName()) { + if (githubscm.isBranchExist('origin',getPRBranch())) { + githubscm.removeRemoteBranch('origin', getPRBranch()) + } githubscm.createBranch(getPRBranch()) } } @@ -241,7 +244,7 @@ String getProjectVersion() { } String getPRBranch() { - return "${getProjectVersion()}-${env.PR_BRANCH_HASH}" + return params.DROOLS_PR_BRANCH } String getGitAuthorCredsID() { diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy index cabb8fb2d33..839ada25915 100644 --- a/.ci/jenkins/dsl/jobs.groovy +++ b/.ci/jenkins/dsl/jobs.groovy @@ -95,7 +95,7 @@ void setupProjectReleaseJob() { DEFAULT_STAGING_REPOSITORY: "${MAVEN_NEXUS_STAGING_PROFILE_URL}", ARTIFACTS_REPOSITORY: "${MAVEN_ARTIFACTS_REPOSITORY}", - + DROOLS_STREAM: getDroolsStream(), ]) KogitoJobTemplate.createPipelineJob(this, jobParams)?.with { @@ -118,7 +118,7 @@ void setupProjectPostReleaseJob() { GIT_BRANCH_NAME: "${GIT_BRANCH}", GIT_AUTHOR: "${GIT_AUTHOR_NAME}", AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", - + DROOLS_STREAM: getDroolsStream(), ]) KogitoJobTemplate.createPipelineJob(this, jobParams)?.with { @@ -310,6 +310,7 @@ void setupDeployJob(JobType jobType) { booleanParam('CREATE_PR', false, 'Should we create a PR with the changes ?') stringParam('PROJECT_VERSION', '', 'Optional if not RELEASE. If RELEASE, cannot be empty.') + stringParam('DROOLS_PR_BRANCH', '', 'PR branch name') booleanParam('SEND_NOTIFICATION', false, 'In case you want the pipeline to send a notification on CI channel for this run.') } diff --git a/.ci/jenkins/project/Jenkinsfile.release b/.ci/jenkins/project/Jenkinsfile.release index c86d1e0db84..7d70326f60a 100644 --- a/.ci/jenkins/project/Jenkinsfile.release +++ b/.ci/jenkins/project/Jenkinsfile.release @@ -281,6 +281,7 @@ List getDefaultBuildParams() { List buildParams = [] addDisplayNameParam(buildParams, getDisplayName(getDroolsVersion())) addStringParam(buildParams, 'PROJECT_VERSION', getDroolsVersion()) + addStringParam(buildParams, 'DROOLS_PR_BRANCH', "drools-${getDroolsVersion()}") return buildParams }