helm-release
helm-release copied to clipboard
Helm Plugin for automatic versioning of helm charts
Helm Release
Provides simple semantic versioning based from previous git tags.
This allows you to run a single command and package the next version of your chart. This project allows you to combine your Dockerfile and Helm Chart in a single repository and automatically version the Helm chart on a build.
Install
You can install a specific release version:
$ helm plugin install https://github.com/sstarcher/helm-release
Usage
- helm release CHART - Would determine the next tag for the chart and update the Chart.yaml and values.yaml image.tag
- helm release CHART -t 12345 - Would update Chart.yaml and modify values.yaml images.tag to equal 12345
- helm release CHART --print-computed-version - Would determine the next tag and print it to STDOUT
- helm release CHART --skip-application-version - Would determine the next tag for the chart and update the Chart.yaml.
Source
Helm Release supports different release logic for difference sources
Helm
When using the --source helm you must specify --bump of major, minor, or patch.
Git
Release Logic
To describe the release naming process we will use the following nomenclature.
- LAST_TAG - finds the previous tag from the git history using
git describe --tags - NEXT_TAG - uses LAST_TAG and increments the patch by 1
- COMMITS - finds the total number of commits using
git describe --tags - TAG - is used when COMMITS has a value of 0 as in the current commit has been specifically tagged
- SHA - uses a short git sha using
git rev-parse --short HEADwith thegprefix removed - BRANCH - finds the current branch name using
git rev-parse --abbrev-ref HEAD- overridden using BRANCH_NAME environment variable
- always converted to lowercase
- strips any characters that don't match - https://semver.org/#spec-item-9
- We prefix BRANCH with
0.to ensure it's the lowest version
The default version for a branch is NEXT_TAG-0.BRANCH-COMMITS+SHA
Tags
When COMMITS is equal to 0 we assume the intent is to do a release of the current commit and the version will be the tag itself TAG+SHA
NOTE Tags should be annotated tags and not lightweight tags. Tags created in the Github UI will be lightweight tags by default.
Master branch
The master branch is treated differently from the default and will be NEXT_TAG-COMMITS+SHA
Integrated Support for Jenkins and PR branches
Jenkins uses the environment variable BRANCH_NAME with the value of the PR example PR-97. This will result in a release version of NEXT_TAG-0.pr-97-COMMITS+SHA
Install without internet
- Grab the tar file for your system from the releases
$ eval $(helm env) # Get helm environment variable for plugin location $HELM_PLUGINS
$ mkdir /Users/sstarcher/Library/helm/plugins/helm-release
$ tar -xvf DOWNLOADED_TAR_GZ -C /Users/sstarcher/Library/helm/plugins/helm-release
Uninstall
$ helm plugin remove release