diff --git a/job-dsls/jobs/prod/prod_cron_meta_nightly_pipeline.groovy b/job-dsls/jobs/prod/prod_cron_meta_nightly_pipeline.groovy index 05a81ecf..5e1a7f0b 100644 --- a/job-dsls/jobs/prod/prod_cron_meta_nightly_pipeline.groovy +++ b/job-dsls/jobs/prod/prod_cron_meta_nightly_pipeline.groovy @@ -9,26 +9,6 @@ def javadk=Constants.JDK_TOOL def AGENT_LABEL="kie-rhel && kie-mem512m" def NEXT_PRODUCT_VERSION=Constants.NEXT_PROD_VERSION -def NEXT_PRODUCT_BRANCH='7.67.x' -def NEXT_PRODUCT_CONFIG_BRANCH="rhba/${NEXT_PRODUCT_BRANCH}" -// Use again after nightly builds from main branch again -// def NEXT_RHBA_VERSION_PREFIX=Constants.RHBA_VERSION_PREFIX -def NEXT_RHBA_VERSION_PREFIX='7.67.1.redhat-' - -def KOGITO_NEXT_PRODUCT_VERSION='1.13.0' -def KOGITO_NEXT_PRODUCT_BRANCH='1.13.x' -def KOGITO_NEXT_PRODUCT_CONFIG_BRANCH="kogito/${KOGITO_NEXT_PRODUCT_BRANCH}" - -def OPTAPLANNER_NEXT_PRODUCT_VERSION='8.13.0' - -def NEXT_BLUE_PRODUCT_VERSION=Constants.BAMOE_NEXT_PROD_VERSION -def NEXT_BLUE_PRODUCT_BRANCH='7.67.x-blue' -def NEXT_BLUE_PRODUCT_CONFIG_BRANCH="bamoe/7.67.x-blue" -def NEXT_BLUE_RHBA_VERSION_PREFIX='7.67.2.redhat-' - -def KOGITO_BLUE_NEXT_PRODUCT_VERSION='1.13.2.blue' -def KOGITO_BLUE_NEXT_PRODUCT_BRANCH='1.13.x-blue' -def KOGITO_BLUE_NEXT_PRODUCT_CONFIG_BRANCH="kogito/1.13.x-blue" def SERVERLESS_LOGIC_NEXT_PRODUCT_VERSION='999.0.0' def SERVERLESS_LOGIC_KOGITO_NEXT_PRODUCT_VERSION=SERVERLESS_LOGIC_NEXT_PRODUCT_VERSION @@ -42,14 +22,6 @@ def SERVERLESS_LOGIC_NEXT_PRODUCT_CONFIG_BRANCH="master" // def SERVERLESS_LOGIC_CURRENT_PRODUCT_BRANCH='9.99.x-prod' // def SERVERLESS_LOGIC_CURRENT_PRODUCT_CONFIG_BRANCH="openshift-serverless-logic/9.99.x" -// def RHBOP_NEXT_PRODUCT_BRANCH='main' -// def RHBOP_NEXT_PRODUCT_CONFIG_BRANCH='master' - -def RHBOP_CURRENT_PRODUCT_VERSION='8.38.0' -def RHBOP_CURRENT_PRODUCT_BRANCH='8.38.x-prod' -def RHBOP_CURRENT_PRODUCT_CONFIG_BRANCH='rhbop/8.38.x' -def RHBOP_CURRENT_DROOLS_VERSION='8.29.0' - // Should be uncommented and used with kogitoWithSpecDroolsNightlyStage once Next is set for RHPAM 7.14.0 (or main) // def DROOLS_NEXT_PRODUCT_VERSION='8.13.0' @@ -76,23 +48,10 @@ pipeline{ // IMPORTANT: In case you trigger a new branch here, please create the same branch on build-configuration project stages { - ${rhbaNightlyStage(NEXT_PRODUCT_VERSION, NEXT_PRODUCT_BRANCH, NEXT_PRODUCT_CONFIG_BRANCH)} - ${kogitoNightlyStage(KOGITO_NEXT_PRODUCT_VERSION, KOGITO_NEXT_PRODUCT_BRANCH, OPTAPLANNER_NEXT_PRODUCT_VERSION, NEXT_PRODUCT_VERSION, NEXT_RHBA_VERSION_PREFIX, KOGITO_NEXT_PRODUCT_CONFIG_BRANCH)} - - // "current" prod nightlies removed, can be found in git history - - // blue - ${rhbaNightlyStage(NEXT_BLUE_PRODUCT_VERSION, NEXT_BLUE_PRODUCT_BRANCH, NEXT_BLUE_PRODUCT_CONFIG_BRANCH)} - ${kogitoNightlyStage(KOGITO_BLUE_NEXT_PRODUCT_VERSION, KOGITO_BLUE_NEXT_PRODUCT_BRANCH, null, NEXT_BLUE_PRODUCT_VERSION, NEXT_BLUE_RHBA_VERSION_PREFIX, KOGITO_BLUE_NEXT_PRODUCT_CONFIG_BRANCH)} - // Openshift Serverless Logic //{serverlessLogicNightlyStage(SERVERLESS_LOGIC_CURRENT_PRODUCT_BRANCH, SERVERLESS_LOGIC_CURRENT_PRODUCT_CONFIG_BRANCH, SERVERLESS_LOGIC_CURRENT_PRODUCT_VERSION, SERVERLESS_LOGIC_KOGITO_CURRENT_PRODUCT_VERSION, SERVERLESS_LOGIC_DROOLS_CURRENT_PRODUCT_VERSION)} ${serverlessLogicNightlyStage(SERVERLESS_LOGIC_NEXT_PRODUCT_BRANCH, SERVERLESS_LOGIC_NEXT_PRODUCT_CONFIG_BRANCH, SERVERLESS_LOGIC_NEXT_PRODUCT_VERSION, SERVERLESS_LOGIC_KOGITO_NEXT_PRODUCT_VERSION, SERVERLESS_LOGIC_DROOLS_NEXT_PRODUCT_VERSION)} - // RHBOP - //{rhbopNightlyStage(RHBOP_NEXT_PRODUCT_BRANCH, RHBOP_NEXT_PRODUCT_CONFIG_BRANCH)} - ${rhbopNightlyStage(RHBOP_CURRENT_PRODUCT_BRANCH, RHBOP_CURRENT_PRODUCT_CONFIG_BRANCH, RHBOP_CURRENT_PRODUCT_VERSION, RHBOP_CURRENT_DROOLS_VERSION)} - // Drools Ansible Integration ${droolsAnsibleIntegrationNightlyStage(DAI_NEXT_PRODUCT_BRANCH, DAI_NEXT_PRODUCT_CONFIG_BRANCH, DAI_NEXT_PRODUCT_BRANCH, DAI_NEXT_PRODUCT_VERSION, DAI_NEXT_DROOLS_VERSION)} ${droolsAnsibleIntegrationNightlyStage(DAI_CURRENT_PRODUCT_BRANCH, DAI_CURRENT_PRODUCT_CONFIG_BRANCH, DAI_CURRENT_PRODUCT_BRANCH)} @@ -129,7 +88,7 @@ pipelineJob("${folderPath}/cron-meta-nightly-pipeline") { pipelineTriggers { triggers { cron{ - spec("H 15 * * *") + spec("H 15 * * 0") } } } @@ -143,63 +102,6 @@ pipelineJob("${folderPath}/cron-meta-nightly-pipeline") { } } -String rhbaNightlyStage(String version, String branch, String configBranch) { - return """ - stage('trigger RHBA nightly job ${branch}') { - steps { - build job: 'rhba.nightly/${branch}', propagate: false, wait: true, parameters: [ - [\$class: 'StringParameterValue', name: 'KIE_GROUP_DEPLOYMENT_REPO_URL', value: "\${env.BXMS_QE_NEXUS}/service/local/repositories/scratch-release-rhba-${getNexusFromVersion(version)}/content-compressed"], - [\$class: 'StringParameterValue', name: 'UMB_VERSION', value: '${getUMBFromVersion(version)}'], - [\$class: 'StringParameterValue', name: 'PRODUCT_VERSION', value: "${version}"], - [\$class: 'StringParameterValue', name: 'CONFIG_BRANCH', value: "${configBranch}"], - [\$class: 'BooleanParameterValue', name: 'SKIP_TESTS', value: true] - ] - } - } - """ -} - -String kogitoNightlyStage(String kogitoVersion, String kogitoBranch, String optaplannerVersion, String rhbaVersion, String rhbaVersionPrefix, String configBranch) { - return """ - stage('trigger KOGITO nightly job ${kogitoVersion}') { - steps { - build job: 'kogito.nightly/${kogitoBranch}', propagate: false, wait: true, parameters: [ - [\$class: 'StringParameterValue', name: 'RHBA_MAVEN_REPO_URL', value: "\${env.BXMS_QE_NEXUS}/content/repositories/rhba-${getNexusFromVersion(rhbaVersion)}-nightly-with-upstream"], - [\$class: 'StringParameterValue', name: 'RHBA_VERSION_PREFIX', value: '${rhbaVersionPrefix}'], - [\$class: 'StringParameterValue', name: 'RHBA_RELEASE_VERSION', value: '${getNexusFromVersion(rhbaVersion)}'], - [\$class: 'StringParameterValue', name: 'KOGITO_DEPLOYMENT_REPO_URL', value: "\${env.BXMS_QE_NEXUS}/service/local/repositories/scratch-release-kogito-${getNexusFromVersion(kogitoVersion)}/content-compressed"], - [\$class: 'StringParameterValue', name: 'UMB_VERSION', value: '${getUMBFromVersion(kogitoVersion)}'], - [\$class: 'StringParameterValue', name: 'PRODUCT_VERSION', value: '${kogitoVersion}'],${optaplannerVersion ? """ - [\$class: 'StringParameterValue', name: 'OPTAPLANNER_PRODUCT_VERSION', value: '${optaplannerVersion}'],""" : ''} - [\$class: 'StringParameterValue', name: 'CONFIG_BRANCH', value: '${configBranch}'], - [\$class: 'BooleanParameterValue', name: 'SKIP_TESTS', value: true] - ] - } - } - """ -} - -String kogitoWithSpecDroolsNightlyStage(String kogitoVersion, String kogitoBranch, String droolsVersion, String optaplannerVersion, String rhbaVersion, String rhbaVersionPrefix, String configBranch) { - return """ - stage('trigger KOGITO nightly job ${kogitoVersion}') { - steps { - build job: 'kogito.nightly/${kogitoBranch}', propagate: false, wait: true, parameters: [ - [\$class: 'StringParameterValue', name: 'RHBA_MAVEN_REPO_URL', value: 'https://bxms-qe.rhev-ci-vms.eng.rdu2.redhat.com:8443/nexus/content/repositories/rhba-${getNexusFromVersion(rhbaVersion)}-nightly-with-upstream'], - [\$class: 'StringParameterValue', name: 'RHBA_VERSION_PREFIX', value: '${rhbaVersionPrefix}'], - [\$class: 'StringParameterValue', name: 'RHBA_RELEASE_VERSION', value: '${getNexusFromVersion(rhbaVersion)}'], - [\$class: 'StringParameterValue', name: 'KOGITO_DEPLOYMENT_REPO_URL', value: 'https://bxms-qe.rhev-ci-vms.eng.rdu2.redhat.com:8443/nexus/service/local/repositories/scratch-release-kogito-${getNexusFromVersion(kogitoVersion)}/content-compressed'], - [\$class: 'StringParameterValue', name: 'UMB_VERSION', value: '${getUMBFromVersion(kogitoVersion)}'], - [\$class: 'StringParameterValue', name: 'PRODUCT_VERSION', value: '${kogitoVersion}'], - [\$class: 'StringParameterValue', name: 'DROOLS_PRODUCT_VERSION', value: '${droolsVersion}'], - [\$class: 'StringParameterValue', name: 'OPTAPLANNER_PRODUCT_VERSION', value: '${optaplannerVersion}'], - [\$class: 'StringParameterValue', name: 'CONFIG_BRANCH', value: '${configBranch}'], - [\$class: 'BooleanParameterValue', name: 'SKIP_TESTS', value: true] - ] - } - } - """ -} - String serverlessLogicNightlyStage(String branch, String configBranch, String productVersion = '', String kogitoVersion = '', String droolsVersion = '') { // when kogitoVersion or droolsVersion are empty, the Jenkins job will get them from the current branch pom (mostly main) return """ @@ -217,23 +119,6 @@ String serverlessLogicNightlyStage(String branch, String configBranch, String pr """ } -String rhbopNightlyStage(String branch, String configBranch, String version = '', String droolsVersion = '') { - // when version or droolsVersion are empty, the Jenkins job will get them from the main branch pom - return """ - stage('trigger RHBOP nightly job ${branch}') { - steps { - build job: 'rhbop.nightly/${branch}', propagate: false, wait: true, parameters: [ - [\$class: 'StringParameterValue', name: 'KIE_GROUP_DEPLOYMENT_REPO_URL', value: 'https://bxms-qe.rhev-ci-vms.eng.rdu2.redhat.com:8443/nexus/service/local/repositories/scratch-release-rhbop-${getNexusFromVersion(version)}/content-compressed'], - [\$class: 'StringParameterValue', name: 'UMB_VERSION', value: '${getUMBFromVersion(version)}'], - [\$class: 'StringParameterValue', name: 'PRODUCT_VERSION', value: "${version}"], - [\$class: 'StringParameterValue', name: 'DROOLS_PRODUCT_VERSION', value: '${droolsVersion}'], - [\$class: 'StringParameterValue', name: 'CONFIG_BRANCH', value: "${configBranch}"], - ] - } - } - """ -} - String droolsAnsibleIntegrationNightlyStage(String branch, String configBranch, String definitionFileBranch = 'main', String version = '', String droolsVersion = '') { // when version or droolsVersion are empty, the Jenkins job will get them from the main branch pom return """ @@ -275,5 +160,5 @@ String getBlueSuffix(String version, String separator) { } boolean isMainBranchVersion(String version) { - return [Constants.MAIN_BRANCH_PROD_VERSION, Constants.KOGITO_MAIN_BRANCH_PROD_VERSION, Constants.RHBOP_MAIN_BRANCH_PROD_VERSION].contains(version) + return [Constants.MAIN_BRANCH_PROD_VERSION, Constants.KOGITO_MAIN_BRANCH_PROD_VERSION].contains(version) } diff --git a/job-dsls/jobs/prod/prod_cron_meta_nightly_rhpam_pipeline.groovy b/job-dsls/jobs/prod/prod_cron_meta_nightly_rhpam_pipeline.groovy new file mode 100644 index 00000000..e4386d71 --- /dev/null +++ b/job-dsls/jobs/prod/prod_cron_meta_nightly_rhpam_pipeline.groovy @@ -0,0 +1,204 @@ +/** + * This job is a workaround for the nightly-meta-pipeline (wich was disabled) and will be removed once the UMB messages are sent again
+ * Instead UMB message a simple CRON job is applied. + */ + +import org.kie.jenkins.jobdsl.Constants + +def javadk=Constants.JDK_TOOL +def AGENT_LABEL="kie-rhel && kie-mem512m" + +def NEXT_PRODUCT_VERSION=Constants.NEXT_PROD_VERSION +def NEXT_PRODUCT_BRANCH='7.67.x' +def NEXT_PRODUCT_CONFIG_BRANCH="rhba/${NEXT_PRODUCT_BRANCH}" +// Use again after nightly builds from main branch again +// def NEXT_RHBA_VERSION_PREFIX=Constants.RHBA_VERSION_PREFIX +def NEXT_RHBA_VERSION_PREFIX='7.67.1.redhat-' + +def KOGITO_NEXT_PRODUCT_VERSION='1.13.0' +def KOGITO_NEXT_PRODUCT_BRANCH='1.13.x' +def KOGITO_NEXT_PRODUCT_CONFIG_BRANCH="kogito/${KOGITO_NEXT_PRODUCT_BRANCH}" + +def OPTAPLANNER_NEXT_PRODUCT_VERSION='8.13.0' + +def NEXT_BLUE_PRODUCT_VERSION=Constants.BAMOE_NEXT_PROD_VERSION +def NEXT_BLUE_PRODUCT_BRANCH='7.67.x-blue' +def NEXT_BLUE_PRODUCT_CONFIG_BRANCH="bamoe/7.67.x-blue" +def NEXT_BLUE_RHBA_VERSION_PREFIX='7.67.2.redhat-' + +def KOGITO_BLUE_NEXT_PRODUCT_VERSION='1.13.2.blue' +def KOGITO_BLUE_NEXT_PRODUCT_BRANCH='1.13.x-blue' +def KOGITO_BLUE_NEXT_PRODUCT_CONFIG_BRANCH="kogito/1.13.x-blue" + +def RHBOP_CURRENT_PRODUCT_VERSION='8.38.0' +def RHBOP_CURRENT_PRODUCT_BRANCH='8.38.x-prod' +def RHBOP_CURRENT_PRODUCT_CONFIG_BRANCH='rhbop/8.38.x' +def RHBOP_CURRENT_DROOLS_VERSION='8.29.0' + +def metaJob=""" +pipeline{ + agent { + label "$AGENT_LABEL" + } + tools { + jdk "$javadk" + } + // IMPORTANT: In case you trigger a new branch here, please create the same branch on build-configuration project + + stages { + ${rhbaNightlyStage(NEXT_PRODUCT_VERSION, NEXT_PRODUCT_BRANCH, NEXT_PRODUCT_CONFIG_BRANCH)} + ${kogitoNightlyStage(KOGITO_NEXT_PRODUCT_VERSION, KOGITO_NEXT_PRODUCT_BRANCH, OPTAPLANNER_NEXT_PRODUCT_VERSION, NEXT_PRODUCT_VERSION, NEXT_RHBA_VERSION_PREFIX, KOGITO_NEXT_PRODUCT_CONFIG_BRANCH)} + + // blue + ${rhbaNightlyStage(NEXT_BLUE_PRODUCT_VERSION, NEXT_BLUE_PRODUCT_BRANCH, NEXT_BLUE_PRODUCT_CONFIG_BRANCH)} + ${kogitoNightlyStage(KOGITO_BLUE_NEXT_PRODUCT_VERSION, KOGITO_BLUE_NEXT_PRODUCT_BRANCH, null, NEXT_BLUE_PRODUCT_VERSION, NEXT_BLUE_RHBA_VERSION_PREFIX, KOGITO_BLUE_NEXT_PRODUCT_CONFIG_BRANCH)} + + // RHBOP + //{rhbopNightlyStage(RHBOP_NEXT_PRODUCT_BRANCH, RHBOP_NEXT_PRODUCT_CONFIG_BRANCH)} + ${rhbopNightlyStage(RHBOP_CURRENT_PRODUCT_BRANCH, RHBOP_CURRENT_PRODUCT_CONFIG_BRANCH, RHBOP_CURRENT_PRODUCT_VERSION, RHBOP_CURRENT_DROOLS_VERSION)} + } +} +""" +// creates folder if is not existing +def folderPath="PROD" +folder(folderPath) + +pipelineJob("${folderPath}/cron-meta-nightly-pipeline") { + + description("This job is a workaround for the nightly-meta-pipeline (which was disabled) and will be removed once the UMB messages are sent again
\n" + + "Instead UMB message a simple CRON job is applied.") + + parameters { + wHideParameterDefinition { + name('AGENT_LABEL') + defaultValue("${AGENT_LABEL}") + description('name of machine where to run this job') + } + wHideParameterDefinition { + name('javadk') + defaultValue("${javadk}") + description('version of jdk') + } + } + + logRotator { + numToKeep(5) + } + + properties { + pipelineTriggers { + triggers { + cron{ + spec("H 15 * * 2") + } + } + } + } + + definition { + cps { + script("${metaJob}") + sandbox() + } + } +} + +String rhbaNightlyStage(String version, String branch, String configBranch) { + return """ + stage('trigger RHBA nightly job ${branch}') { + steps { + build job: 'rhba.nightly/${branch}', propagate: false, wait: true, parameters: [ + [\$class: 'StringParameterValue', name: 'KIE_GROUP_DEPLOYMENT_REPO_URL', value: "\${env.BXMS_QE_NEXUS}/service/local/repositories/scratch-release-rhba-${getNexusFromVersion(version)}/content-compressed"], + [\$class: 'StringParameterValue', name: 'UMB_VERSION', value: '${getUMBFromVersion(version)}'], + [\$class: 'StringParameterValue', name: 'PRODUCT_VERSION', value: "${version}"], + [\$class: 'StringParameterValue', name: 'CONFIG_BRANCH', value: "${configBranch}"], + [\$class: 'BooleanParameterValue', name: 'SKIP_TESTS', value: true] + ] + } + } + """ +} + +String kogitoNightlyStage(String kogitoVersion, String kogitoBranch, String optaplannerVersion, String rhbaVersion, String rhbaVersionPrefix, String configBranch) { + return """ + stage('trigger KOGITO nightly job ${kogitoVersion}') { + steps { + build job: 'kogito.nightly/${kogitoBranch}', propagate: false, wait: true, parameters: [ + [\$class: 'StringParameterValue', name: 'RHBA_MAVEN_REPO_URL', value: "\${env.BXMS_QE_NEXUS}/content/repositories/rhba-${getNexusFromVersion(rhbaVersion)}-nightly-with-upstream"], + [\$class: 'StringParameterValue', name: 'RHBA_VERSION_PREFIX', value: '${rhbaVersionPrefix}'], + [\$class: 'StringParameterValue', name: 'RHBA_RELEASE_VERSION', value: '${getNexusFromVersion(rhbaVersion)}'], + [\$class: 'StringParameterValue', name: 'KOGITO_DEPLOYMENT_REPO_URL', value: "\${env.BXMS_QE_NEXUS}/service/local/repositories/scratch-release-kogito-${getNexusFromVersion(kogitoVersion)}/content-compressed"], + [\$class: 'StringParameterValue', name: 'UMB_VERSION', value: '${getUMBFromVersion(kogitoVersion)}'], + [\$class: 'StringParameterValue', name: 'PRODUCT_VERSION', value: '${kogitoVersion}'],${optaplannerVersion ? """ + [\$class: 'StringParameterValue', name: 'OPTAPLANNER_PRODUCT_VERSION', value: '${optaplannerVersion}'],""" : ''} + [\$class: 'StringParameterValue', name: 'CONFIG_BRANCH', value: '${configBranch}'], + [\$class: 'BooleanParameterValue', name: 'SKIP_TESTS', value: true] + ] + } + } + """ +} + +String kogitoWithSpecDroolsNightlyStage(String kogitoVersion, String kogitoBranch, String droolsVersion, String optaplannerVersion, String rhbaVersion, String rhbaVersionPrefix, String configBranch) { + return """ + stage('trigger KOGITO nightly job ${kogitoVersion}') { + steps { + build job: 'kogito.nightly/${kogitoBranch}', propagate: false, wait: true, parameters: [ + [\$class: 'StringParameterValue', name: 'RHBA_MAVEN_REPO_URL', value: 'https://bxms-qe.rhev-ci-vms.eng.rdu2.redhat.com:8443/nexus/content/repositories/rhba-${getNexusFromVersion(rhbaVersion)}-nightly-with-upstream'], + [\$class: 'StringParameterValue', name: 'RHBA_VERSION_PREFIX', value: '${rhbaVersionPrefix}'], + [\$class: 'StringParameterValue', name: 'RHBA_RELEASE_VERSION', value: '${getNexusFromVersion(rhbaVersion)}'], + [\$class: 'StringParameterValue', name: 'KOGITO_DEPLOYMENT_REPO_URL', value: 'https://bxms-qe.rhev-ci-vms.eng.rdu2.redhat.com:8443/nexus/service/local/repositories/scratch-release-kogito-${getNexusFromVersion(kogitoVersion)}/content-compressed'], + [\$class: 'StringParameterValue', name: 'UMB_VERSION', value: '${getUMBFromVersion(kogitoVersion)}'], + [\$class: 'StringParameterValue', name: 'PRODUCT_VERSION', value: '${kogitoVersion}'], + [\$class: 'StringParameterValue', name: 'DROOLS_PRODUCT_VERSION', value: '${droolsVersion}'], + [\$class: 'StringParameterValue', name: 'OPTAPLANNER_PRODUCT_VERSION', value: '${optaplannerVersion}'], + [\$class: 'StringParameterValue', name: 'CONFIG_BRANCH', value: '${configBranch}'], + [\$class: 'BooleanParameterValue', name: 'SKIP_TESTS', value: true] + ] + } + } + """ +} + +String rhbopNightlyStage(String branch, String configBranch, String version = '', String droolsVersion = '') { + // when version or droolsVersion are empty, the Jenkins job will get them from the main branch pom + return """ + stage('trigger RHBOP nightly job ${branch}') { + steps { + build job: 'rhbop.nightly/${branch}', propagate: false, wait: true, parameters: [ + [\$class: 'StringParameterValue', name: 'KIE_GROUP_DEPLOYMENT_REPO_URL', value: 'https://bxms-qe.rhev-ci-vms.eng.rdu2.redhat.com:8443/nexus/service/local/repositories/scratch-release-rhbop-${getNexusFromVersion(version)}/content-compressed'], + [\$class: 'StringParameterValue', name: 'UMB_VERSION', value: '${getUMBFromVersion(version)}'], + [\$class: 'StringParameterValue', name: 'PRODUCT_VERSION', value: "${version}"], + [\$class: 'StringParameterValue', name: 'DROOLS_PRODUCT_VERSION', value: '${droolsVersion}'], + [\$class: 'StringParameterValue', name: 'CONFIG_BRANCH', value: "${configBranch}"], + ] + } + } + """ +} + +String getUMBFromVersion(def version) { + // if empty return main branch too + if (isMainBranchVersion(version) || version == '') { + return Constants.MAIN_BRANCH + } + def matcher = version =~ /(\d*)\.(\d*)\.?/ + return "${matcher[0][1]}${matcher[0][2]}${getBlueSuffix(version, '')}" +} + +String getNexusFromVersion(def version) { + // if empty return main branch too + if (isMainBranchVersion(version) || version == '') { + return Constants.MAIN_BRANCH + } + def matcher = version =~ /(\d*)\.(\d*)\.?/ + return "${matcher[0][1]}.${matcher[0][2]}${getBlueSuffix(version, '-')}" +} + +String getBlueSuffix(String version, String separator) { + return version.endsWith('blue') ? separator + 'blue' : '' +} + +boolean isMainBranchVersion(String version) { + return [Constants.MAIN_BRANCH_PROD_VERSION, Constants.KOGITO_MAIN_BRANCH_PROD_VERSION, Constants.RHBOP_MAIN_BRANCH_PROD_VERSION].contains(version) +}