Skip to content

Commit

Permalink
[kie-issues#1123] adjust deploy operation (#1195)
Browse files Browse the repository at this point in the history
Co-authored-by: jstastny-cz <[email protected]>
  • Loading branch information
jstastny-cz and jstastny-cz authored May 16, 2024
1 parent 10f5921 commit ba26912
Showing 1 changed file with 11 additions and 30 deletions.
41 changes: 11 additions & 30 deletions dsl/seed/jenkinsfiles/Jenkinsfile.buildchain
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,19 @@ pipeline {
script {
env.BUILD_MVN_OPTS_CURRENT = "${env.BUILD_MVN_OPTS_CURRENT ?: ''} ${getBuildMavenOptsCurrent()}"
echo "BUILD_MVN_OPTS_CURRENT = ${BUILD_MVN_OPTS_CURRENT}"
if (mavenDeployArtifacts) {
env.DEPLOY_MVN_OPTS = "${env.DEPLOY_MVN_OPTS ?: ''} -DaltDeploymentRepository=local::default::file://${getMavenDeployLocalDir()}"
echo "DEPLOY_MVN_OPTS = ${DEPLOY_MVN_OPTS}"
}
withCredentials([usernamePassword(credentialsId: mavenDeployRepositoryCredsId, usernameVariable: 'REPOSITORY_USER', passwordVariable: 'REPOSITORY_TOKEN')]) {
if (mavenDeployArtifacts) {
env.DEPLOY_MVN_OPTS = "${env.DEPLOY_MVN_OPTS ?: ''} -DdeployAtEnd -Dapache.repository.username=${REPOSITORY_USER} -Dapache.repository.password=${REPOSITORY_TOKEN} -DretryFailedDeploymentCount=5"
echo "DEPLOY_MVN_OPTS = ${DEPLOY_MVN_OPTS}"
}

configFileProvider([configFile(fileId: settingsXmlId, variable: 'MAVEN_SETTINGS_FILE')]) {
withCredentials([string(credentialsId: "${BUILDCHAIN_CONFIG_GIT_TOKEN_CREDENTIALS_ID}", variable: 'GITHUB_TOKEN')]) {
env.BUILD_MVN_OPTS = "${env.BUILD_MVN_OPTS ?: ''} -s ${MAVEN_SETTINGS_FILE} -Dmaven.wagon.http.ssl.insecure=true -Dmaven.test.failure.ignore=true"
echo "BUILD_MVN_OPTS = ${BUILD_MVN_OPTS}"
configFileProvider([configFile(fileId: settingsXmlId, variable: 'MAVEN_SETTINGS_FILE')]) {
withCredentials([string(credentialsId: "${BUILDCHAIN_CONFIG_GIT_TOKEN_CREDENTIALS_ID}", variable: 'GITHUB_TOKEN')]) {
env.BUILD_MVN_OPTS = "${env.BUILD_MVN_OPTS ?: ''} -s ${MAVEN_SETTINGS_FILE} -Dmaven.wagon.http.ssl.insecure=true -Dmaven.test.failure.ignore=true"
echo "BUILD_MVN_OPTS = ${BUILD_MVN_OPTS}"

sh getBuildChainCommandline(true)
sh getBuildChainCommandline(true)
}
}
}
}
Expand Down Expand Up @@ -156,27 +158,6 @@ pipeline {
}
}
}
stage('Upload artifacts to repository') {
when {
expression { return mavenDeployArtifacts }
}
steps {
script {
withCredentials([usernamePassword(credentialsId: mavenDeployRepositoryCredsId, usernameVariable: 'REPOSITORY_USER', passwordVariable: 'REPOSITORY_TOKEN')]) {
configFileProvider([configFile(fileId: settingsXmlId, variable: 'MAVEN_SETTINGS_FILE')]) {
new MavenCommand(this)
.withSettingsXmlFile(MAVEN_SETTINGS_FILE)
.withProperty('wagon.source', "file://${getMavenDeployLocalDir()}")
.withProperty('wagon.target', mavenDeployRepository)
.withProperty('wagon.targetId', 'apache-snapshots-repository')
.withProperty('apache.snapshot.repository.username', REPOSITORY_USER)
.withProperty('apache.snapshot.repository.password', REPOSITORY_TOKEN)
.run("org.codehaus.mojo:wagon-maven-plugin:2.0.2:merge-maven-repos")
}
}
}
}
}
}
}
stage('Trigger downstream jobs') {
Expand Down

0 comments on commit ba26912

Please sign in to comment.