File tree Expand file tree Collapse file tree 1 file changed +18
-29
lines changed
Expand file tree Collapse file tree 1 file changed +18
-29
lines changed Original file line number Diff line number Diff line change 1- pipeline {
2- agent none // assign agents per stage
3- tools {
4- maven " MAVEN" // must match Maven tool name in Jenkins
1+ stage(" Build" ) {
2+ agent { label ' built-in' } // Windows master
3+ steps {
4+ bat " mvn clean package"
5+ stash includes : ' target/*.jar' , name : ' myAppJar'
56 }
6- stages {
7- stage(" Build" ) {
8- agent { label ' built-in' } // build on Windows master
7+ }
8+
9+ stage(" Run on Slaves" ) {
10+ parallel {
11+ stage(" Run on Slave1" ) {
12+ agent { label ' slave1' }
913 steps {
10- bat " mvn clean package"
14+ unstash ' myAppJar'
15+ sh " java -cp target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App"
1116 }
1217 }
13- stage(" Run on Slaves" ) {
14- parallel {
15- stage(" Run on Slave1" ) {
16- agent { label ' server1' } // Linux slave
17- steps {
18- echo " Running on slave1"
19- sh " java -cp target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App"
20- }
21- }
22- stage(" Run on Slave2" ) {
23- agent { label ' server2' } // Linux slave
24- steps {
25- echo " Running on slave2"
26- sh " java -cp target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App"
27- }
28- }
18+ stage(" Run on Slave2" ) {
19+ agent { label ' slave2' }
20+ steps {
21+ unstash ' myAppJar'
22+ sh " java -cp target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App"
2923 }
3024 }
3125 }
32- post {
33- success {
34- archiveArtifacts artifacts : " **/target/*.jar"
35- }
36- }
3726}
You can’t perform that action at this time.
0 commit comments