Exclude directory in uDeploy plugin for jenkins - jenkins

I'm trying to import a new version of a udeploy component through Jenkins and the uDeploy plugin that comes from a Git repository and has the .git folder in it. Everything I've tried to exclude the .git folder from syncing doesn't work. I'm thinking that the plugin is looking for files with a .git extension rather than folder. How do I exclude the .git folder form syncing?
I tried ".git", **/.git/, *.git/*, **.git/*, and a handful of other 'terms' and they all show up in the console output as:
Working Directory: C:\Program Files (x86)\Jenkins\jobs\DIT Com\workspace
Includes: **/
Excludes: ".git" Uploading files in C:\Program Files (x86)\Jenkins\jobs\DIT Com\workspace Uploading: .git/hooks/pre-commit.sample
...
Uploading: .git/refs/heads Files committed Finished: SUCCESS
This is what the exclude section looks like, with the help bubble clicked (that's what's in the gray box)

Unable to comment so adding as an answer-
Two consecutive asterisks ("**") in patterns matched against full pathname may have special meaning:
A leading "**" followed by a slash means match in all directories. For example, "**/foo" matches file or directory "foo" anywhere, the same as pattern "foo". "**/foo/bar" matches file or directory "bar" anywhere that is directly under directory "foo".
A trailing "/**" matches everything inside. For example, "abc/**" matches all files inside directory "abc", relative to the location of the .gitignore file, with infinite depth.
A slash followed by two consecutive asterisks then a slash matches zero or more directories. For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on.
Other consecutive asterisks are considered invalid.

Have you tried a regular expression? say, ^/.*/.git/

Looks like the answer to excluding directories is in the form of **/dir_name/**.
If someone could give some more information on what the leading *'s are doing (not sure how the second * wildcard interacts, nor the trailing second *) I would be really interested in understanding why it works!
reference: ant fileset dir exclude certain directory

Related

What do two asterisks mean in a .dockerignore file?

In my .dockerignore file, I see many lines starting with two asterisks like below.
**/.git
**/.gitignore
**/.project
What does this mean?
It's the same as the .gitignore notation, ignoring the specified file in any sub-directory recursively, including the current directory. A single star would only include one level of sub-directories.
For more on the .dockerignore syntax, see: https://docs.docker.com/engine/reference/builder/#dockerignore-file
Here's the statement that's relevant to your question:
...Docker also supports a special wildcard string ** that matches any number of directories (including zero). For example, **/*.go will exclude all files that end with .go that are found in all directories, including the root of the build context.

Flume: How to track specified sub folders using spoolDir?

We're having a system uploads log files into a folder which named by date. It looks like:
/logs
/20181030
/20181031
/20181101
/20181102
/...
Suppose that I want to track the log files which produced during November by using spoolDir, How could I do this ?
#this won't work
a1.sources.r1.spoolDir = /logs/201811??
#this seems only works with files. Is it possible to filter folders here?
a1.sources.r1.includePattern = ^.*\.txt$
Acoording to the flume source code, folders that match the ignorePattern are skipped while recursing the folder tree(to register folder trackers). So you can ignore the folders which don't match your criteria. ^(?!201811..).*$ would exclude all the folders that are not folders of November 2018. Other folders will not be tracked.
But this pattern will also apply to file names. So any file with name that does not match ^201811..$ will also be ignored. You can add the ^.*\.txt$ pattern (the one you are using for the include pattern) to the regex to make flume accept your input files.
a1.sources.r1.ignorePattern = ^(?!(201810..)|(.*\\.txt)).*$
would do the trick for you.

.tfignore is not ignoring my files using wildcards

I have a project in TFS with branches and I want to ignore some folders in each branch.
So I try this to ignore all branches folders, but it's not working:
\Tools\Web\APPREPORTS\Branches\*\node_modules\
\Tools\Web\APPREPORTS\Branches\*\packages\
So it's forcing me to do that in this way, specifing each branch:
\Tools\Web\ALMAREPORTS\Branches\DEV\node_modules\
\Tools\Web\ALMAREPORTS\Branches\DEV\packages\
\Tools\Web\ALMAREPORTS\Branches\STAGE\packages\
\Tools\Web\ALMAREPORTS\Branches\STAGE\node_modules\
\Tools\Web\ALMAREPORTS\Branches\PRODUCTION\packages\
\Tools\Web\ALMAREPORTS\Branches\PRODUCTION\node_modules\
There is another way to simplify that?
Thanks in advance.
Your method is not supported.
The * and ? wildcards are supported in the leaf name only.
More detailed info from this answer: tfignore wildcard directory segment
It depends which folder you put your .tfignore file in.
You can just use \node_modules to ignore all files in this folder.
The following rules apply to a .tfignore file:
# begins a comment line
The * and ? wildcards are supported.
A filespec is recursive unless prefixed by the \ character.
! negates a filespec (files that match the pattern are not ignored)
Source: MSDN Documentation
Use two asterisks:
\Tools\Web\APPREPORTS\Branches\**\node_modules\
\Tools\Web\APPREPORTS\Branches\**\packages\

tfignore wildcard directory segment

Is it possible using .tfignore to add a wildcard to directories? I assumed it would have been a case of just adding an asterisk wildcard to the directory segment. For example:
\path\*\local.properties
However this does not work and I am unsure how I would achieve such behaviour without explicitly declaring every reference that I need excluding. .
Documentation
# begins a comment line
The * and ? wildcards are supported.
A filespec is recursive unless prefixed by the \ character.
! negates a filespec (files that match the pattern are not ignored)
Extract from the documentation.
The documentation should more correctly read:
The * and ? wildcards are supported in the leaf name only.
That is, you can use something like these to select multiple files or multiple subdirectories, respectively, in a common parent:
/path/to/my/file/foo*.txt
/path/to/my/directories/temp*
What may work in your case--to ignore the same file in multiple directories--is just this:
foo*.txt
That is, specify a path-less name or glob pattern to ignore matching files throughout your tree. Unfortunately you have only those two options, local or global; you cannot use a relative path like this--it will not match any files!
my/file/foo*.txt
The global option is a practical one because .tfignore only affects unversioned files. Once you add a file to source control, changes to that file will be properly recognized. Furthermore, if you need to add an instance of an ignored name to source control, you can always go into TFS source control explorer and manually add it.
It seems this is now supported
As you see I edited tfignore in the root folder of the project such that any new branch will ignore its .vs folder when being examined for source control changes
\*\.vs
Directory/folder name wildcarding works for me in VS2019 Professional. For example if I put this in .tfignore:
*uncheckedToTFS
The above will ignore any folder named ending with "uncheckedToTFS", regardless of where the folder is (it doesn't have to be top level folder, can be many levels deep).

jenkins archive artifact excluding all subdirectory

I have a couple of job in Jenkins that archive artifact from the source tree for another job (some unit tests or alike). I have the current situation :
top_dir
\scripts_dir
\some_files
\dir1
\dir2
\dir3
\other_dir
I would like to archive all that is in "top_dir" including the files in "scripts_dir", but not the subdirectories "dir1, dir2,...", which I do not know the name, that are in "scripts_dir". These subdirs are actually Windows directory joints that point to other places on the disk, and I do not want them to be copied.
How do I achieve this with the inculde/excludes pattern of Jenkins ?
I already tried, having include=top_dir/ , exclude=
**/scripts_dir/*/
**/scripts_dir/*/**
**/scripts_dir/**/*
but it always exculdes the whole "scripts_dir" folder.
Finally, by using brute force, I found that the following expression does exclude all the files in the subdirectories of scripts_dir (whatever symlink or not), then removing these subdirs, while keeping the files directly in scripts_dir :
**/scripts_dir/**/*/*/
Thanks for the help anyway.
Reading the ANT manual, there an followsymlinks attribute that defaults to true. You said those things you want to exclude are symlinks (although i am not sure if this will work with Windows joints). Try adding followsymlinks=false
Another solution: if all your files under scripts_dir have a set number of characters in the extension, you can put that into your include statement. This will only pickup files with extensions of 3 characters:
**/scripts_dir/*.???
More on this here

Resources