When packaging using a Helm Chart.yaml you must specify a version. We would like the chart version to match the apps version.
If there a way to read our existing version.txt file instead of remembering (or not) to update in two places?
There isn't. To confuse things further there's also an appVersion
field in the Chart.yaml
file saying what version of the application you're packaging, but it's also near-universal to be able to specify an image tag as a value, with the same effect.
This field is only really used by Helm-specific tooling, for example if this chart is listed as a dependency of other charts or if you're publishing the chart to a central repository. If you're not doing either of these things you can largely ignore the version:
field.
If your CI system is publishing the Helm chart to a repository, you might be forced to have it modify the Chart.yaml
file before publishing it. A simple sed
command will work
sed -i.bak "s/^version:/version: $APP_VERSION/" Chart.yaml
but it does become slightly messy to set up.
If you have a more formal "release" process then you would have to remember to update the version number in both places; writing a shell script to update the version numbers (and tag the release in source control, and do whatever other tasks you need) is probably the most straightforward answer.