Search code examples
kubernetes-helmartifactoryjfrog

Helm dependency: failed to fetch https://...../index.yaml : 401 Jfrog Artifactory


While trying to update the dependnecies of a helm chart which are uploaded to a private JFROG Artifactory I get a 401 on the index.yaml pull.

Helm chart.yaml

description: test api
apiVersion: v2
name: test-issue
version: 0.1
appVersion: 1.4
...
...

dependencies
- name: test-api
  repository: https://artifacts.xyz.com:443/artifactory/helm-repo
  version: 1.0.0
  alias: test
  condition: test.enabled

Steps:

helm repo add https://artifacts.xyz.com:443/artifactory/helm-repo --username xyz --password yjk --pass-credentials
cd path/to/chart
helm dependency update .

I get the following output:

Unable to get an update from the "https://artifacts.xyz.com:443/artifactory/helm-repo/index.yaml":401
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "helm-repo" chart repository
...Successfully got an update....

And the dependant chart doesn't get downloaded.

I know the credentials are ok because when I try a wrong password I get a differenet error, as you can see here only the index fails while it says that it successfully got an update from the repo.


Solution

  • After a while troubleshooting this the problem was the port of the repository URL in the chart.yaml

    description: test api
    apiVersion: v2
    name: test-issue
    version: 0.1
    appVersion: 1.4
    ...
    ...
    
    dependencies
    - name: test-api
      repository: https://artifacts.xyz.com:443/artifactory/helm-repo  # THIS SHOULD NOT HAVE :443
      version: 1.0.0
      alias: test
      condition: test.enabled
    

    Solution

    description: test api
    apiVersion: v2
    name: test-issue
    version: 0.1
    appVersion: 1.4
    ...
    ...
    
    dependencies
    - name: test-api
      repository: https://artifacts.xyz.com/artifactory/helm-repo
      version: 1.0.0
      alias: test
      condition: test.enabled
    

    JFROG UI can be a little missleading since when you get the chart URL from artifactory it has the port (plus the https)

    Also you can test setting the pass_credentials_all to true in the helm config (usually located in the use home directory -> .config -> helm -> repositories.yaml)