Skip to content

Commit

Permalink
kie-issues#423: Prepare for 2.x stream (#3174)
Browse files Browse the repository at this point in the history
* kie-issues#423: Prepare for 2.x stream

* update

* Update .ci/jenkins/Jenkinsfile.deploy

---------

Co-authored-by: radtriste <[email protected]>
  • Loading branch information
radtriste and radtriste committed Aug 17, 2023
1 parent 232910a commit 6477b03
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 102 deletions.
7 changes: 6 additions & 1 deletion .ci/jenkins/Jenkinsfile.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -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 ...
Expand Down Expand Up @@ -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())
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 @@ -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 ] : [])
}
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 @@ -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 ] : [])
}
3 changes: 3 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 {
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')
}
}
Expand Down Expand Up @@ -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)
}

Expand Down
76 changes: 0 additions & 76 deletions .ci/jenkins/Jenkinsfile.sonarcloud

This file was deleted.

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 6477b03

Please sign in to comment.