From c3e750f8781b6401175e8c640261606f3befe3c2 Mon Sep 17 00:00:00 2001 From: Michael Biarnes Kiefer Date: Thu, 3 Aug 2023 15:07:31 +0200 Subject: [PATCH] KOGITO-5386: added a new parameter for unique branch name --- .ci/jenkins/Jenkinsfile.deploy | 5 ++++- .ci/jenkins/dsl/jobs.groovy | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy index 879e2a7af0f..36ccfbfd9ce 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()) } } @@ -278,7 +281,7 @@ String getDroolsVersion() { } String getPRBranch() { - return "${getProjectVersion()}-${env.PR_BRANCH_HASH}" + return params.KOGITO_RELEASE_BRANCH } void setDeployPropertyIfNeeded(String key, def value) { diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy index 3cbc6cde6e1..b516861dc73 100644 --- a/.ci/jenkins/dsl/jobs.groovy +++ b/.ci/jenkins/dsl/jobs.groovy @@ -181,7 +181,7 @@ void setupDeployJob(JobType jobType, String envName = '') { AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", GITHUB_TOKEN_CREDS_ID: "${GIT_AUTHOR_TOKEN_CREDENTIALS_ID}", - + MAVEN_DEPENDENCIES_REPOSITORY: "${MAVEN_ARTIFACTS_REPOSITORY}", MAVEN_DEPLOY_REPOSITORY: "${MAVEN_ARTIFACTS_UPLOAD_REPOSITORY_URL}", MAVEN_REPO_CREDS_ID: "${MAVEN_ARTIFACTS_UPLOAD_REPOSITORY_CREDS_ID}", @@ -212,6 +212,7 @@ void setupDeployJob(JobType jobType, String envName = '') { booleanParam('CREATE_PR', false, 'Should we create a PR with the changes ?') stringParam('PROJECT_VERSION', '', 'Set the project version') stringParam('DROOLS_VERSION', '', 'Drools version to set') + stringParam('KOGITO_RELEASE_BRANCH', '', 'release branch name') booleanParam('SEND_NOTIFICATION', false, 'In case you want the pipeline to send a notification on CI channel for this run.') }