Reputation: 133
Lets assume, what we have a job "JobA" in Jenkins and the artifact of this 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 content of Dir2 in "JobB". So if I set "Dir1/Dir2/**" to "Copy artifacts from another project" plugin, I receive all the folder structure, including Dir1/Dir2 Which path should I write in "Artifacts to copy" filed to get just content of Dir2 without Dir1/Dir2, like:
workspace/Dir3,Dir4,File1,File2
Thanks!
Upvotes: 4
Views: 5093
Reputation: 27485
You will spend far less time just executing a ren
or mv
(depending on OS) post "Copy Artifacts" step to get rid of that leading Dir1/
, than you would trying to find a satisfactory answer.
Upvotes: 1
Reputation: 15628
Assuming you use the 'Copy artifact plugin' the path would be:
Dir1/Dir2/**
UPDATE
I think this is as good as it gets. The copy and archive artifacts always use the workspace folder as basedir and AFAIK the ant fileset does not allow to start from a subfolder using includes.
But Dir2 is there so whatever you need it for you could use that folder as root. If not, the other option is to add a shell script as Post build step which will move Dir2 to the workspace root and delete Dir1.
Upvotes: 0