In one of my stages I need to copy the contents of two folders after a build is completed and copy to a different directory.
I am actually converting a freestyle job
I hope it is meant to be this:
stash includes: 'dist/**/*', name: 'builtSources'
stash includes: 'config/**/*', name: 'appConfig'
where dist and config are the directories in the workspace path, so it should be a relative path like above.
Rest seems alright, only to mention that path "/some-dir" should be writable by jenkins user (user used to run jenkins daemon).
And yes it falls back to its then enclosing workspace path (in this case default) when it exits dir block.
EDIT
So when you stash a path, it is available to be unstashed at any step later in the pipeline. So yes, you could put dir
block under a node('
block.
You could add something like this :
stage('Move the Build'){
node('datahouse'){
dir('/opt/jenkins_artifacts'){
unstash 'builtSources'
unstash 'appConfig'
}
}
}