Got a list of config files that reside outside of templates folder that we feed into a helm chart like the following:
├── configs
│ ├── AllEnvironments
│ │ ├── Infrastructure
│ │ └── Services
│ │ ├── ConfigFile1
│ │ ├── ConfigFile2
│ ├── Apps
│ │ ├── App1
│ │ ├── App2
│ │ └── App3
│ ├── ManagementEnvironments
│ │ ├── Database
│ │ │ ├── DbFile1
│ │ │ └── DbFile2
│ │ ├── Infrastructure
│ ├── TestEnvironments
│ │ ├── Pipeline
│ │ │ └── Pipeline1
│ │ ├── Database
│ │ │ ├── Pipeline2
│ ├── Console
│ │ ├── Console1
│ │ ├── Console2
It works out good for us so far. Now we need to parse the folders and get a list of all the folders under configs that do not end with Environments. So basically a range that would include Apps and Console in this case.
Doing the following I get a repetition of Apps 3 times as that many files are under it and also Console 2 times.
I would like to get a list of folders that do not end with Environments only once.
I tried to look at the Go templates and some helm chart toolkits but I have no experience in Go which seems like a requirement to make this happen and I will probably take on the next few days. But for now I'm stuck, so any help is appreciated.
{{- range $path, $bytes := $.Files.Glob "configs/**" }}
{{- if not (or (dir $path | regexFind "configs.*Environments.*") (dir $path | regexFind "configs$")) }}
{{ base (dir $path) }}
{{- end }}
{{- end }}