Deploy strongbox artifacts upon successful build.
@Library('jenkins-shared-libraries')
def REPO_NAME = 'strongbox/strongbox'
+def SERVER_ID = 'carlspring-oss-snapshots'
+def SERVER_URL = 'https://dev.carlspring.org/nexus/content/repositories/carlspring-oss-snapshots/'
pipeline {
agent { label 'opensuse-slave' }
@@ -35,8 +37,6 @@ pipeline {
"-Dformat=XML " +
"-Dsonar.dependencyCheck.reportPath=${WORKSPACE}/dependency-check-report.xml " +
"-Pdependency-check "
-
- build(job: "strongbox/strongbox-os-builds", wait: false)
}
}
else {
@@ -66,8 +66,32 @@ pipeline {
}
}
}
+ stage('Deploy') {
+ when {
+ expression { BRANCH_NAME == 'master' && (currentBuild.result == null || currentBuild.result == 'SUCCESS') }
+ }
+ steps {
+ script {
+ withMaven(maven: 'maven-3.3.9',
+ mavenSettingsConfig: 'a5452263-40e5-4d71-a5aa-4fc94a0e6833',
+ mavenLocalRepo: '/home/jenkins/.m2/repository')
+ {
+ sh "mvn package deploy:deploy" +
+ " -Dmaven.test.skip=true" +
+ " -DaltDeploymentRepository=${SERVER_ID}::default::${SERVER_URL}"
+ }
+ }
+ }
+ }
}
post {
+ success {
+ script {
+ if(BRANCH_NAME == 'master') {
+ build(job: "strongbox/strongbox-os-builds", wait: false)
+ }
+ }
+ }
changed {
script {
if(BRANCH_NAME == 'master') {
@@ -81,3 +105,4 @@ pipeline {
}
}
}
+
