File tree Expand file tree Collapse file tree 1 file changed +20
-18
lines changed
Expand file tree Collapse file tree 1 file changed +20
-18
lines changed Original file line number Diff line number Diff line change 11pipeline {
2- agent any
2+ agent none // we will assign agents per stage
33 tools {
4- maven " MAVEN" // Ensure this matches your Maven installation name in Jenkins
4+ maven " MAVEN" // Must match your Maven installation name in Jenkins
55 }
66 stages {
7- stage(" build" ) {
7+ stage(" Build" ) {
8+ agent { label ' Master' } // build on master
89 steps {
910 bat " mvn clean package"
1011 }
1112 }
12- stage(" test" ) {
13- steps {
14- parallel(
15- test1 : {
16- echo " test 1"
17- },
18- test2 : {
19- echo " test 2"
13+ stage(" Run on Slaves" ) {
14+ parallel(
15+ slave1Job : {
16+ agent { label ' slave1' }
17+ steps {
18+ echo " Running on slave1"
19+ bat " java -cp target\\ my-app-1.0-SNAPSHOT.jar com.mycompany.app.App"
2020 }
21- )
22- }
23- }
24- stage(" run" ) {
25- steps {
26- bat " java -cp target\\ my-app-1.0-SNAPSHOT.jar com.mycompany.app.App"
27- }
21+ },
22+ slave2Job : {
23+ agent { label ' slave2' }
24+ steps {
25+ echo " Running on slave2"
26+ bat " java -cp target\\ my-app-1.0-SNAPSHOT.jar com.mycompany.app.App"
27+ }
28+ }
29+ )
2830 }
2931 }
3032 post {
You can’t perform that action at this time.
0 commit comments