This is an automated email from the ASF dual-hosted git repository.
tzimanyi pushed a commit to branch main
in repository
https://gitbox.apache.org/repos/asf/incubator-kie-kogito-examples.git
The following commit(s) were added to refs/heads/main by this push:
new 4f084f93f kie-issues#667: fix cleanup and settingsXml handling (#1820)
4f084f93f is described below
commit 4f084f93fe378d1422835f4004de4982d20c71b2
Author: Jan Stastny <[email protected]>
AuthorDate: Thu Nov 2 15:24:51 2023 +0100
kie-issues#667: fix cleanup and settingsXml handling (#1820)
* kie-issues#667: fix cleanup and settingsXml handling
* adjust also MavenCommands passed to maven library methods
---------
Co-authored-by: jstastny-cz <[email protected]>
---
.ci/jenkins/Jenkinsfile.deploy | 60 ++++++++++++------
.ci/jenkins/Jenkinsfile.post-release | 4 +-
.ci/jenkins/Jenkinsfile.promote | 4 +-
.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr | 16 ++---
.../Jenkinsfile.quarkus-3.rewrite.standalone | 10 ++-
.ci/jenkins/Jenkinsfile.setup-branch | 71 +++++++++++++++-------
6 files changed, 110 insertions(+), 55 deletions(-)
diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy
index 172a08172..634ccd5ad 100644
--- a/.ci/jenkins/Jenkinsfile.deploy
+++ b/.ci/jenkins/Jenkinsfile.deploy
@@ -32,7 +32,7 @@ pipeline {
stage('Initialize') {
steps {
script {
- cleanWs()
+ cleanWs(disableDeferredWipeout: true)
checkout scm
examplesHelper = load
'.ci/jenkins/helper_scripts/examples.groovy'
@@ -93,11 +93,28 @@ pipeline {
dir(getRepoName()) {
def oldKogitoVersion = readMavenPom(file:
'pom.xml').version
echo "Got old Kogito version ${oldKogitoVersion}"
-
-
maven.mvnVersionsUpdateParentAndChildModules(getMavenCommand(),
getProjectVersion(), true)
- maven.mvnSetVersionProperty(getMavenCommand(),
'version.org.kie.kogito', getProjectVersion())
- maven.mvnSetVersionProperty(getMavenCommand(),
'kogito.bom.version', getProjectVersion())
- maven.mvnSetVersionProperty(getMavenCommand(),
'version.org.drools', getDroolsVersion())
+ configFileProvider([configFile(fileId:
env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
+ maven.mvnVersionsUpdateParentAndChildModules(
+
getMavenCommand().withSettingsXmlFile(MAVEN_SETTINGS_FILE),
+ getProjectVersion(),
+ true
+ )
+ maven.mvnSetVersionProperty(
+
getMavenCommand().withSettingsXmlFile(MAVEN_SETTINGS_FILE),
+ 'version.org.kie.kogito',
+ getProjectVersion()
+ )
+ maven.mvnSetVersionProperty(
+
getMavenCommand().withSettingsXmlFile(MAVEN_SETTINGS_FILE),
+ 'kogito.bom.version',
+ getProjectVersion()
+ )
+ maven.mvnSetVersionProperty(
+
getMavenCommand().withSettingsXmlFile(MAVEN_SETTINGS_FILE),
+ 'version.org.drools',
+ getDroolsVersion()
+ )
+ }
if (getProjectVersion() != oldKogitoVersion) {
def status = sh(script: "grep -ir
'${oldKogitoVersion}' --include='pom.xml'", returnStatus: true)
@@ -121,7 +138,11 @@ pipeline {
if (params.SKIP_TESTS) {
mvnCmd.skipTests() // Conflict somehow with Python
testing. If `skipTests={anyvalue}` is set, then exec plugin is not executed ...
}
- mvnCmd.run('clean install')
+ configFileProvider([configFile(fileId:
env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
+ mvnCmd
+ .withSettingsXmlFile(MAVEN_SETTINGS_FILE)
+ .run('clean install')
+ }
}
}
}
@@ -200,7 +221,7 @@ pipeline {
}
cleanup {
script {
- util.cleanNode('docker')
+ util.cleanNode()
}
}
}
@@ -312,7 +333,6 @@ 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) {
@@ -333,20 +353,24 @@ void runMavenDeploy(boolean localDeployment = false) {
}
mvnCmd.withOptions(examplesHelper.getDeployableArtifactIds().collect {
"-pl :${it} "})
-
- mvnCmd.skipTests(true).run('clean deploy')
-
- mvnCmd.skipTests(true).run('clean deploy')
+ configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID,
variable: 'MAVEN_SETTINGS_FILE')]){
+ mvnCmd
+ .skipTests(true)
+ .withSettingsXmlFile(MAVEN_SETTINGS_FILE)
+ .run('clean deploy')
+ }
}
void runMavenStage() {
- MavenStagingHelper stagingHelper = getStagingHelper()
-
deployProperties.putAll(stagingHelper.stageLocalArtifacts(env.NEXUS_STAGING_PROFILE_ID,
getLocalDeploymentFolder()))
-
stagingHelper.promoteStagingRepository(env.NEXUS_BUILD_PROMOTION_PROFILE_ID)
+ configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID,
variable: 'MAVEN_SETTINGS_FILE')]){
+ MavenStagingHelper stagingHelper =
getStagingHelper(getMavenCommand().withSettingsXmlFile(MAVEN_SETTINGS_FILE))
+
deployProperties.putAll(stagingHelper.stageLocalArtifacts(env.NEXUS_STAGING_PROFILE_ID,
getLocalDeploymentFolder()))
+
stagingHelper.promoteStagingRepository(env.NEXUS_BUILD_PROMOTION_PROFILE_ID)
+ }
}
-MavenStagingHelper getStagingHelper() {
- return new MavenStagingHelper(this, getMavenCommand())
+MavenStagingHelper getStagingHelper(def mavenCommand) {
+ return new MavenStagingHelper(this, mavenCommand)
.withNexusReleaseUrl(env.NEXUS_RELEASE_URL)
.withNexusReleaseRepositoryId(env.NEXUS_RELEASE_REPOSITORY_ID)
}
diff --git a/.ci/jenkins/Jenkinsfile.post-release
b/.ci/jenkins/Jenkinsfile.post-release
index e183f4593..a68d5c5f7 100644
--- a/.ci/jenkins/Jenkinsfile.post-release
+++ b/.ci/jenkins/Jenkinsfile.post-release
@@ -23,7 +23,7 @@ pipeline {
stage('Initialization') {
steps {
script {
- cleanWs()
+ cleanWs(disableDeferredWipeout: true)
if (params.DISPLAY_NAME) {
currentBuild.displayName = params.DISPLAY_NAME
@@ -53,7 +53,7 @@ pipeline {
}
cleanup {
script {
- util.cleanNode('docker')
+ util.cleanNode()
}
}
}
diff --git a/.ci/jenkins/Jenkinsfile.promote b/.ci/jenkins/Jenkinsfile.promote
index 6ce2d3a6b..d233fa149 100644
--- a/.ci/jenkins/Jenkinsfile.promote
+++ b/.ci/jenkins/Jenkinsfile.promote
@@ -27,7 +27,7 @@ pipeline {
stage('Initialization') {
steps {
script {
- cleanWs()
+ cleanWs(disableDeferredWipeout: true)
checkout scm
examplesHelper = load
'.ci/jenkins/helper_scripts/examples.groovy'
@@ -77,7 +77,7 @@ pipeline {
}
cleanup {
script {
- util.cleanNode('docker')
+ util.cleanNode()
}
}
}
diff --git a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr
b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr
index d794139f2..c945249b8 100644
--- a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr
+++ b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr
@@ -21,7 +21,7 @@ pipeline {
stage('Initialization') {
steps {
script {
- cleanWs()
+ cleanWs(disableDeferredWipeout: true)
sh 'printenv > env_props'
archiveArtifacts artifacts: 'env_props'
@@ -41,7 +41,12 @@ pipeline {
dir(project) {
githubscm.checkoutIfExists(project, changeAuthor,
changeBranch, 'apache', changeTarget, true)
sh '.ci/environments/update.sh quarkus-3'
-
getMavenCommand().withProperty('quickly').run('clean install')
+ configFileProvider([configFile(fileId:
env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
+ getMavenCommand()
+ .withProperty('quickly')
+ .withSettingsXmlFile(MAVEN_SETTINGS_FILE)
+ .run('clean install')
+ }
}
}
}
@@ -72,10 +77,8 @@ pipeline {
}
}
post {
- always {
- script {
- cleanWs()
- }
+ cleanup {
+ cleanWs()
}
unsuccessful {
script {
@@ -95,7 +98,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')
}
diff --git a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone
b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone
index 81bfac262..814def1e2 100644
--- a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone
+++ b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone
@@ -59,7 +59,12 @@ pipeline {
dir(project) {
githubscm.checkoutIfExists(project,
getGitAuthor(), getBuildBranch(), getBaseAuthor(), getBaseBranch(), true)
sh '.ci/environments/update.sh quarkus-3'
-
getMavenCommand().withProperty('quickly').run('clean install')
+ configFileProvider([configFile(fileId:
env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
+ getMavenCommand()
+ .withProperty('quickly')
+ .withSettingsXmlFile(MAVEN_SETTINGS_FILE)
+ .run('clean install')
+ }
}
}
}
@@ -120,7 +125,7 @@ pipeline {
void clean() {
sh 'rm -rf ~/.rewrite-cache/'
- util.cleanNode('docker')
+ util.cleanNode()
}
void sendErrorNotification() {
@@ -174,7 +179,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')
}
diff --git a/.ci/jenkins/Jenkinsfile.setup-branch
b/.ci/jenkins/Jenkinsfile.setup-branch
index 2675617d1..6dc036c84 100644
--- a/.ci/jenkins/Jenkinsfile.setup-branch
+++ b/.ci/jenkins/Jenkinsfile.setup-branch
@@ -30,7 +30,7 @@ pipeline {
stage('Initialize') {
steps {
script {
- cleanWs()
+ cleanWs(disableDeferredWipeout: true)
checkout scm
examplesHelper = load
'.ci/jenkins/helper_scripts/examples.groovy'
@@ -49,33 +49,42 @@ pipeline {
stage('Build Drools') {
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')
+ configFileProvider([configFile(fileId:
env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
+ 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')
+ .withSettingsXmlFile(MAVEN_SETTINGS_FILE)
+ .run('clean install')
+ }
}
}
}
stage('Build Kogito Runtimes') {
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')
+ configFileProvider([configFile(fileId:
env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
+ 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')
+ .withSettingsXmlFile(MAVEN_SETTINGS_FILE)
+ .run('clean install')
+ }
}
}
}
stage('Build Kogito Apps') {
steps {
script {
- getMavenCommand(kogitoAppsRepo)
- .withOptions(env.BUILD_MVN_OPTS_UPSTREAM ? [
env.BUILD_MVN_OPTS_UPSTREAM ] : [])
- .withOptions(env.KOGITO_APPS_BUILD_MVN_OPTS_UPSTREAM ?
[ env.KOGITO_APPS_BUILD_MVN_OPTS_UPSTREAM ] : [])
- .withProperty('quickly')
- .run('clean install')
+ configFileProvider([configFile(fileId:
env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
+ getMavenCommand(kogitoAppsRepo)
+ .withOptions(env.BUILD_MVN_OPTS_UPSTREAM ? [
env.BUILD_MVN_OPTS_UPSTREAM ] : [])
+
.withOptions(env.KOGITO_APPS_BUILD_MVN_OPTS_UPSTREAM ? [
env.KOGITO_APPS_BUILD_MVN_OPTS_UPSTREAM ] : [])
+ .withProperty('quickly')
+ .withSettingsXmlFile(MAVEN_SETTINGS_FILE)
+ .run('clean install')
+ }
}
}
}
@@ -85,11 +94,28 @@ pipeline {
dir(getRepoName()) {
def oldKogitoVersion = readMavenPom(file:
'pom.xml').version
echo "Got old Kogito version ${oldKogitoVersion}"
-
-
maven.mvnVersionsUpdateParentAndChildModules(getMavenCommand(),
getKogitoVersion(), true)
- maven.mvnSetVersionProperty(getMavenCommand(),
'version.org.kie.kogito', getKogitoVersion())
- maven.mvnSetVersionProperty(getMavenCommand(),
'kogito.bom.version', getKogitoVersion())
- maven.mvnSetVersionProperty(getMavenCommand(),
'version.org.drools', getDroolsVersion())
+ configFileProvider([configFile(fileId:
env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
+ maven.mvnVersionsUpdateParentAndChildModules(
+
getMavenCommand().withSettingsXmlFile(MAVEN_SETTINGS_FILE),
+ getKogitoVersion(),
+ true
+ )
+ maven.mvnSetVersionProperty(
+
getMavenCommand().withSettingsXmlFile(MAVEN_SETTINGS_FILE),
+ 'version.org.kie.kogito',
+ getKogitoVersion()
+ )
+ maven.mvnSetVersionProperty(
+
getMavenCommand().withSettingsXmlFile(MAVEN_SETTINGS_FILE),
+ 'kogito.bom.version',
+ getKogitoVersion()
+ )
+ maven.mvnSetVersionProperty(
+
getMavenCommand().withSettingsXmlFile(MAVEN_SETTINGS_FILE),
+ 'version.org.drools',
+ getDroolsVersion()
+ )
+ }
if (getKogitoVersion() != oldKogitoVersion) {
def status = sh(script: "grep -ir
'${oldKogitoVersion}' --include='pom.xml'", returnStatus: true)
@@ -138,7 +164,7 @@ pipeline {
}
cleanup {
script {
- util.cleanNode('docker')
+ util.cleanNode()
}
}
}
@@ -200,7 +226,6 @@ 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)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]