This is a very opinionated helper for Renovate to enhance PRs generated by renovate for helm charts under a very specific set of conditions:
- You are using Github
- Your
Chart.yamljust refers to a single upstream chart:
apiVersion: v2
version: 1.0.0
name: hello-world
dependencies:
- name: hello-world
version: 0.1.0
repository: https://helm.github.io/examples- Your
values.yamllives in the same directory and is a copy of the upstreamvalues.yamlwith edits. - You have a copy of upstream
values.yamlstored in the same directory asorig-values.yamlwith an indent of 2 spaces applied (so that it nearly matches the uneditedvalues.yaml
Run this python/container using your CI after any renovate. Set the following environment variables:
| Name | Content |
|---|---|
| GITHUB_TOKEN | Token which can read and write to the repository and PRs |
| GH_OWNER | The github organisation |
| GIT_EMAIL | Email address to make commits as |
| GIT_NAME | Name to make commits as |
| APP_REPO | Repository name in github |
| GIT_SHA | The SHA1 to check |
| TARGET_BRANCH | The branch that the PR is being merged into (todo: read this from GH) |
| CHECKOUT_PATH | Local path for where to checkout the code to from github to examine |
| PR_NUM | Pull request number in github |
https://github.com/<GH_OWNER>/<APP_REPO> is the path to your repository.
The container image is published as ghcr.io/crumbhole/renovate-helm-helper. Tags available:
x.x.x: corresponds to that release. Be a good human and use this and renovate updates to it.latest: is tip ofmainbranch after a build has run. Good practice says don't use this.stable: is last release. If you're using renovate, why use this, get renovate to renovate this properly.
The Chart.yamls affected by the PR will be compared to the target branch.
If the values.yaml upstream has changed, a patch between old upstream and new will be generated and applied to your values.yaml attempting to keep it up to date with upstream. If this fails, which is quite likely if it's patching near where you have modified values.yaml, it will add the failed diffs as a comment to the PR to help you to manually patch.
The PR will have values-orig.yaml updated from upstream, and a commit will be made for this. If this happens your values.yaml and upstream will be compared and a unified diff added as a comment to the PR.
It is safe to run this multiple times over the same PR, but values.yaml will not be updated more than once in a single PR.