From e31495c14b6789454491668059cd26670d238d5c Mon Sep 17 00:00:00 2001 From: radtriste Date: Mon, 14 Aug 2023 15:30:52 +0200 Subject: [PATCH 1/2] kie-issues#423: Prepare for 2.x stream --- .ci/jenkins/dsl/jobs.groovy | 39 ++++++++++++------- .../org/kie/jenkins/jobdsl/Utils.groovy | 9 +++++ 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy index 849482cc0..69d8e386e 100644 --- a/.ci/jenkins/dsl/jobs.groovy +++ b/.ci/jenkins/dsl/jobs.groovy @@ -7,37 +7,50 @@ import org.kie.jenkins.jobdsl.Utils JENKINSFILE_PATH = '.ci/jenkins' +boolean isMainStream() { + return Utils.getStream(this) == 'main' +} + // PRs setupKogitoRuntimesBDDPrJob() // Tools setupUpdateJenkinsDependenciesJob() -setupCreateIssueToolsJob() -setupCleanOldNamespacesToolsJob() -setupCleanOldNightlyImagesToolsJob() -KogitoJobUtils.createQuarkusPlatformUpdateToolsJob(this, 'kogito') -KogitoJobUtils.createMainQuarkusUpdateToolsJob(this, +if (isMainStream()) { + setupCreateIssueToolsJob() + setupCleanOldNamespacesToolsJob() + setupCleanOldNightlyImagesToolsJob() + + KogitoJobUtils.createQuarkusPlatformUpdateToolsJob(this, 'kogito') + if (Utils.isMainBranch(this)) { + setupBuildOperatorNode() + } + + KogitoJobUtils.createMainQuarkusUpdateToolsJob(this, [ 'kogito-runtimes', 'kogito-examples', 'kogito-docs', 'kogito-images' ], [ 'radtriste', 'cristianonicolai' ] -) -if (Utils.isMainBranch(this)) { - setupBuildOperatorNode() + ) } // Setup branch branch createSetupBranchJob() -createSetupBranchCloudJob() +if (isMainStream()) { + createSetupBranchCloudJob() +} // Nightly setupNightlyJob() -setupNightlyCloudJob() -setupQuarkusPlatformJob(JobType.NIGHTLY) -setupQuarkus3NightlyJob() +if (isMainStream()) { + setupNightlyCloudJob() + setupQuarkusPlatformJob(JobType.NIGHTLY) + setupQuarkus3NightlyJob() +} KogitoJobUtils.createEnvironmentIntegrationBranchNightlyJob(this, 'quarkus-main') KogitoJobUtils.createEnvironmentIntegrationBranchNightlyJob(this, 'quarkus-lts') KogitoJobUtils.createEnvironmentIntegrationBranchNightlyJob(this, 'quarkus-branch') KogitoJobUtils.createEnvironmentIntegrationBranchNightlyJob(this, 'native-lts') +KogitoJobUtils.createEnvironmentIntegrationBranchNightlyJob(this, 'quarkus-3') // Release setupReleaseArtifactsJob() @@ -142,7 +155,7 @@ void createSetupBranchCloudJob() { void setupNightlyJob() { def jobParams = JobParamsUtils.getBasicJobParams(this, '0-kogito-nightly', JobType.NIGHTLY, "${JENKINSFILE_PATH}/Jenkinsfile.nightly", 'Kogito Nightly') - jobParams.triggers = [cron : '@midnight'] + jobParams.triggers = [cron : isMainStream () ? '@midnight' : 'H 4 * * *'] jobParams.env.putAll([ JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}", diff --git a/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/Utils.groovy b/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/Utils.groovy index 62c416f27..e2a40837d 100644 --- a/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/Utils.groovy +++ b/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/Utils.groovy @@ -75,6 +75,15 @@ class Utils { return getBindingValue(script, 'GIT_MAIN_BRANCH') } + static String getStream(def script) { + String gitMainBranch = Utils.getGitMainBranch(script) + if (gitMainBranch == 'main') { + return 'main' + } else { + return gitMainBranch.split("\\.")[0] + } + } + static boolean hasGitAuthor(def script) { return hasBindingValue(script, 'GIT_AUTHOR_NAME') } From 00cfa3f5c9c41dbc994f24c96a3fded06c5ea152 Mon Sep 17 00:00:00 2001 From: radtriste Date: Mon, 14 Aug 2023 16:13:12 +0200 Subject: [PATCH 2/2] update --- .ci/jenkins/dsl/jobs.groovy | 3 +-- .../groovy/org/kie/jenkins/jobdsl/utils/JobParamsUtils.groovy | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy index 69d8e386e..52accbb48 100644 --- a/.ci/jenkins/dsl/jobs.groovy +++ b/.ci/jenkins/dsl/jobs.groovy @@ -202,8 +202,7 @@ void setupNightlyCloudJob() { } void setupQuarkus3NightlyJob() { - // TODO Tests would be done on 9.x/2.x branch => Create 2.x branch on Kogito - + // Tests are done on 9.x/2.x branch => Create 2.x branch on Kogito // Need to split as Drools and Kogito end up in different integration branches KogitoJobUtils.createNightlyBuildChainIntegrationJob(this, 'quarkus-3', 'drools', true) { script -> def jobParams = JobParamsUtils.getDefaultJobParams(script, 'drools') diff --git a/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/utils/JobParamsUtils.groovy b/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/utils/JobParamsUtils.groovy index f1b7fe611..47378bdaf 100644 --- a/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/utils/JobParamsUtils.groovy +++ b/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/utils/JobParamsUtils.groovy @@ -29,6 +29,7 @@ class JobParamsUtils { parametersValues: [:], env: [ REPO_NAME: repository, + STREAM: Utils.getStream(script), ], pr: [ target_repository: repository,