Skip to content

Commit

Permalink
kie-issues#423: Prepare for 2.x stream
Browse files Browse the repository at this point in the history
  • Loading branch information
radtriste committed Aug 16, 2023
1 parent 232910a commit 7a442b3
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 26 deletions.
4 changes: 3 additions & 1 deletion .ci/jenkins/Jenkinsfile.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ pipeline {
script {
dir(getRepoName()) {
def mvnCmd = getMavenCommand()
.withProperty('maven.test.failure.ignore', true)
.withOptions(env.BUILD_MVN_OPTS_CURRENT ? [ env.BUILD_MVN_OPTS_CURRENT ] : [])
.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 ...
Expand Down Expand Up @@ -290,6 +291,7 @@ 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')
}
Expand Down
1 change: 1 addition & 0 deletions .ci/jenkins/Jenkinsfile.setup-branch
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,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)
}

Expand Down
1 change: 1 addition & 0 deletions .ci/jenkins/Jenkinsfile.sonarcloud
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,5 @@ pipeline {
MavenCommand getMavenCommand() {
return new MavenCommand(this, ['-fae', '-ntp'])
.withSettingsXmlId('kogito_release_settings')
.withOptions(env.BUILD_MVN_OPTS ? [ env.BUILD_MVN_OPTS ] : [])
}
65 changes: 40 additions & 25 deletions .ci/jenkins/dsl/jobs.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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' }
}

Expand All @@ -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
}

Expand All @@ -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()
}
}

/////////////////////////////////////////////////////////////////
Expand All @@ -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() {
Expand All @@ -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 {
Expand All @@ -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}",
])
Expand Down Expand Up @@ -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}",
Expand Down

0 comments on commit 7a442b3

Please sign in to comment.