diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy index 12b11ea345c..602ac06923d 100644 --- a/.ci/jenkins/Jenkinsfile.deploy +++ b/.ci/jenkins/Jenkinsfile.deploy @@ -30,7 +30,7 @@ pipeline { stage('Initialize') { steps { script { - cleanWs() + cleanWs(disableDeferredWipeout: true) if (params.DISPLAY_NAME) { currentBuild.displayName = params.DISPLAY_NAME @@ -83,19 +83,28 @@ pipeline { } steps { script { - maven.mvnVersionsSet(getMavenCommand(), getProjectVersion(), !isRelease()) + configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){ + maven.mvnVersionsSet( + getMavenCommand().withSettingsXmlFile(MAVEN_SETTINGS_FILE), + getProjectVersion(), + !isRelease() + ) + } } } } stage('Build & Test') { steps { script { - getMavenCommand() - .withOptions(env.DROOLS_BUILD_MVN_OPTS ? [ env.DROOLS_BUILD_MVN_OPTS ] : []) - .withOptions(env.BUILD_MVN_OPTS_CURRENT ? [ env.BUILD_MVN_OPTS_CURRENT ] : []) - .withProperty('maven.test.failure.ignore', true) - .skipTests(params.SKIP_TESTS) - .run('clean install') + configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){ + getMavenCommand() + .withOptions(env.DROOLS_BUILD_MVN_OPTS ? [ env.DROOLS_BUILD_MVN_OPTS ] : []) + .withOptions(env.BUILD_MVN_OPTS_CURRENT ? [ env.BUILD_MVN_OPTS_CURRENT ] : []) + .withProperty('maven.test.failure.ignore', true) + .skipTests(params.SKIP_TESTS) + .withSettingsXmlFile(MAVEN_SETTINGS_FILE) + .run('clean install') + } } } post { @@ -165,7 +174,7 @@ pipeline { } cleanup { script { - util.cleanNode('docker') + util.cleanNode() } } } @@ -252,7 +261,6 @@ void setDeployPropertyIfNeeded(String key, def value) { MavenCommand getMavenCommand(String directory = '') { directory = directory ?: getRepoName() def mvnCmd = new MavenCommand(this, ['-fae', '-ntp']) - .withSettingsXmlId(env.MAVEN_SETTINGS_CONFIG_FILE_ID) .withOptions(env.BUILD_MVN_OPTS ? [ env.BUILD_MVN_OPTS ] : []) .inDirectory(directory) if (!isMainStream()) { // Workaround as enforcer rules may not be fixed on other streams @@ -272,20 +280,25 @@ void runMavenDeploy(boolean localDeployment = false) { mvnCmd.withDeployRepository(env.MAVEN_DEPLOY_REPOSITORY) } - mvnCmd.skipTests(true) + configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){ + mvnCmd.skipTests(true) .withOptions(env.DROOLS_BUILD_MVN_OPTS ? [ env.DROOLS_BUILD_MVN_OPTS ] : []) .withOptions(env.BUILD_MVN_OPTS_CURRENT ? [ env.BUILD_MVN_OPTS_CURRENT ] : []) + .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(MavenCommand mavenCommand) { + return new MavenStagingHelper(this, mavenCommand) .withNexusReleaseUrl(env.NEXUS_RELEASE_URL) .withNexusReleaseRepositoryId(env.NEXUS_RELEASE_REPOSITORY_ID) } diff --git a/.ci/jenkins/Jenkinsfile.promote b/.ci/jenkins/Jenkinsfile.promote index 2b027750cfe..661c6e1d305 100644 --- a/.ci/jenkins/Jenkinsfile.promote +++ b/.ci/jenkins/Jenkinsfile.promote @@ -73,13 +73,16 @@ pipeline { } steps { script { - getMavenCommand() - .withOptions(env.DROOLS_BUILD_MVN_OPTS ? [ env.DROOLS_BUILD_MVN_OPTS ] : []) - .withOptions(env.BUILD_MVN_OPTS_CURRENT ? [ env.BUILD_MVN_OPTS_CURRENT ] : []) - .inDirectory(getRepoName()) - .skipTests(true) - .withProperty('full') - .run('clean install') + configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){ + getMavenCommand() + .withOptions(env.DROOLS_BUILD_MVN_OPTS ? [ env.DROOLS_BUILD_MVN_OPTS ] : []) + .withOptions(env.BUILD_MVN_OPTS_CURRENT ? [ env.BUILD_MVN_OPTS_CURRENT ] : []) + .inDirectory(getRepoName()) + .skipTests(true) + .withProperty('full') + .withSettingsXmlFile(MAVEN_SETTINGS_FILE) + .run('clean install') + } uploadFileMgmt(getRepoName()) } } @@ -91,7 +94,7 @@ pipeline { } cleanup { script { - util.cleanNode('docker') + util.cleanNode() } } } @@ -198,7 +201,6 @@ void tagLatest() { MavenCommand getMavenCommand() { mvnCmd = new MavenCommand(this, ['-fae', '-ntp']) - .withSettingsXmlId("${env.MAVEN_SETTINGS_CONFIG_FILE_ID}") .withOptions(env.BUILD_MVN_OPTS ? [ env.BUILD_MVN_OPTS ] : []) if (env.MAVEN_DEPENDENCIES_REPOSITORY) { mvnCmd.withDependencyRepositoryInSettings('deps-repo', env.MAVEN_DEPENDENCIES_REPOSITORY) diff --git a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr index 5a4b689871c..b034906a550 100644 --- a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr +++ b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr @@ -20,7 +20,7 @@ pipeline { stage('Initialization') { steps { script { - cleanWs() + cleanWs(disableDeferredWipeout: true) sh 'printenv > env_props' archiveArtifacts artifacts: 'env_props' @@ -58,10 +58,8 @@ pipeline { } } post { - always { - script { - cleanWs() - } + cleanup { + cleanWs() } unsuccessful { script { diff --git a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone index 4e2c7cf7ee9..03d3f07cc3f 100644 --- a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone +++ b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone @@ -107,7 +107,7 @@ pipeline { void clean() { sh 'rm -rf ~/.rewrite-cache/' - util.cleanNode('docker') + util.cleanNode() } void sendErrorNotification() { diff --git a/.ci/jenkins/Jenkinsfile.setup-branch b/.ci/jenkins/Jenkinsfile.setup-branch index 95b74cfcbe6..b8502466ea9 100644 --- a/.ci/jenkins/Jenkinsfile.setup-branch +++ b/.ci/jenkins/Jenkinsfile.setup-branch @@ -26,7 +26,7 @@ pipeline { stage('Initialize') { steps { script { - cleanWs() + cleanWs(disableDeferredWipeout: true) if (params.DISPLAY_NAME) { currentBuild.displayName = params.DISPLAY_NAME @@ -41,7 +41,13 @@ pipeline { steps { script { dir(getRepoName()) { - maven.mvnVersionsSet(getMavenCommand(), getDroolsVersion(), true) + configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){ + maven.mvnVersionsSet( + getMavenCommand().withSettingsXmlFile(MAVEN_SETTINGS_FILE), + getDroolsVersion(), + true + ) + } } } } @@ -82,7 +88,7 @@ pipeline { } cleanup { script { - util.cleanNode('docker') + util.cleanNode() } } } @@ -125,7 +131,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('full') } diff --git a/.ci/jenkins/project/Jenkinsfile.post-release b/.ci/jenkins/project/Jenkinsfile.post-release index a23c2cff2e3..bbe70e1c238 100644 --- a/.ci/jenkins/project/Jenkinsfile.post-release +++ b/.ci/jenkins/project/Jenkinsfile.post-release @@ -29,7 +29,7 @@ pipeline { stage('Initialization') { steps { script { - cleanWs() + cleanWs(disableDeferredWipeout: true) } } } @@ -58,7 +58,7 @@ pipeline { } } post { - always { + cleanup { cleanWs() } unsuccessful { diff --git a/.ci/jenkins/project/Jenkinsfile.release b/.ci/jenkins/project/Jenkinsfile.release index 65943d551aa..726b95ce9cb 100644 --- a/.ci/jenkins/project/Jenkinsfile.release +++ b/.ci/jenkins/project/Jenkinsfile.release @@ -149,6 +149,8 @@ pipeline { script { saveReleaseProperties() } + } + cleanup { cleanWs() } success {