Jenkins: Run Test & Deploy stages in parallel

This commit is contained in:
Johannes Schnatterer 2017-10-09 15:31:28 +02:00
parent f4ebbafc14
commit e92ae405dd

13
Jenkinsfile vendored
View file

@ -16,6 +16,8 @@ node {
archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true
}
parallel(
test: {
stage('Test') {
String jacoco = "org.jacoco:jacoco-maven-plugin:0.7.7.201606060606";
mvn "${jacoco}:prepare-agent test ${jacoco}:report"
@ -23,7 +25,8 @@ node {
// Archive JUnit results, if any
junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml'
}
},
integrationTest: {
stage('Integration Test') {
String jacoco = "org.jacoco:jacoco-maven-plugin:0.7.7.201606060606";
mvn "${jacoco}:prepare-agent-integration failsafe:integration-test ${jacoco}:report-integration"
@ -31,6 +34,8 @@ node {
// Archive JUnit results, if any
junit allowEmptyResults: true, testResults: '**/target/failsafe-reports/TEST-*.xml'
}
}
)
stage('SonarQube Analysis') {
withCredentials([credentials]) {
@ -40,16 +45,22 @@ node {
}
}
parallel(
deployArtifacts: {
stage('Deploy Artifacts') {
String releaseProp = "-DaltReleaseDeploymentRepository=${cesFqdn}::default::${cesUrl}/nexus/content/repositories/releases/";
String snapshotProp = "-DaltSnapshotDeploymentRepository=${cesFqdn}::default::${cesUrl}/nexus/content/repositories/snapshots/";
mvn "-DskipTests deploy ${releaseProp} ${snapshotProp}"
}
},
deployApplication: {
stage('Deploy Application') {
sh "ansible-playbook playbook.yaml"
}
}
)
}
String cesFqdn;
String cesUrl;