如何在“开始构建之前删除工作区"部分中使用排除文件夹选项? [英] How to use exclude folder option in 'Delete workspace before build starts' section?
问题描述
我想从删除中排除node_modules文件夹,但是它将删除所有工作空间. 我已经尝试了很多模式,并且选择了在目录上也应用模式"选项,而没有使用它.
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.
其中一些:**/node_modules/**,*/node_modules/*
我还发现了一个问题 https://issues.jenkins-ci.org/browse/JENKINS- 12783 ,
但像我试图使用错误的模式的接缝.
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.
推荐答案
很抱歉,您无法获得额外的答案,但噩梦并没有使我一路走到最后的结果.如果您要排除node_modules
目录,则由于 JENKINS-1278 在父级的子目录中,您必须同时排除.git目录和父级目录本身.
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
如果执行此操作,则subModule1和subModule2内部的所有内容仍将被删除(当然,node_modules目录除外).即使每次都没有完全删除Git,Git仍会获得最新更改的更新.
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.
这篇关于如何在“开始构建之前删除工作区"部分中使用排除文件夹选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!