From 879f95d3f49b18fc322fe391d24548d6aa5be49d Mon Sep 17 00:00:00 2001 From: Rodrigo Antunes Date: Wed, 14 Aug 2024 17:13:37 -0300 Subject: [PATCH] Use default maven settings file for release --- .ci/jenkins/Jenkinsfile.deploy | 40 +++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy index 2a06609679a..696fafd849d 100644 --- a/.ci/jenkins/Jenkinsfile.deploy +++ b/.ci/jenkins/Jenkinsfile.deploy @@ -131,28 +131,32 @@ pipeline { stage('Build OptaPlanner') { 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 = getOptaplannerMavenCommand() - .withProperty('maven.test.failure.ignore', true) - .withProperty('operator.image.build') - .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() + .withProperty('maven.test.failure.ignore', true) + .withProperty('operator.image.build') + .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") + if (isRelease()) { updateAntoraYaml(optaplannerFolder) }