Jenkins, Copy Directory Contents
Suppose we have a job "JobA" in Jenkins and the artifact of that job is a given directory structure:
Dir1 / Dir2 / Dir3, Dir4, File1, File2
| -> Dir1 / | | -> Dir2 / | | -> Dir3 / | | -> Dir4 / | | -> File1 | -> File2
(Dir2 contains Dir3, Dir4, File1, File2)
I want to use the content of Dir2 in "JobB". So if I installed "Dir1 / Dir2 / **" in the "Copy artifacts from another project" plugin, I get the whole folder structure including Dir1 / Dir2 Which path should I write in "Artifacts to copy" to get only the contents of Dir2 without Dir1 / Dir2, for example:
workspace / Dir3, Dir4, File1, File2
Thank!
You will spend much less time simply following the step ren
or mv
(depending on the OS) "Copy Artifacts" post to get rid of this presenter Dir1/
than you will try to find a satisfactory answer.
Assuming you are using Copy Artifact Plugin, the path is:
Dir1/Dir2/**
UPDATE
I think this is as good as it gets. Copy and archive artifacts always use the workspace folder, since basedir and AFAIK the ant fileset does not allow to run from a subfolder using include.
But Dir2 is there for what you want, since you can use that folder as root. If not, another option is to add a shell script as a Post build step, which will move Dir2 to the root of the workspace and remove Dir1.