From bb29a0cd6adb7dcaaa7ed0a85a20aedc3bc24d22 Mon Sep 17 00:00:00 2001 From: Michael Biarnes Kiefer Date: Fri, 4 Aug 2023 10:04:29 +0200 Subject: [PATCH] KOGITO-5386: added a new parameter for unique branch name --- .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 07c184dae..1b87788d6 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() {