github.com/argoproj/argo-cd/v2@v2.10.9/docs/operator-manual/applicationset/Generators-Git-File-Globbing.md (about) 1 # Git File Generator Globbing 2 3 ## Problem Statement 4 5 The original and default implementation of the Git file generator does very greedy globbing. This can trigger errors or catch users off-guard. For example, consider the following repository layout: 6 7 ``` 8 └── cluster-charts/ 9 ├── cluster1 10 │ ├── mychart/ 11 │ │ ├── charts/ 12 │ │ │ └── mysubchart/ 13 │ │ │ ├── values.yaml 14 │ │ │ └── etc… 15 │ │ ├── values.yaml 16 │ │ └── etc… 17 │ └── myotherchart/ 18 │ ├── values.yaml 19 │ └── etc… 20 └── cluster2 21 └── etc… 22 ``` 23 24 In `cluster1` we have two charts, one of them with a subchart. 25 26 Assuming we need the ApplicationSet to template values in the `values.yaml`, then we need to use a Git file generator instead of a directory generator. The value of the `path` key of the Git file generator should be set to: 27 28 ``` 29 path: cluster-charts/*/*/values.yaml 30 ``` 31 32 However, the default implementation will interpret the above pattern as: 33 34 ``` 35 path: cluster-charts/**/values.yaml 36 ``` 37 38 Meaning, for `mychart` in `cluster1`, that it will pick up both the chart's `values.yaml` but also the one from its subchart. This will most likely fail, and even if it didn't it would be wrong. 39 40 There are multiple other ways this undesirable globbing can fail. For example: 41 42 ``` 43 path: some-path/*.yaml 44 ``` 45 46 This will return all YAML files in any directory at any level under `some-path`, instead of only those directly under it. 47 48 ## Enabling the New Globbing 49 50 Since some users may rely on the old behavior it was decided to make the fix optional and not enabled by default. 51 52 It can be enabled in any of these ways: 53 54 1. Pass `--enable-new-git-file-globbing` to the ApplicationSet controller args. 55 1. Set `ARGOCD_APPLICATIONSET_CONTROLLER_ENABLE_NEW_GIT_FILE_GLOBBING=true` in the ApplicationSet controller environment variables. 56 1. Set `applicationsetcontroller.enable.new.git.file.globbing: true` in the Argo CD ConfigMap. 57 58 Note that the default may change in the future. 59 60 ## Usage 61 62 The new Git file generator globbing uses the `doublestar` package. You can find it [here](https://github.com/bmatcuk/doublestar). 63 64 Below is a short excerpt from its documentation. 65 66 doublestar patterns match files and directories recursively. For example, if 67 you had the following directory structure: 68 69 ```bash 70 grandparent 71 `-- parent 72 |-- child1 73 `-- child2 74 ``` 75 76 You could find the children with patterns such as: `**/child*`, 77 `grandparent/**/child?`, `**/parent/*`, or even just `**` by itself (which will 78 return all files and directories recursively). 79 80 Bash's globstar is doublestar's inspiration and, as such, works similarly. 81 Note that the doublestar must appear as a path component by itself. A pattern 82 such as `/path**` is invalid and will be treated the same as `/path*`, but 83 `/path*/**` should achieve the desired result. Additionally, `/path/**` will 84 match all directories and files under the path directory, but `/path/**/` will 85 only match directories.