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

[Bug]: Switch --values-file not supported into .pre-commit-config.yaml configuration

Open fmunteanu opened this issue 1 year ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

helm-docs has the --values-file switch available. I'm using the following configuration example for .pre-commit-config.yaml:

repos:
  - repo: https://github.com/axivo/k3s-cluster
    rev: v1.0.0
    hooks:
      - id: victoriametrics
        args:
          - --chart-search-root=./roles/victoriametrics
          - --values-file=./defaults/main.yaml 

When I run helm-docs, I get the following warning:

$ helm-docs
INFO[2024-11-27T22:41:56-05:00] Found Chart directories [roles/victoriametrics]
WARN[2024-11-27T22:41:56-05:00] Required chart file roles/victoriametrics/values.yaml missing. Skipping documentation for chart
WARN[2024-11-27T22:41:56-05:00] Error parsing information for chart roles/victoriametrics, skipping: stat roles/victoriametrics/values.yaml: no such file or directory

I fixed the issue easy, by creating a values.yaml soft link, still I would like to know if this might be a bug. If I pass the --values-file flag while executing the command locally, everything works as intended:

$ helm-docs --chart-search-root=./roles/victoriametrics --values-file=./defaults/main.yaml
INFO[2024-11-29T19:23:16-05:00] Found Chart directories [.]
INFO[2024-11-29T19:23:16-05:00] Generating README Documentation for chart roles/victoriametrics

Expected Behavior

The --values-file switch should be detected and applied into .pre-commit-config.yaml configuration. I created a workflow, to make sure the issue is not present on my Mac only, with same result.

Example of workflow execution with values.yaml file missing and present, see Refresh Documentation step.

Reference Chart

I'm using helm-docs in an unconventional way, emulating a Helm chart to render the variables of an Ansible role, into a properly formatted README. It works quite well and saves me an enormous amount of time to generate the documentation.

https://github.com/axivo/k3s-cluster/tree/0ecc6058ac82c5ebf2dc1f64d6683751a667cdab/roles/victoriametrics

Reference Template

No response

Environment

  • Operating system: macOS, helm-docs installed with Homebrew, version 1.14.2
  • Helm version: version.BuildInfo{Version:"v3.16.2", GitCommit:"13654a52f7c70a143b1dd51416d633e1071faffb", GitTreeState:"dirty", GoVersion:"go1.23.2"}
  • GO version (output of go version): go1.23.3 darwin/arm64
  • Method of calling helm-docs (manual, jenkins, github action ...): Tested with manual and GitHub Action

Link to helm-docs Logs

No response

Further Information

Unrelated to the current question, I noticed that markdown format links are not rendered inside chart.valuesTableHtml template, I'm forced to use actual HTML code.

Using a format as detailed below, will not transform the markdown into a HTML link, when using chart.valuesSectionHtml or chart.valuesTableHtml:

      user:
        # -- User name used to access Grafana UI
        # @default -- Set value into [all.yaml](../../inventory/cluster/group_vars/all.yaml) variables
        name:

Same result occurs, if markdown links are inserted into Description column. Is this related to a specific template that needs to be present? From your documentation:

If no template file is provided, the tool has a default internal template that will generate a reasonably formatted README.

fmunteanu avatar Nov 28 '24 10:11 fmunteanu