diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy index 5483c1486..e5022f480 100644 --- a/.ci/jenkins/Jenkinsfile.deploy +++ b/.ci/jenkins/Jenkinsfile.deploy @@ -87,6 +87,9 @@ pipeline { } steps { script { + if (githubscm.isBranchExist('origin', helper.getPRBranch())) { + githubscm.removeRemoteBranch('origin', helper.getPRBranch()) + } githubscm.createBranch(helper.getPRBranch()) } } diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy index 0abcf9471..bde7284d2 100644 --- a/.ci/jenkins/dsl/jobs.groovy +++ b/.ci/jenkins/dsl/jobs.groovy @@ -148,6 +148,7 @@ void setupDeployJob(JobType jobType, String envName = '') { stringParam('IMAGE_NAMESPACE', "${CLOUD_IMAGE_NAMESPACE}", 'Image namespace to use to deploy images') stringParam('IMAGE_NAME_SUFFIX', '', 'Image name suffix to use to deploy images. In case you need to change the final image name, you can add a suffix to it.') stringParam('IMAGE_TAG', '', 'Image tag to use to deploy images') + stringParam('KOGITO_PR_BRANCH', '', 'PR branch name') booleanParam('DEPLOY_WITH_LATEST_TAG', false, 'Set to true if you want the deployed image to also be with the `latest` tag') booleanParam('SKIP_DEPLOY', false, 'In case you don\'t want to deploy the final image.') diff --git a/.ci/jenkins/scripts/helper.groovy b/.ci/jenkins/scripts/helper.groovy index 657f62455..196bf4160 100644 --- a/.ci/jenkins/scripts/helper.groovy +++ b/.ci/jenkins/scripts/helper.groovy @@ -259,7 +259,7 @@ String getGitAuthorCredsID() { } String getPRBranch() { - return "${getProjectVersion()}-${env.PR_BRANCH_HASH}" + return params.KOGITO_PR_BRANCH } String getProjectVersion() {