From 6623ccb3e7ca10d23371f60057f94fa1d01b69e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Biarn=C3=A9s=20Kiefer?= Date: Tue, 8 Aug 2023 15:13:55 +0200 Subject: [PATCH] KOGITO-5386: added a new parameter for unique branch name (#1820) --- .ci/jenkins/Jenkinsfile.deploy | 5 ++++- .ci/jenkins/dsl/jobs.groovy | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy index a9e4f41ed6..ae4e75a976 100644 --- a/.ci/jenkins/Jenkinsfile.deploy +++ b/.ci/jenkins/Jenkinsfile.deploy @@ -80,6 +80,9 @@ pipeline { } steps { dir(getRepoName()) { + if (githubscm.isBranchExist('origin',getPRBranch())) { + githubscm.removeRemoteBranch('origin', getPRBranch()) + } githubscm.createBranch(getPRBranch()) } } @@ -265,7 +268,7 @@ String getProjectVersion() { } String getPRBranch() { - return "${getProjectVersion()}-${env.PR_BRANCH_HASH}" + return params.KOGITO_PR_BRANCH } void setDeployPropertyIfNeeded(String key, def value) { diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy index 8f343d1ba3..19c640537c 100644 --- a/.ci/jenkins/dsl/jobs.groovy +++ b/.ci/jenkins/dsl/jobs.groovy @@ -231,6 +231,7 @@ void setupDeployJob(JobType jobType, String envName = '') { 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('KOGITO_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.') }