What do two asterisks mean in a .dockerignore file? - docker

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.

Related

Flume "Spooling Directory Source" recursive-look for the the files within subdirectories

I am looking for the Flume "Spooling Directory Source" recursive-look for the the files within subdirectories.
There are some references here https://issues.apache.org/jira/browse/FLUME-1899
however since then multiple versions have come out, is there any way we can have recursive directory lookup within subdirectories for the files in Spooling Source.
I think you can use the patch FLUME-1899-2.patch directly.
set the "recursiveDirectorySearch" as ture in your config file.
NOTE: the regex in ignorePattern of config file will also affect the recursiveDirectory folder name. so you might need to modify the code in org/apache/flume/client/avro/ReliableSpoolingFileEventReader.java if you want to ignore the folder name.

Exclude directory in uDeploy plugin for 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

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

Git ignore all files in directory expect for specified

My rails app uploads all users photos to a folder /uploads/photos/. I want to ignore everything in this folder in git except for one subfolder /uploads/photos/default/.
Is this possible using the .gitignore file?
You can use the prefix !
From the man page
An optional prefix ! which negates the
pattern; any matching file excluded by
a previous pattern will become
included again. If a negated pattern
matches, this will override lower
precedence patterns sources.
# ignore generated html files,
*.html
# except foo.html which is maintained by hand
!foo.html
Although I wouldn't normally store user-generated content in the same hierarchy as my code base/repository.

Resources