pipeline{
agent none
stages{
stage('Git checkout'){
agent { label 'master' }
steps{
stash includes: '/root/hello-world/*', name: 'mysrc'
}
}
stage('maven build'){
agent { label 'slave-1' }
steps{
unstash 'mysrc'
sh label: '', script: 'mvn clean package'
}
}
}
}
I have cloned my code in master inside hello-world
directory. Now I need to copy that folder hello-world
to slave. After copying I need to run mvn clean package
in slave node.
When I ran it, I got this error:
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] stage
[Pipeline] { (Git checkout)
[Pipeline] node
Running on Jenkins in /var/lib/jenkins/workspace/test-12
[Pipeline] {
[Pipeline] stash
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (maven build)
Stage "maven build" skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] End of Pipeline
ERROR: No files included in stash ‘mysrc’
Finished: FAILURE