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 83a074b commit 6e37cb8
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 28 deletions.
7 changes: 6 additions & 1 deletion .ci/jenkins/Jenkinsfile.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ pipeline {
steps {
script {
dir(getRepoName()) {
getMavenCommand().withProperty('maven.test.failure.ignore', true).skipTests(params.SKIP_TESTS).run('clean install')
getMavenCommand()
.withOptions(env.BUILD_MVN_OPTS_CURRENT ? [ env.BUILD_MVN_OPTS_CURRENT ] : [])
.withProperty('maven.test.failure.ignore', true)
.skipTests(params.SKIP_TESTS)
.run('clean install')
}
}
}
Expand Down Expand Up @@ -316,6 +320,7 @@ void setDeployPropertyIfNeeded(String key, def value) {
MavenCommand getMavenCommand() {
MavenCommand mvnCmd = new MavenCommand(this, ['-fae', '-ntp'])
.withSettingsXmlId(env.MAVEN_SETTINGS_CONFIG_FILE_ID)
.withOptions(env.BUILD_MVN_OPTS ? [ env.BUILD_MVN_OPTS ] : [])
.withProperty('full')
if (env.MAVEN_DEPENDENCIES_REPOSITORY) {
mvnCmd.withDependencyRepositoryInSettings('deps-repo', env.MAVEN_DEPENDENCIES_REPOSITORY)
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 @@ -198,6 +198,7 @@ String getGitAuthorCredsID() {
MavenCommand getMavenCommand(String directory = '') {
def mvnCmd = new MavenCommand(this, ['-fae', '-ntp'])
.withSettingsXmlId(env.MAVEN_SETTINGS_CONFIG_FILE_ID)
.withOptions(env.BUILD_MVN_OPTS ? [ env.BUILD_MVN_OPTS ] : [])
if (directory) {
mvnCmd.inDirectory(directory)
}
Expand Down
66 changes: 39 additions & 27 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 @@ -30,7 +34,7 @@ Map getMultijobPRConfig(JenkinsFolder jobFolder) {
env : [
// Sonarcloud analysis is disabled for examples
KOGITO_EXAMPLES_SUBFOLDER_POM: 'kogito-quarkus-examples/',
BUILD_MVN_OPTS_CURRENT: "${defaultBuildMvnOptsCurrent} ${jobFolder.getEnvironmentName() ? '' : '-Dvalidate-formatting'}", // Validate formatting only for default env
BUILD_MVN_OPTS_CURRENT: "${defaultBuildMvnOptsCurrent} ${getExamplesBuildMvnOptions(jobFolder).join(' ')}",
]
],
[
Expand All @@ -49,10 +53,19 @@ Map getMultijobPRConfig(JenkinsFolder jobFolder) {
]
]
]

return jobConfig
}

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

// PR checks
KogitoJobUtils.createAllEnvironmentsPerRepoPRJobs(this) { jobFolder -> getMultijobPRConfig(jobFolder) }
setupDeployJob(JobType.PULL_REQUEST, 'kogito-bdd')
Expand All @@ -61,30 +74,34 @@ setupDeployJob(JobType.PULL_REQUEST, 'kogito-bdd')
createSetupBranchJob()

// Nightly jobs
KogitoJobUtils.createNightlyBuildChainBuildAndDeployJobForCurrentRepo(this, '', true)

// Environment nightlies
setupSpecificBuildChainNightlyJob('native')

// Jobs with integration branch
setupNightlyQuarkusIntegrationJob('quarkus-main')
setupNightlyQuarkusIntegrationJob('quarkus-branch')
setupNightlyQuarkusIntegrationJob('quarkus-lts')
setupNightlyQuarkusIntegrationJob('native-lts')
Closure setup4AMCronTriggerJobParamsGetter = { script ->
def jobParams = JobParamsUtils.DEFAULT_PARAMS_GETTER(script)
jobParams.triggers = [ cron: 'H 4 * * *' ]
return jobParams
}
Closure nightlyJobParamsGetter = isMainStream() ? JobParamsUtils.DEFAULT_PARAMS_GETTER : setup4AMCronTriggerJobParamsGetter
KogitoJobUtils.createNightlyBuildChainBuildAndDeployJobForCurrentRepo(this, '', true, 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)
setupPostReleaseJob()

KogitoJobUtils.createQuarkusUpdateToolsJob(this, 'kogito-examples', [
properties: [ 'quarkus-plugin.version', 'quarkus.platform.version' ],
])
if (isMainStream()) {
KogitoJobUtils.createQuarkusUpdateToolsJob(this, 'kogito-examples', [
properties: [ 'quarkus-plugin.version', 'quarkus.platform.version' ],
])

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

/////////////////////////////////////////////////////////////////
Expand All @@ -95,15 +112,14 @@ 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() {
def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-examples', JobType.SETUP_BRANCH, "${jenkins_path}/Jenkinsfile.setup-branch", 'Kogito Examples Init branch')
JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams)
jobParams.env.putAll([
REPO_NAME: 'kogito-examples',
JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",

GIT_AUTHOR: "${GIT_AUTHOR_NAME}",
Expand Down Expand Up @@ -142,7 +158,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-examples',
PROPERTIES_FILE_NAME: 'deployment.properties',

JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",
Expand Down Expand Up @@ -201,7 +216,6 @@ void setupPromoteJob(JobType jobType) {
def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-examples-promote', jobType, "${jenkins_path}/Jenkinsfile.promote", 'Kogito Examples Promote')
JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams)
jobParams.env.putAll([
REPO_NAME: 'kogito-examples',
PROPERTIES_FILE_NAME: 'deployment.properties',

JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",
Expand Down Expand Up @@ -238,7 +252,6 @@ void setupPostReleaseJob() {
def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-examples-post-release', JobType.RELEASE, "${jenkins_path}/Jenkinsfile.post-release", 'Kogito Examples Post Release')
JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams)
jobParams.env.putAll([
REPO_NAME: 'kogito-examples',
JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",

GIT_AUTHOR: "${GIT_AUTHOR_NAME}",
Expand All @@ -259,7 +272,6 @@ void setupPostReleaseJob() {
}
}


void setupPrQuarkus3RewriteJob() {
def jobParams = JobParamsUtils.getBasicJobParamsWithEnv(this, 'kogito-examples.rewrite', JobType.PULL_REQUEST, 'quarkus-3', "${jenkins_path}/Jenkinsfile.quarkus-3.rewrite.pr", 'Kogito Examples Quarkus 3 rewrite patch regeneration')
JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams)
Expand Down Expand Up @@ -299,4 +311,4 @@ void setupStandaloneQuarkus3RewriteJob() {
booleanParam('SEND_NOTIFICATION', false, 'In case you want the pipeline to send a notification on CI channel for this run.')
}
}
}
}

0 comments on commit 6e37cb8

Please sign in to comment.