From 0dcd8e458f2b9e22015ce3d10aa179d6584ede32 Mon Sep 17 00:00:00 2001 From: Zach Himsel Date: Wed, 4 Dec 2024 16:29:52 -0500 Subject: [PATCH 1/2] Fix incorrect description of glob matching --- docs/concepts/stack/stack-settings.md | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/docs/concepts/stack/stack-settings.md b/docs/concepts/stack/stack-settings.md index a2f61d8e1..145da8d4c 100644 --- a/docs/concepts/stack/stack-settings.md +++ b/docs/concepts/stack/stack-settings.md @@ -242,17 +242,22 @@ The project globs option allows you to specify files and directories outside of You aren't required to add any project globs if you don't want to, but you have the option to add as many project globs as you want for a stack. -Under the hood, the project globs option takes advantage of the [doublestar.Match](https://github.com/bmatcuk/doublestar?tab=readme-ov-file#match){: rel="nofollow"} function to do pattern matching. +When the [default push policy](../policy/push-policy/README.md#default-git-push-policy) is used, project globs are evaluated by the [`glob.match()` OPA function](https://www.openpolicyagent.org/docs/latest/policy-reference/#glob){: rel="nofollow"}. -Example matches: +Example matches, for the default push policy: -- Any directory or file: `**` -- A directory and all of its content: `dir/*` -- Match all files with a specific extension: `dir/*.tf` -- Match all files that start with a string, end with another and have a predefined number of chars in the middle -- `data-???-report` will match three chars between data and report -- Match all files that start with a string, and finish with any character from a sequence: `dir/instance[0-9].tf` +- Any arbitrarily-nested file: `**` +- A directory and all of its content (not including nested directories): `dir/*` +- A directory and all of its arbitrarily-nested contents: `dir/**` +- All files with a specific extension: `**.tf` +- All files that start with a string, end with another and have a predefined number of chars in the middle -- `**/data-???-report` will match three chars between data and report +- All files that start with a string, and finish with any character from a sequence: `dir/instance[0-9].tf` -As you can see in the example matches, these are the regex rules that you are already accustomed to. +As you can see, these are similar to the regex rules that you may already accustomed to. + +!!! warning + The above description does **not apply** if any custom push policies are attached to the stack. + In that case, the project globs are evaluated by the custom push policies in whatever way they evaluate them. ### VCS integration and repository From e375dbc6749a175c9824b0ae6681a4572ed45843 Mon Sep 17 00:00:00 2001 From: Zach Himsel Date: Wed, 4 Dec 2024 17:07:42 -0500 Subject: [PATCH 2/2] Fix examples --- docs/concepts/stack/stack-settings.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/concepts/stack/stack-settings.md b/docs/concepts/stack/stack-settings.md index 145da8d4c..e01b94eff 100644 --- a/docs/concepts/stack/stack-settings.md +++ b/docs/concepts/stack/stack-settings.md @@ -250,8 +250,8 @@ Example matches, for the default push policy: - A directory and all of its content (not including nested directories): `dir/*` - A directory and all of its arbitrarily-nested contents: `dir/**` - All files with a specific extension: `**.tf` -- All files that start with a string, end with another and have a predefined number of chars in the middle -- `**/data-???-report` will match three chars between data and report -- All files that start with a string, and finish with any character from a sequence: `dir/instance[0-9].tf` +- Files in the repo root that start with a string, end with another and have three chars in the middle: `data-???-report` +- Files in the repo root that start with a string, and finish with any character from a sequence: `instance[0-9].tf` As you can see, these are similar to the regex rules that you may already accustomed to.