diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy index c5af11b66ad..784e43dd8a5 100644 --- a/.ci/jenkins/Jenkinsfile.deploy +++ b/.ci/jenkins/Jenkinsfile.deploy @@ -110,7 +110,9 @@ pipeline { script { dir(getRepoName()) { def mvnCmd = getMavenCommand() - .withProperty('maven.test.failure.ignore', true) + .withOptions(env.BUILD_MVN_OPTS_CURRENT ? [ env.BUILD_MVN_OPTS_CURRENT ] : []) + .withOptions(env.KOGITO_RUNTIMES_BUILD_MVN_OPTS ? [ env.KOGITO_RUNTIMES_BUILD_MVN_OPTS ] : []) + .withProperty('maven.test.failure.ignore', true) if (params.SKIP_TESTS) { mvnCmd.skipTests() // Conflict somehow with Python testing. If `skipTests={anyvalue}` is set, then exec plugin is not executed ... @@ -290,12 +292,15 @@ MavenCommand getMavenCommand(String directory = '') { directory = directory ?: getRepoName() return new MavenCommand(this, ['-fae', '-ntp']) .withSettingsXmlId(env.MAVEN_SETTINGS_CONFIG_FILE_ID) + .withOptions(env.BUILD_MVN_OPTS ? [ env.BUILD_MVN_OPTS ] : []) .inDirectory(directory) .withProperty('full') } void runMavenDeploy(boolean localDeployment = false) { mvnCmd = getMavenCommand() + .withOptions(env.KOGITO_RUNTIMES_BUILD_MVN_OPTS ? [ env.KOGITO_RUNTIMES_BUILD_MVN_OPTS ] : []) + .withOptions(env.BUILD_MVN_OPTS_CURRENT ? [ env.BUILD_MVN_OPTS_CURRENT ] : []) if (localDeployment) { mvnCmd.withLocalDeployFolder(getLocalDeploymentFolder()) diff --git a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr index 4c106b5660b..7b3691f9d83 100644 --- a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr +++ b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr @@ -95,4 +95,5 @@ String getGitAuthorCredsId() { MavenCommand getMavenCommand() { return new MavenCommand(this, ['-fae', '-ntp']) .withSettingsXmlId(env.MAVEN_SETTINGS_CONFIG_FILE_ID) + .withOptions(env.BUILD_MVN_OPTS ? [ env.BUILD_MVN_OPTS ] : []) } diff --git a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone index ba3a900627e..33aae1e1d43 100644 --- a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone +++ b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone @@ -174,4 +174,5 @@ String getPRBranch() { MavenCommand getMavenCommand() { return new MavenCommand(this, ['-fae', '-ntp']) .withSettingsXmlId(env.MAVEN_SETTINGS_CONFIG_FILE_ID) + .withOptions(env.BUILD_MVN_OPTS ? [ env.BUILD_MVN_OPTS ] : []) } diff --git a/.ci/jenkins/Jenkinsfile.setup-branch b/.ci/jenkins/Jenkinsfile.setup-branch index 226de2f4201..cd383415c75 100644 --- a/.ci/jenkins/Jenkinsfile.setup-branch +++ b/.ci/jenkins/Jenkinsfile.setup-branch @@ -54,6 +54,8 @@ pipeline { script { getMavenCommand(droolsRepo) .withProperty('quickly') + .withOptions(env.BUILD_MVN_OPTS_UPSTREAM ? [ env.BUILD_MVN_OPTS_UPSTREAM ] : []) + .withOptions(env.DROOLS_BUILD_MVN_OPTS_UPSTREAM ? [ env.DROOLS_BUILD_MVN_OPTS_UPSTREAM ] : []) .run('clean install') } } @@ -148,6 +150,7 @@ String getGitAuthorCredsID() { MavenCommand getMavenCommand(String directory) { return new MavenCommand(this, ['-fae', '-ntp']) .withSettingsXmlId(env.MAVEN_SETTINGS_CONFIG_FILE_ID) + .withOptions(env.BUILD_MVN_OPTS ? [ env.BUILD_MVN_OPTS ] : []) .inDirectory(directory) } diff --git a/.ci/jenkins/Jenkinsfile.sonarcloud b/.ci/jenkins/Jenkinsfile.sonarcloud deleted file mode 100644 index a7b5874915b..00000000000 --- a/.ci/jenkins/Jenkinsfile.sonarcloud +++ /dev/null @@ -1,76 +0,0 @@ -@Library('jenkins-pipeline-shared-libraries')_ - -import org.kie.jenkins.MavenCommand - -pipeline { - agent { - label 'kie-rhel8 && docker && kie-mem16g && !built-in' - } - tools { - maven env.BUILD_MAVEN_TOOL - jdk env.BUILD_JDK_TOOL - } - options { - timestamps() - timeout(time: 360, unit: 'MINUTES') - } - environment { - // Some generated env is also defined into ./dsl/jobs.groovy file - - KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") - SONARCLOUD_TOKEN = credentials('SONARCLOUD_TOKEN') - MAVEN_OPTS = '-Xms1024m -Xmx4g' - } - stages { - stage('Checkout') { - steps { - script { - checkout(githubscm.resolveRepository('kogito-runtimes', params.GIT_AUTHOR, params.BUILD_BRANCH_NAME, false)) - } - } - } - stage('Build') { - steps { - script { - util.runWithPythonVirtualEnv(getMavenCommand() - .withProfiles(['run-code-coverage', 'full']) - .getFullRunCommand('clean install'), - 'swf') - } - } - } - stage('Analyze') { - steps { - script { - getMavenCommand() - .withOptions(['-e', '-nsu']) - .withProfiles(['sonarcloud-analysis']) - .run('validate') - } - } - } - } - post { - always { - script { - junit testResults: '**/target/surefire-reports/**/*.xml, **/target/failsafe-reports/**/*.xml', allowEmptyResults: true - util.archiveConsoleLog() - } - } - unsuccessful { - script { - mailer.sendMarkdownTestSummaryNotification('SonarCloud', "[${params.BUILD_BRANCH_NAME}] Kogito Runtimes", [env.KOGITO_CI_EMAIL_TO]) - } - } - cleanup { - script { - util.cleanNode('docker') - } - } - } -} - -MavenCommand getMavenCommand() { - return new MavenCommand(this, ['-fae', '-ntp']) - .withSettingsXmlId('kogito_release_settings') -} diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy index eb83fd3adca..ce8ca2657e1 100644 --- a/.ci/jenkins/dsl/jobs.groovy +++ b/.ci/jenkins/dsl/jobs.groovy @@ -19,6 +19,18 @@ import org.kie.jenkins.jobdsl.Utils jenkins_path = '.ci/jenkins' +boolean isMainStream() { + return Utils.getStream(this) == 'main' +} + +Closure setup4AMCronTriggerJobParamsGetter = { script -> + def jobParams = JobParamsUtils.DEFAULT_PARAMS_GETTER(script) + jobParams.triggers = [ cron: 'H 4 * * *' ] + return jobParams +} + + + Map getMultijobPRConfig(JenkinsFolder jobFolder) { String defaultBuildMvnOptsCurrent = jobFolder.getDefaultEnvVarValue('BUILD_MVN_OPTS_CURRENT') ?: '' def jobConfig = [ @@ -67,7 +79,7 @@ Map getMultijobPRConfig(JenkinsFolder jobFolder) { ] // For Quarkus 3, run only runtimes PR check... for now - if (EnvUtils.hasEnvironmentId(this, jobFolder.getEnvironmentName(), 'quarkus3')) { + if (isMainStream() && EnvUtils.hasEnvironmentId(this, jobFolder.getEnvironmentName(), 'quarkus3')) { jobConfig.jobs.retainAll { it.id == 'kogito-runtimes' } } @@ -78,8 +90,10 @@ List getRuntimesBuildMvnOptions(JenkinsFolder jobFolder) { List mvnOpts = [] // No parallel build for native mvnOpts += EnvUtils.hasEnvironmentId(this, jobFolder.getEnvironmentName(), 'native') ? [] : ['-T 1C'] - // Validate formatting only for default env - mvnOpts += jobFolder.getEnvironmentName() ? [] : ['-Dvalidate-formatting'] + if (isMainStream() && !jobFolder.getEnvironmentName()) { + // Validate formatting only for default env + mvnOpts += ['-Dvalidate-formatting'] + } return mvnOpts } @@ -91,29 +105,32 @@ setupDeployJob(JobType.PULL_REQUEST, 'kogito-bdd') createSetupBranchJob() // Nightly jobs -KogitoJobUtils.createNightlyBuildChainBuildAndDeployJobForCurrentRepo(this, '', true) -setupSpecificBuildChainNightlyJob('sonarcloud') -setupSpecificBuildChainNightlyJob('native') -setupNightlyQuarkusIntegrationJob('quarkus-main') -setupNightlyQuarkusIntegrationJob('quarkus-branch') -setupNightlyQuarkusIntegrationJob('quarkus-lts') -setupNightlyQuarkusIntegrationJob('native-lts') +Closure nightlyJobParamsGetter = isMainStream() ? JobParamsUtils.DEFAULT_PARAMS_GETTER : setup4AMCronTriggerJobParamsGetter +KogitoJobUtils.createNightlyBuildChainBuildAndDeployJobForCurrentRepo(this, '', true, nightlyJobParamsGetter) +setupSpecificBuildChainNightlyJob('sonarcloud', nightlyJobParamsGetter) +setupSpecificBuildChainNightlyJob('native', nightlyJobParamsGetter) +setupNightlyQuarkusIntegrationJob('quarkus-main', nightlyJobParamsGetter) +setupNightlyQuarkusIntegrationJob('quarkus-branch', nightlyJobParamsGetter) +setupNightlyQuarkusIntegrationJob('quarkus-lts', nightlyJobParamsGetter) +setupNightlyQuarkusIntegrationJob('native-lts', nightlyJobParamsGetter) // Release jobs setupDeployJob(JobType.RELEASE) setupPromoteJob(JobType.RELEASE) // Tools job -KogitoJobUtils.createQuarkusUpdateToolsJob(this, 'kogito-runtimes', [ - modules: [ 'kogito-dependencies-bom', 'kogito-build-parent', 'kogito-quarkus-bom', 'kogito-build-no-bom-parent' ], - compare_deps_remote_poms: [ 'io.quarkus:quarkus-bom' ], - properties: [ 'version.io.quarkus' ], -]) - -// Quarkus 3 -if (EnvUtils.isEnvironmentEnabled(this, 'quarkus-3')) { - setupPrQuarkus3RewriteJob() - setupStandaloneQuarkus3RewriteJob() +if (isMainStream()) { + KogitoJobUtils.createQuarkusUpdateToolsJob(this, 'kogito-runtimes', [ + modules: [ 'kogito-dependencies-bom', 'kogito-build-parent', 'kogito-quarkus-bom', 'kogito-build-no-bom-parent' ], + compare_deps_remote_poms: [ 'io.quarkus:quarkus-bom' ], + properties: [ 'version.io.quarkus' ], + ]) + + // Quarkus 3 + if (EnvUtils.isEnvironmentEnabled(this, 'quarkus-3')) { + setupPrQuarkus3RewriteJob() + setupStandaloneQuarkus3RewriteJob() + } } ///////////////////////////////////////////////////////////////// @@ -124,8 +141,8 @@ void setupNightlyQuarkusIntegrationJob(String envName, Closure defaultJobParamsG KogitoJobUtils.createNightlyBuildChainIntegrationJob(this, envName, Utils.getRepoName(this), true, defaultJobParamsGetter) } -void setupSpecificBuildChainNightlyJob(String envName) { - KogitoJobUtils.createNightlyBuildChainBuildAndTestJobForCurrentRepo(this, envName, true) +void setupSpecificBuildChainNightlyJob(String envName, Closure defaultJobParamsGetter = JobParamsUtils.DEFAULT_PARAMS_GETTER) { + KogitoJobUtils.createNightlyBuildChainBuildAndTestJobForCurrentRepo(this, envName, true, defaultJobParamsGetter) } void createSetupBranchJob() { @@ -140,7 +157,7 @@ void createSetupBranchJob() { MAVEN_SETTINGS_CONFIG_FILE_ID: "${MAVEN_SETTINGS_FILE_ID}", - IS_MAIN_BRANCH: "${Utils.isMainBranch(this)}" + IS_MAIN_BRANCH: "${Utils.isMainBranch(this)}", ]) KogitoJobTemplate.createPipelineJob(this, jobParams)?.with { parameters { @@ -165,7 +182,6 @@ void setupDeployJob(JobType jobType, String envName = '') { jobParams.git.project_url = Utils.createProjectUrl("${GIT_AUTHOR_NAME}", jobParams.git.repository) } jobParams.env.putAll([ - REPO_NAME: 'kogito-runtimes', JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}", MAVEN_SETTINGS_CONFIG_FILE_ID: "${MAVEN_SETTINGS_FILE_ID}", ]) @@ -223,7 +239,6 @@ void setupPromoteJob(JobType jobType) { def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-runtimes-promote', jobType, "${jenkins_path}/Jenkinsfile.promote", 'Kogito Runtimes Promote') JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams) jobParams.env.putAll([ - REPO_NAME: 'kogito-runtimes', PROPERTIES_FILE_NAME: 'deployment.properties', JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",