If you’re looking for a way to bump your Helm Chart revision and upload that automatically please find the example below.
This will pull the most recent Helm Chart revision and increment by 1.
This is more efficient than a build number as you may not want to upload a new chart on every build leaving very large gaps on the revisions.
HelmChartGetVersion:
title: Get Helm Chart Version
stage: package
image: codefresh/cfstep-helm
working_directory: ${{main_clone}}
environment:
- CHART=example-voting-app
commands:
- export ACTION=auth
- source /opt/bin/release_chart
- helm repo add default ${{CF_CTX_CF_HELM_DEFAULT_URL}}
- yq .version ${CHART}/Chart.yaml
- export CURRENT_CHART_VERSION=`helm search default/${CHART} | awk 'FNR==2{print $2}' || yq .version ${CHART}/Chart.yaml`
- echo ${CURRENT_CHART_VERSION}
- cf_export NEW_CHART_VERSION=`echo "${CURRENT_CHART_VERSION}" | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g'`
HelmChartUpdate:
title: Update Helm Chart Version
stage: package
image: gksoftware/yq
working_directory: ${{main_clone}}
environment:
- CHART=example-voting-app
- YAML_PATH=image.tag
commands:
- yq w -i ${CHART}/Chart.yaml version ${NEW_CHART_VERSION}
- yq w -i ${CHART}/values.yaml ${YAML_PATH} ${{CF_BRANCH_TAG_NORMALIZED}}-${{CF_SHORT_REVISION}}
HelmChartPush:
title: Push Helm Chart to Chart Repository
stage: package
image: codefresh/cfstep-helm
working_directory: ${{main_clone}}
environment:
- CHART_REF=example-voting-app
- ACTION=push