mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-18 13:35:50 +00:00
Jenkins: Run Test & Deploy stages in parallel
This commit is contained in:
parent
f4ebbafc14
commit
e92ae405dd
1 changed files with 32 additions and 21 deletions
53
Jenkinsfile
vendored
53
Jenkinsfile
vendored
|
@ -16,21 +16,26 @@ node {
|
||||||
archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true
|
archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Test') {
|
parallel(
|
||||||
String jacoco = "org.jacoco:jacoco-maven-plugin:0.7.7.201606060606";
|
test: {
|
||||||
mvn "${jacoco}:prepare-agent test ${jacoco}:report"
|
stage('Test') {
|
||||||
|
String jacoco = "org.jacoco:jacoco-maven-plugin:0.7.7.201606060606";
|
||||||
|
mvn "${jacoco}:prepare-agent test ${jacoco}:report"
|
||||||
|
|
||||||
// Archive JUnit results, if any
|
// Archive JUnit results, if any
|
||||||
junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml'
|
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"
|
||||||
|
|
||||||
stage('Integration Test') {
|
// Archive JUnit results, if any
|
||||||
String jacoco = "org.jacoco:jacoco-maven-plugin:0.7.7.201606060606";
|
junit allowEmptyResults: true, testResults: '**/target/failsafe-reports/TEST-*.xml'
|
||||||
mvn "${jacoco}:prepare-agent-integration failsafe:integration-test ${jacoco}:report-integration"
|
}
|
||||||
|
}
|
||||||
// Archive JUnit results, if any
|
)
|
||||||
junit allowEmptyResults: true, testResults: '**/target/failsafe-reports/TEST-*.xml'
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('SonarQube Analysis') {
|
stage('SonarQube Analysis') {
|
||||||
withCredentials([credentials]) {
|
withCredentials([credentials]) {
|
||||||
|
@ -40,15 +45,21 @@ node {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Deploy Artifacts') {
|
parallel(
|
||||||
String releaseProp = "-DaltReleaseDeploymentRepository=${cesFqdn}::default::${cesUrl}/nexus/content/repositories/releases/";
|
deployArtifacts: {
|
||||||
String snapshotProp = "-DaltSnapshotDeploymentRepository=${cesFqdn}::default::${cesUrl}/nexus/content/repositories/snapshots/";
|
stage('Deploy Artifacts') {
|
||||||
mvn "-DskipTests deploy ${releaseProp} ${snapshotProp}"
|
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') {
|
stage('Deploy Application') {
|
||||||
sh "ansible-playbook playbook.yaml"
|
sh "ansible-playbook playbook.yaml"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
String cesFqdn;
|
String cesFqdn;
|
||||||
|
|
Loading…
Reference in a new issue