Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat]: pre-commit helm-docs-container pin docker version by default #222

Open
umarhussain15 opened this issue Feb 29, 2024 · 0 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@umarhussain15
Copy link

Is your feature request related to a problem? Please describe and/or link to a bug issue

Currently, pre-commit hook helm-docs-container is configured to use latest tag of the docker image. This has the implication that if the version of hook is updated (for example from v1.12.0 to v1.13.0) the local docker image latest is still pointing to v1.12.0. The user has to manually call the docker pull jnorwood/helm-docs:latest to get a newer image.

Expected Behavior

When the version of hook is updated, it will also trigger the latest image pull from docker registry.

Current Behavior

When the hook version is updated, the latest version of image is not pulled locally with latest tag

Possible Solution

Use specific tag in pre-commit-hooks.yaml matching the release version of helm-docs. This will ensure that always the correct version of docker image is used matching the rev value in pre-commit.

For helm-docs release v1.13.0 the pre-commit-hooks.yaml will be:

- id: helm-docs-container
  args: []
  description: Uses the container image of 'helm-docs' to create documentation from the Helm chart's 'values.yaml' file, and inserts the result into a corresponding 'README.md' file.
  entry: jnorwood/helm-docs:v1.13.0 # <--- Here the version matches the helm-docs release
  files: (README\.md\.gotmpl|(Chart|requirements|values)\.yaml)$
  language: docker_image
  name: Helm Docs Container
  require_serial: true

Now when user uses the v1.13.0 of pre-commit hook helm-docs-container, they will get jnorwood/helm-docs:v1.13.0 version.

repo:
- repo: https://github.com/norwoodj/helm-docs
  rev: v1.13.0
  hooks:
  - id: helm-docs-container
    args:
      # Make the tool search for charts only under the `charts` directory
    - --chart-search-root=charts

Context

The issue came to light when one developer updated the hook version to v1.13.0, and they didn't have the docker image locally, so the latest image was downloaded. When another developer (who already had the latest docker image pointing to v1.12.0) pulled the commit with newer hook version and ran pre-commit, the autogenerated version value in README was reverted to v1.12.0 from v1.13.0.


I'm not sure how it can be automated? I'm thinking that it can be done when new tag is calculated, then a new commit is created with modified pre-commit-hooks.yaml containing new version tag and finally this commit is tagged with new tag.
Maybe this can be added as hook in goreleaser which can use .Tag?

@umarhussain15 umarhussain15 added the enhancement New feature or request label Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants