ARTIFACTORY: How to configure the “Charts Base URL” in a Helm repository
Helm has a “Base Charts URL” field in the repository settings, this field must be configured correctly under some conditions in order for Artifactory to cache artifacts and for the Helm client to pull artifacts through Artifactory.
What does this field do?When this field is present, the “Base Charts URL” field will update the index.yaml file with the corresponding path where the charts are present on the remote repository, so that when the Helm client fetches the artifacts, it will fetch them through Artifactory.
The “Charts Base URL” field needs to be the base path in which the charts/tgz files are present.
For example:In the following github repo:
The index.yaml file points to the Artifacts present in the following path’s
- https://github.com/fluxcd-community/helm-charts/releases/download/flux2-2.0.0/flux2-2.0.0.tgz
- https://github.com/fluxcd-community/helm-charts/releases/download/flux2-1.7.0/flux2-1.7.0.tgz
- https://github.com/fluxcd-community/helm-charts/releases/download/flux2-1.3.0/flux2-1.3.0.tgz
Which means the “Base Charts URL” should be:
https://github.com/fluxcd-community/helm-charts/releases/download/
In-case of multiple “Base Charts URL’s”:In case the index.yaml file point’s to multiple “Base Charts URL’s”, for example:
- https://prometheus-community.github.io/helm-charts/prometheus-11.0.0.tgz
- https://github.com/prometheus-community/helm-charts/releases/download/prometheus-13.0.1/prometheus-13.0.1.tgz
Then Artifactory has a feature to overwrite it (Repository settings –> Advanced tab)
Check the “Enable Dependency Rewrite” check box and then add the Pattern URL
So in this example it will be:
- https://prometheus-community.github.io/**
- https://github.com/prometheus-community/helm-charts/releases/download/**
Without the “Chart Base URL” field populated, when configuring the Helm client against Artifactory, it will fetch the index.yaml file (from Artifactory), then it will read the values in the index.yaml file, which are pointing directly to the upstream. The client will then try to download the charts directly from the upstream, bypassing Artifactory.