I am trying to use the following jenkins plugin to copy front application build artifacts to subsequent jobs.
Application artifacts are output to the following directories:
/build
/test
/js
/css
404.html
index.html
So I put the following in the Jenkinsfile of the subsequent job:
script {
try {
env.FRONT_BRANCH=params.FRONT_BRANCH
copyArtifacts(projectName: "../front-app/", selector: specific(params.FRONT_BUILD_NO), filter: 'build/**/*', target: 'front', fingerprintArtifacts: false)
} catch (hudson.AbortException e) {
println(e)
}
sh 'ls front'
}
...
But, console output is here:
[Pipeline] sh
+ ls front
build
I expect the following output results:
[Pipeline] sh
+ ls front
test
js
css
404.html
index.html
I don't want to copy the build directory, which is the root directory of the artifacts.
In one of my own projects I'm using a similar solution, but i am using the jenkins built-in stash/unstash option.
stash
unstash
stackoverflow article correct usage
Your problem description looks pretty similar to the use case stash and unstash would provide for you.