I am having a Jenkins master running as a container on two virtual machine.
I am trying to run a build inside a docker container on a node so during the build process i had stashed my target folder to use it later on other node .In the job's log the stashing of folder was successful. when the build was finished the container is automatically destroyed then in the next step I unstashed that folder to achieve another stages in separate node but it didn't work..
I think unstash is not doing anything.
How do I transfer my target from the container to another node?
Below is the code written for pipeline:
node('docker') {
stage('Checkout Code') {
checkout scm
}
stage('Build') {
withMaven( jdk: 'jdk_8', maven: 'maven 3') {
mvn 'clean install'
stash name: 'war', includes: 'x.war'
}
}
node('master') {
stage('test') {
withMaven( jdk: 'jdk_8', maven: 'maven 3') {
unstash : 'war'
sh 'mvn clean test'
}
}
}
}
Can any one help me with this?
Thanks