Reputation: 19699
I use the Jenkins artifact plugin to downward streams to use. My problem is that despite all my efforts, empty folders are not being archived. Apparently .svn files are also not archived.
Upvotes: 5
Views: 4115
Reputation: 847
same issue here, I come up with a workaround less agressevely if compared with a compressing and then stashing it.
sh "find ${env.WORKSPACE} -type d -empty -exec touch {}/.empty \;"
stash name: "src", useDefaultExcludes: false, allowEmpty: true
Then later on, to unstash
do the folow:
unstash "src"
sh "find ${env.WORKSPACE} -type f -name .empty -exec rm {} \+"
Basically any empty diretories is added an empty file called .empty
, then after unstash we just remove then. I understand is uggly once the plugin should handle properly what is requested, however until the ticket below get resolved, I have to move on.
https://issues.jenkins-ci.org/browse/JENKINS-9146
Upvotes: 1
Reputation: 111565
Firstly, you are correct — empty directories cannot be archived, as a directory doesn't really make sense as an artifact in Jenkins.
If you're copying the artifacts to another job, you can just create the directory in the other job, or ensure the directory is archived in the first place by adding a .keep
file (or so) and adding **/.keep
to your list of artifacts to archive.
Regarding your second point that .svn
files or directories are not archived, that is also correct since the default behaviour is to exclude certain patterns (e.g. .git
, *~
) when archiving artifacts.
To disable this behaviour, click on the Advanced… button below the "Archive the artifacts" post-build step, and uncheck the "Use default excludes" option. Then your .svn
artifacts can be archived.
Upvotes: 5