Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kie-issues#423: Prepare for 2.x stream #1827

Merged
merged 2 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 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,8 @@ 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 ] : [])
.withOptions(env.KOGITO_APPS_BUILD_MVN_OPTS ? [ env.KOGITO_APPS_BUILD_MVN_OPTS ] : [])
.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.quarkus-3.rewrite.pr
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,6 @@ 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 ] : [])
.withProperty('enforcer.skip')
}
1 change: 1 addition & 0 deletions .ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone
Original file line number Diff line number Diff line change
Expand Up @@ -177,5 +177,6 @@ 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 ] : [])
.withProperty('enforcer.skip')
}
5 changes: 5 additions & 0 deletions .ci/jenkins/Jenkinsfile.setup-branch
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ pipeline {
steps {
script {
getMavenCommand(droolsRepo)
.withOptions(env.BUILD_MVN_OPTS_UPSTREAM ? [ env.BUILD_MVN_OPTS_UPSTREAM ] : [])
.withOptions(env.DROOLS_BUILD_MVN_OPTS_UPSTREAM ? [ env.DROOLS_BUILD_MVN_OPTS_UPSTREAM ] : [])
.withProperty('quickly')
.run('clean install')
}
Expand All @@ -63,6 +65,8 @@ pipeline {
steps {
script {
getMavenCommand(kogitoRuntimesRepo)
.withOptions(env.BUILD_MVN_OPTS_UPSTREAM ? [ env.BUILD_MVN_OPTS_UPSTREAM ] : [])
.withOptions(env.KOGITO_RUNTIMES_BUILD_MVN_OPTS_UPSTREAM ? [ env.KOGITO_RUNTIMES_BUILD_MVN_OPTS_UPSTREAM ] : [])
.withProperty('quickly')
.run('clean install')
}
Expand Down Expand Up @@ -149,5 +153,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)
}
95 changes: 0 additions & 95 deletions .ci/jenkins/Jenkinsfile.sonarcloud

This file was deleted.

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