From 273d9e9bf705d9f11c7faa6738c1035f0abb9e78 Mon Sep 17 00:00:00 2001 From: Michael Biarnes Kiefer Date: Fri, 4 Aug 2023 09:41:47 +0200 Subject: [PATCH] KOGITO-5386: added a new parameter for unique branch name --- .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.') } }