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 958a87e commit 11bc3d1
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .ci/jenkins/Jenkinsfile.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ void setDeployPropertyIfNeeded(String key, def value) {
MavenCommand getMavenCommand() {
return new MavenCommand(this, ['-fae', '-ntp'])
.withSettingsXmlId(env.MAVEN_SETTINGS_CONFIG_FILE_ID)
.withOptions(env.BUILD_MVN_OPTS ? [ env.BUILD_MVN_OPTS ] : [])
.withProperty('full')
}

Expand All @@ -295,6 +296,7 @@ void runMavenDeploy(boolean skipTests = true, boolean localDeployment = false) {
}

mvnCmd.withProperty('maven.test.failure.ignore', true)
.withOptions(env.BUILD_MVN_OPTS_CURRENT ? [ env.BUILD_MVN_OPTS_CURRENT ] : [])
.skipTests(skipTests)
.run('clean deploy')
}
Expand Down
2 changes: 2 additions & 0 deletions .ci/jenkins/Jenkinsfile.optaplanner
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ pipeline {
steps {
script {
getMavenCommand(kogitoAppsRepo)
.withOptions(env.BUILD_MVN_OPTS_CURRENT ? [ env.BUILD_MVN_OPTS_CURRENT ] : [])
.withProperty('skipUI')
.withProperty('maven.test.failure.ignore', true)
.withProperty('version.org.optaplanner', env.OPTAPLANNER_VERSION)
Expand Down Expand Up @@ -172,6 +173,7 @@ MavenCommand getMavenCommand(String directory) {
return new MavenCommand(this, ['-fae', '-ntp'])
.withSettingsXmlId('kogito_release_settings')
.withProperty('java.net.preferIPv4Stack', true)
.withOptions(env.BUILD_MVN_OPTS ? [ env.BUILD_MVN_OPTS ] : [])
.inDirectory(directory)
}

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 @@ -149,5 +149,6 @@ 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)
}
1 change: 1 addition & 0 deletions .ci/jenkins/Jenkinsfile.sonarcloud
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ pipeline {
MavenCommand getMavenCommand() {
return new MavenCommand(this, ['-fae', '-ntp'])
.withSettingsXmlId('kogito_release_settings')
.withOptions(env.BUILD_MVN_OPTS ? [ env.BUILD_MVN_OPTS ] : [])
}

void setupCypressEnv(String cypressVersion) {
Expand Down
61 changes: 39 additions & 22 deletions .ci/jenkins/dsl/jobs.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ import org.kie.jenkins.jobdsl.Utils

jenkins_path = '.ci/jenkins'

boolean isMainStream() {
return Utils.getStream(this) == 'main'
}

Map getMultijobPRConfig(JenkinsFolder jobFolder) {
String defaultBuildMvnOptsCurrent = jobFolder.getDefaultEnvVarValue('BUILD_MVN_OPTS_CURRENT') ?: ''
def jobConfig = [
Expand All @@ -32,7 +36,7 @@ Map getMultijobPRConfig(JenkinsFolder jobFolder) {
// Sonarcloud analysis only on main branch
// As we have only Community edition
ENABLE_SONARCLOUD: EnvUtils.isDefaultEnvironment(this, jobFolder.getEnvironmentName()) && Utils.isMainBranch(this),
BUILD_MVN_OPTS_CURRENT: "${defaultBuildMvnOptsCurrent} ${jobFolder.getEnvironmentName() ? '' : '-Dvalidate-formatting'}", // Validate formatting only for default env
BUILD_MVN_OPTS_CURRENT: "${defaultBuildMvnOptsCurrent} ${getAppsBuildMvnOptions(jobFolder).join(' ')}",
]
], [
id: 'kogito-quarkus-examples',
Expand Down Expand Up @@ -63,13 +67,22 @@ 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-apps' }
}

return jobConfig
}

List getAppsBuildMvnOptions(JenkinsFolder jobFolder) {
List mvnOpts = []
if (isMainStream() && !jobFolder.getEnvironmentName()) {
// Validate formatting only for default env
mvnOpts += ['-Dvalidate-formatting']
}
return mvnOpts
}

boolean isProdEnv(JenkinsFolder jobFolder) {
return EnvUtils.hasEnvironmentId(this, jobFolder.getEnvironmentName(), 'prod')
}
Expand All @@ -92,35 +105,42 @@ Closure addNodeOptionsEnvJobParamsGetter = { script ->
jobParams.env.put('NODE_OPTIONS', '--max_old_space_size=4096')
return jobParams
}
Closure setup4AMCronTriggerJobParamsGetter = { script ->
def jobParams = addNodeOptionsEnvJobParamsGetter(script)
jobParams.triggers = [ cron: 'H 4 * * *' ]
return jobParams
}

KogitoJobUtils.createNightlyBuildChainBuildAndDeployJobForCurrentRepo(this, '', true, addNodeOptionsEnvJobParamsGetter)
setupSpecificBuildChainNightlyJob('sonarcloud', addNodeOptionsEnvJobParamsGetter)
setupSpecificBuildChainNightlyJob('native', addNodeOptionsEnvJobParamsGetter)
setupNightlyQuarkusIntegrationJob('quarkus-main', addNodeOptionsEnvJobParamsGetter)
setupNightlyQuarkusIntegrationJob('quarkus-branch', addNodeOptionsEnvJobParamsGetter)
setupNightlyQuarkusIntegrationJob('quarkus-lts', addNodeOptionsEnvJobParamsGetter)
setupNightlyQuarkusIntegrationJob('native-lts', addNodeOptionsEnvJobParamsGetter)
Closure nightlyJobParamsGetter = isMainStream() ? addNodeOptionsEnvJobParamsGetter : 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)

// Update Optaplanner tools job
KogitoJobUtils.createVersionUpdateToolsJob(this, 'kogito-apps', 'Optaplanner', [
modules: [ 'kogito-apps-build-parent' ],
properties: [ 'version.org.optaplanner' ],
])
if (isMainStream()) {
KogitoJobUtils.createVersionUpdateToolsJob(this, 'kogito-apps', 'Optaplanner', [
modules: [ 'kogito-apps-build-parent' ],
properties: [ 'version.org.optaplanner' ],
])
// Quarkus 3
if (EnvUtils.isEnvironmentEnabled(this, 'quarkus-3')) {
setupPrQuarkus3RewriteJob()
setupStandaloneQuarkus3RewriteJob()
}
}

if (Utils.isMainBranch(this)) {
setupOptaplannerJob('main')
}

// Quarkus 3
if (EnvUtils.isEnvironmentEnabled(this, 'quarkus-3')) {
setupPrQuarkus3RewriteJob()
setupStandaloneQuarkus3RewriteJob()
}

/////////////////////////////////////////////////////////////////
// Methods
/////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -155,7 +175,6 @@ void createSetupBranchJob() {
def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-apps', JobType.SETUP_BRANCH, "${jenkins_path}/Jenkinsfile.setup-branch", 'Kogito Apps Init branch')
JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams)
jobParams.env.putAll([
REPO_NAME: 'kogito-apps',
JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",

GIT_AUTHOR: "${GIT_AUTHOR_NAME}",
Expand Down Expand Up @@ -187,7 +206,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-apps',
JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",
MAVEN_SETTINGS_CONFIG_FILE_ID: "${MAVEN_SETTINGS_FILE_ID}",
])
Expand Down Expand Up @@ -242,7 +260,6 @@ void setupPromoteJob(JobType jobType) {
def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-apps-promote', jobType, "${jenkins_path}/Jenkinsfile.promote", 'Kogito Apps Promote')
JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams)
jobParams.env.putAll([
REPO_NAME: 'kogito-apps',
PROPERTIES_FILE_NAME: 'deployment.properties',

JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",
Expand Down

0 comments on commit 11bc3d1

Please sign in to comment.