From 217642d1e8ec761b3784a515b569ec132aaa44f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Biarn=C3=A9s=20Kiefer?= Date: Tue, 8 Aug 2023 15:14:36 +0200 Subject: [PATCH] KOGITO-5386: added a new parameter for unique branch name (#1666) --- .ci/jenkins/Jenkinsfile.deploy | 7 ++++--- .ci/jenkins/dsl/jobs.groovy | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy index 214146399..9f694a471 100644 --- a/.ci/jenkins/Jenkinsfile.deploy +++ b/.ci/jenkins/Jenkinsfile.deploy @@ -26,8 +26,6 @@ pipeline { environment { KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") - PR_BRANCH_HASH = "${util.generateHash(10)}" - OPENSHIFT_REGISTRY = credentials('OPENSHIFT_REGISTRY') } @@ -67,6 +65,9 @@ pipeline { } steps { script { + if (githubscm.isBranchExist('origin',getPRBranch())) { + githubscm.removeRemoteBranch('origin', getPRBranch()) + } githubscm.createBranch(getPRBranch()) } } @@ -395,7 +396,7 @@ String getGitAuthorCredsID() { } String getPRBranch() { - return "${getProjectVersion() ?: getBuildBranch()}-${env.PR_BRANCH_HASH}" + return params.KOGITO_PR_BRANCH } String getProjectVersion() { diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy index 590a0368d..c38675208 100644 --- a/.ci/jenkins/dsl/jobs.groovy +++ b/.ci/jenkins/dsl/jobs.groovy @@ -171,6 +171,7 @@ void setupDeployJob(JobType jobType, String envName = '') { stringParam('QUARKUS_PLATFORM_VERSION', '', 'Allow to override the Quarkus Platform version') } + 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.') } }