diff --git a/.ci/jenkins/Jenkinsfile.buildchain b/.ci/jenkins/Jenkinsfile.buildchain index 9c1ddb4db..8c77421f1 100644 --- a/.ci/jenkins/Jenkinsfile.buildchain +++ b/.ci/jenkins/Jenkinsfile.buildchain @@ -40,6 +40,8 @@ if (isBranchBuildChainType()) { skipTests = params.SKIP_TESTS ?: false skipIntegrationTests = params.SKIP_INTEGRATION_TESTS ?: false +launchDownstreamJobs = env.LAUNCH_DOWNSTREAM_JOBS ? env.LAUNCH_DOWNSTREAM_JOBS.split(',') : [] + notificationJobName = env.NOTIFICATION_JOB_NAME ?: 'PR' pipeline { @@ -181,6 +183,19 @@ pipeline { } } } + stage('Trigger downstream jobs') { + when { + expression { return launchDownstreamJobs } + } + steps { + script { + launchDownstreamJobs.each { + echo "Launch downstream jobs with path ${it}" + build(job: "${it}", wait: false, parameters: [], propagate: false) + } + } + } + } stage('check space after build') { steps { script { diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy index fc57873f5..849482cc0 100644 --- a/.ci/jenkins/dsl/jobs.groovy +++ b/.ci/jenkins/dsl/jobs.groovy @@ -189,15 +189,29 @@ void setupNightlyCloudJob() { } void setupQuarkus3NightlyJob() { + // TODO Tests would be 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') jobParams.git.branch = VersionUtils.getProjectTargetBranch('drools', Utils.getGitBranch(this), Utils.getRepoName(this)) - jobParams.env.put('ADDITIONAL_TIMEOUT', '720') + jobParams.env.put('ADDITIONAL_TIMEOUT', '180') jobParams.env.put('BUILD_ENVIRONMENT_OPTIONS_CURRENT', 'rewrite push_changes') jobParams.env.put('INTEGRATION_BRANCH_CURRENT', '9.x') + jobParams.env.put('LAUNCH_DOWNSTREAM_JOBS', 'kogito-runtimes.integration') + jobParams.parametersValues.put('SKIP_TESTS', true) + jobParams.parametersValues.put('SKIP_INTEGRATION_TESTS', true) + return jobParams + } + KogitoJobUtils.createBuildChainIntegrationJob(this, 'quarkus-3', 'kogito-runtimes', true) { script -> + def jobParams = JobParamsUtils.getDefaultJobParams(script, 'kogito-runtimes') + jobParams.env.put('ADDITIONAL_TIMEOUT', '720') + jobParams.env.put('BUILD_ENVIRONMENT_OPTIONS_CURRENT', 'rewrite push_changes') + jobParams.env.put('INTEGRATION_BRANCH_CURRENT', '2.x') jobParams.env.put('BUILDCHAIN_FULL_BRANCH_DOWNSTREAM_BUILD', 'true') jobParams.env.put('NODE_OPTIONS', '--max_old_space_size=4096') - JobParamsUtils.setupJobParamsDeployConfiguration(script, jobParams) + jobParams.parametersValues.put('SKIP_TESTS', true) + jobParams.parametersValues.put('SKIP_INTEGRATION_TESTS', true) return jobParams } } diff --git a/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/KogitoJobUtils.groovy b/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/KogitoJobUtils.groovy index 9c4d5286d..16ee84a3f 100644 --- a/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/KogitoJobUtils.groovy +++ b/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/KogitoJobUtils.groovy @@ -271,8 +271,21 @@ class KogitoJobUtils { * */ static def createNightlyBuildChainIntegrationJob(def script, String envName, String repository, boolean enableNotification = false, Closure defaultJobParamsGetter = JobParamsUtils.DEFAULT_PARAMS_GETTER) { + return createBuildChainIntegrationJob(script, envName, repository, enableNotification) { jenkinsScript -> + def jobParams = defaultJobParamsGetter(jenkinsScript) + jobParams.triggers = jobParams.triggers ?: [ cron : '@midnight' ] // To remove once environment nightlies are managed by main nightly pipeline + return jobParams + } + } + + /** + * Create a job creating an integration branch when performing the build + * + * This job will call the build-chain with extra environment variables to allow for the creation of an integration branch + * + */ + static def createBuildChainIntegrationJob(def script, String envName, String repository, boolean enableNotification = false, Closure defaultJobParamsGetter = JobParamsUtils.DEFAULT_PARAMS_GETTER) { def jobParams = JobParamsUtils.getSeedJobParamsWithEnv(script, "${repository}.integration", JobType.NIGHTLY, envName, KogitoConstants.BUILD_CHAIN_JENKINSFILE, "Integration with Quarkus for ${repository} using the build-chain", defaultJobParamsGetter) - jobParams.triggers = jobParams.triggers ?: [ cron : '@midnight' ] // To remove once environment nightlies are managed by main nightly pipeline if (!envName) { throw new RuntimeException('Please provide a non-empty environment to generate an integration branch job...') } @@ -294,12 +307,12 @@ class KogitoJobUtils { JobParamsUtils.setupJobParamsBuildChainConfiguration(script, jobParams, repository, 'branch', notificationJobName) jobParams.parametersClosures.add({ - stringParam('DISPLAY_NAME', '', 'Setup a specific build display name') + stringParam('DISPLAY_NAME', jobParams.parametersValues?.DISPLAY_NAME ?: '', 'Setup a specific build display name') stringParam('GIT_BRANCH_NAME', Utils.getGitBranch(script), 'Set the Git branch to test') - booleanParam('SKIP_TESTS', false, 'Skip tests') - booleanParam('SKIP_INTEGRATION_TESTS', false, 'Skip IT tests') + booleanParam('SKIP_TESTS', jobParams.parametersValues?.SKIP_TESTS ?: false, 'Skip tests') + booleanParam('SKIP_INTEGRATION_TESTS', jobParams.parametersValues?.SKIP_INTEGRATION_TESTS ?: false, 'Skip IT tests') }) jobParams.env.putAll([ JENKINS_EMAIL_CREDS_ID: Utils.getJenkinsEmailCredsId(script), 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 2cef5926c..f1b7fe611 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 @@ -26,6 +26,7 @@ class JobParamsUtils { token_credentials: Utils.getGitAuthorTokenCredsId(script) ], parametersClosures: [], + parametersValues: [:], env: [ REPO_NAME: repository, ],