helm-docs icon indicating copy to clipboard operation
helm-docs copied to clipboard

Fix pre commit hook trigger

Open AsoTora opened this issue 2 years ago • 1 comments

This adds regex to trigger pre-commit on files of values-.yaml or values-.yml format.

https://github.com/norwoodj/helm-docs/issues/149

AsoTora avatar May 20 '22 12:05 AsoTora

Is the -$ENV suffix a built-in helm feature? I have never seen this before. Happy to add the ability for the hook to find both yml and yaml files, but the -$ENV suffix seems specific to your use case.

norwoodj avatar Jun 29 '22 09:06 norwoodj

I'm still confused, what's the use-case here? Does helm allow one to specify values-{suffix}.yaml files?

norwoodj avatar Nov 02 '23 18:11 norwoodj

Yeah it does, in my specific case the structure was something like that

  • values-common.yaml
  • values-dev.yaml
  • values-prod.yaml

where I needed the hook to work on the first ”common” one.

it’s been a year and a half. wow how the time flies.

AsoTora avatar Nov 02 '23 20:11 AsoTora

Right, but this is something you use when you install, no? This tool is intended to document the source of helm charts, the location where they're packaged. What you're describing, to me, sounds like you then install the chart from some other location (or the same repo perhaps, doesn't matter), and you use the values-dev.yaml and values-prod.yaml files to customize the chart for two different environments.

Documenting this situation is not what this tool is for. What it sounds to me like you should do is rename values-common.yaml to values.yaml. This tool will then happily document the values from that file. Then store the environment-specific values files in some other folder and install the chart with helm install -f values-{env}.yaml path/to/chart.

Updating the pre-commit hook to accomodate your specific situation, which is not, as far as I can tell, a common helm-supported situation, but rather an implementation detail of how you install your charts, is not something I think we should do.

Am I misunderstanding here?

norwoodj avatar Nov 03 '23 10:11 norwoodj

This can be the case, but for me, the chart was not fetched from somewhere else but packaged locally with values-common.yaml as the main values.yml file. Basically breaking the naming conventions in a way.

Maybe ignore this and only add yml/yaml support just to close the issue. :)

AsoTora avatar Nov 03 '23 10:11 AsoTora

I think this should be up to whoever is using the pre-commit hook. Just overriding the file's pattern.

Getting this definition of values, I think the default should be to use only the values.yaml.

Makes sense @norwoodj ?

Nepo26 avatar Nov 04 '23 14:11 Nepo26

Makes sense to me. Gonna close this

norwoodj avatar Feb 24 '24 11:02 norwoodj