#732·datree

Exclude paths regex

Author: HariSekhonCreated Jul 19, 2022Updated Apr 30, 2023
Labelsenhancementup for grabs

Feature Request to be able to define an exclude regex so that I can exclude problematic K8s patch files that Datree is tripping up on.

For an example of these patch yamls, you can see this run in my public Kubernetes repo:

https://github.com/HariSekhon/Kubernetes-configs/runs/7412852029?check_suite_focus=true

Proposed Solution

--exclude switch that can take a regex

Example usage:

bash
$ datree test **/*.yaml --exclude '\.patch\.yaml$'

Describe alternatives you've considered

I do this in shell (via function in my .bash.d/kubernetes.sh):

bash
find . -type f -iname '*.y*ml' |
grep -v patch |
tr '\n' '\0' | 
xargs -0 datree test --only-k8s-files --ignore-missing-schemas

However, this doesn't work with action-datree so the CI/CD workflow is still broken.

I think it would be better handled via a native --exclude switch, but I'm open to other workarounds.