Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use exclude folder option in 'Delete workspace before build starts' section?

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.

like image 615
Denys Medvediev Avatar asked Oct 03 '16 10:10

Denys Medvediev


1 Answers

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.

like image 169
Ryan Shillington Avatar answered Oct 15 '22 09:10

Ryan Shillington