From 012a7d71bac7b2e431c8abcece132f28e5db0ff5 Mon Sep 17 00:00:00 2001 From: Rodrigo Antunes Date: Wed, 14 Aug 2024 16:28:02 -0300 Subject: [PATCH] Use default maven settings file for release --- .ci/jenkins/Jenkinsfile.deploy | 42 +++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy index b3d950ac957..e0bb64c0a73 100644 --- a/.ci/jenkins/Jenkinsfile.deploy +++ b/.ci/jenkins/Jenkinsfile.deploy @@ -114,28 +114,32 @@ pipeline { stage('Deploy drools') { steps { script { - withCredentials([usernamePassword(credentialsId: env.MAVEN_REPO_CREDS_ID, usernameVariable: 'REPOSITORY_USER', passwordVariable: 'REPOSITORY_TOKEN')]) { - def installOrDeploy - if (shouldDeployToRepository()) { - installOrDeploy = "deploy -DdeployAtEnd -Dapache.repository.username=${REPOSITORY_USER} -Dapache.repository.password=${REPOSITORY_TOKEN} -DretryFailedDeploymentCount=5" - } else { - installOrDeploy = 'install' - } - def mavenCommand = 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) - - if (isRelease()) { - releaseUtils.gpgImportKeyFromStringWithoutPassword(getReleaseGpgSignKeyCredsId()) - mavenCommand.withProfiles(['apache-release']) - } - + def installOrDeploy + if (shouldDeployToRepository()) { + installOrDeploy = 'deploy -DdeployAtEnd -DretryFailedDeploymentCount=5' + } else { + installOrDeploy = 'install' + } + def mavenCommand = 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) + + if (isRelease()) { + releaseUtils.gpgImportKeyFromStringWithoutPassword(getReleaseGpgSignKeyCredsId()) + mavenCommand.withProfiles(['apache-release']) + } else { configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]) { - mavenCommand.withSettingsXmlFile(MAVEN_SETTINGS_FILE).run("clean $installOrDeploy") + mavenCommand.withSettingsXmlFile(MAVEN_SETTINGS_FILE) + } + withCredentials([usernamePassword(credentialsId: env.MAVEN_REPO_CREDS_ID, usernameVariable: 'REPOSITORY_USER', passwordVariable: 'REPOSITORY_TOKEN')]) { + mavenCommand + .withProperty('apache.repository.username', "${REPOSITORY_USER}") + .withProperty('apache.repository.password', "${REPOSITORY_TOKEN}") } } + mavenCommand.run("clean $installOrDeploy") } } post {