Reputation: 1240
I'd like to exclude node_modules folder from deleting, but it removes all workspace. I've already tried a lot of patterns with 'Apply pattern also on directories' option and without it.
Some of them: **/node_modules/**, */node_modules/*
I also found an issue https://issues.jenkins-ci.org/browse/JENKINS-12783,
but seams like I'm trying to use wrong pattern.
Upvotes: 9
Views: 13512
Reputation: 25107
Sorry for the extra answer but nightmare's didn't get me all the way to the final result. Because of JENKINS-1278, if you want to exclude node_modules
directories that are in child directories of the parent you have to exclude both the .git directories and the parent directory itself.
So let's say you have a directory layout like:
subModule1/
node_modules/
...
subModule2/
node_modules/
...
In this case you'll need to exclude the following directories:
**/.git/**
**/node_modules/**
subModule1
subModule2
If you do that, then everything inside of subModule1 and subModule2 will still get deleted (except the node_modules directory, of course). And Git will still get updated with the latest changes even though it's not completely blown away each time.
It works for me, and I do not have "Apply pattern also on directories" checked. It seems like that should be checked but according to that bug report you need to leave it unchecked.
Upvotes: 11
Reputation: 1240
The answer is to use this syntax **/node_modules/**, but before you will exclude your folder, you need to exclude .git folder using the same format **/.git/**
Thanks everyone!
Upvotes: 8