Skip to content

Commit c2ef825

Browse files
authored
Update Jenkinsfile
1 parent 4193e9f commit c2ef825

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

Jenkinsfile

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,22 @@ pipeline {
22
agent none
33

44
stages {
5-
stage('Build') {
6-
agent { label 'built-in' }
7-
tools { maven 'MAVEN' }
8-
steps {
9-
bat 'mvn clean install -DskipTests'
10-
archiveArtifacts artifacts: 'target/my-app-1.0-SNAPSHOT.jar', fingerprint: true
11-
}
12-
}
5+
stage('Build') {
6+
agent { label 'built-in' }
7+
tools { maven 'MAVEN' }
8+
steps {
9+
bat 'mvn clean install -DskipTests'
10+
stash includes: 'target/my-app-1.0-SNAPSHOT.jar', name: 'app-jar'
11+
}
12+
}
1313

14+
stage('Run on Slave') {
15+
agent { label 'docker' }
16+
steps {
17+
unstash 'app-jar'
18+
sh 'java -jar my-app-1.0-SNAPSHOT.jar'
19+
}
20+
}
1421

15-
stage('Run on Slave') {
16-
agent { label 'docker' }
17-
steps {
18-
// Use unarchive instead of copyArtifacts
19-
copyArtifacts(
20-
projectName: "${env.JOB_NAME}",
21-
filter: 'target/my-app-1.0-SNAPSHOT.jar',
22-
selector: specific('${BUILD_NUMBER}')
23-
)
24-
sh 'java -jar my-app-1.0-SNAPSHOT.jar'
25-
}
26-
}
2722
}
2823
}

0 commit comments

Comments
 (0)