Add helm repo version to the helm chart version in azure_helm_package
Context
When packaging the helm chart on the pipeline, we first clone the helm repo by the branch name:
git clone --single-branch --branch ${COMMUNITY_HELM_BRANCH}
Then set the chart version using the commit SHA of the repository:
CI_COMMIT_SHORT_SHA=$(echo "$CI_COMMIT_SHORT_SHA" | sed 's/^0*//')
helm_version=$(helm show chart ${helm_dir} | awk '/^version/{print $2}')-${CI_COMMIT_SHORT_SHA}
Problem
CI_COMMIT_SHORT_SHA is not the SHA from the helm repository, it is the SHA in the source repository.
If I re-run the pipeline from the same commit in the source repo but update that COMMUNITY_HELM_BRANCH in the helm chart repo, the pipeline will build a different helm chart but assign it the same version number.
If the helm chart version included SHAs of the both repositories, then it would be possible to back-track the exact source codes from the chart version number. This extra information would help troubleshooting pipeline failures.
Solution
For example:
CI_COMMIT_SHORT_SHA=$(echo "$CI_COMMIT_SHORT_SHA" | sed 's/^0*//')
HELM_REPO_SHORT_SHA=$(git rev-parse --short HEAD | sed 's/^0*//')
helm_version=$(helm show chart ${helm_dir} | awk '/^version/{print $2}')-${CI_COMMIT_SHORT_SHA}-${HELM_REPO_SHORT_SHA}