From 1a238b65f594490fe14ae1f1aa868773dd90a68e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Biarn=C3=A9s=20Kiefer?= Date: Tue, 8 Aug 2023 15:14:38 +0200 Subject: [PATCH] KOGITO-5386: added a new parameter for unique branch name (#1504) --- .ci/jenkins/Jenkinsfile.deploy | 3 +++ .ci/jenkins/dsl/jobs.groovy | 1 + .ci/jenkins/scripts/helper.groovy | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) 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() {