1

The Jenkins version running is 2.249.1. I am new to Jenkins, so I may be missing something very obvious here. I found a few related stack overflow questions, but nothing answered this question specifically. I found this question to be helpful but still didn't answer the question being asked.

This is all being done through the Jenkins GUI. I added a post build action to archive files. Here is the screen screen that I am seeing.

I am trying to archive all the files while keeping their folder structure. I am able to add all the files while losing their folder structure with this pattern: **/*.*

Using a single * only grabs the outermost README.md and ignores all the folders beneath the working directory. I realize I can list each directory specifically to accomplish this, but it seems like there should be a simple way to grab everything and keep the folder structure.

Thanks!

Willie Cheng
  • 7,679
  • 13
  • 55
  • 68
Jeff Gruenbaum
  • 364
  • 6
  • 21

1 Answers1

2

Per the 'Files to archive [ ]' help icon (?) ,

You can use wildcards like 'module/dist/**/*.zip'.See the includes attribute of Ant fileset for the exact format.

Suggest reading the ant fileset documentation carefully.

Files to archive [ **/** ]

will copy the the entire directory structure and folders. The **/ matches all directories and the /** matches all contents. If the contents is a directory, process as a directory, if it's a file, copy it.

Something like myrootdir/**/matchingdir*/** could produce:

myrootdir/user/matchingdirWeb/logging-log4j2-web.xml
myrootdir/user/matchingdirWeb/logging-web.xml
myrootdir/user/matchingdirWS/logging-log4j2-service.xml
myrootdir/user/matchingdirWS/logging-service.xml
myrootdir/Web/matchingdirWeb/logging-log4j2-web.xml
myrootdir/Web/matchingdirWeb/logging-web.xml
myrootdir/WS/matchingdirWS/logging-log4j2-service
myrootdir/WS/matchingdirWS/logging-log4j2-service.xml
myrootdir/WS/matchingdirWS/logging-service.xml

You must actually click on the "Build Artifacts" (open box) button to navigate into "<build>/artifact" to see the tree. The main build page may not show the complete path to the files.

You should also set a smart retention policy [ X ] Discard old builds if you don't want to blow up your disk consumption. See this answer for more details.

Ian W
  • 4,559
  • 2
  • 18
  • 37
  • 1
    This answered my question. I did not realize you had to open the build artifacts to see the tree structure. I'll setup a retention policy as well for discarding old builds. Thank you! – Jeff Gruenbaum Oct 01 '20 at 14:09
  • The answer and the comment by Jeff really help me a lot, I also just find out we have to click on the "Build Artifacts" button to view the folder hierarchy. In the jenkins job main page only files are shown, the folder holding the files is not. – MadHatter Mar 02 '23 at 08:14