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.') } }