Harbor: helm v3 push error

Created on 21 Nov 2019  ·  7Comments  ·  Source: goharbor/harbor

I have tried to push a chart to Harbor with helm v3 client, which already has a push plugin installed.
But, get the following error:

root@dev:~# helm push --ca-file=/ca.crt --username=admin --password=Harbor12345 /mariadb-4.3.1.tgz myrepo Error: Couldn't load repositories file (/root/.helm/repository/repositories.yaml). You might need to run `helm init` (or `helm init --client-only` if tiller is already installed) Error: plugin "push" exited with error

To workaround it, use the URL to do the helm push.
helm push --ca-file=/ca.crt --username=admin --password=Harbor12345 /mariadb-4.3.1.tgz https://1.1.1.1/chartrepo/library

After that, I can push a chart into Harbor.

root@dev:~# helm version
version.BuildInfo{Version:"v3.0.0", GitCommit:"e29ce2a54e96cd02ccfce88bee4f58bb6e2a28b6", GitTreeState:"clean", GoVersion:"go1.13.4"}
root@dev:~# helm push --ca-file=/ca.crt --username=admin --password=Harbor12345 /mariadb-4.3.1.tgz https://1.1.1.1/chartrepo/library
Pushing mariadb-4.3.1.tgz to https://1.1.1.1/chartrepo/library...
Done.

The issue on the push plugin: https://github.com/chartmuseum/helm-push/issues/37

arehelm-chart-repo kinnote

All 7 comments

Root cause seems that the push plugin tries to read repositories.yaml under helm home which no longer exists in helm v3:
https://helm.sh/docs/faq/#xdg-base-directory-support

这个问题 很简单
可以加入helm的微信交流群 ,需要交流的加我微信 easonak185

This is a quickfix until the push pluging comes with support for helm3
You may need to declare your repositories at two different place :

hotfix for push pluging

helm repo add harbor-staging --username=${HARBOR_USER} --password=${HARBOR_PASSWORD} ${HARBOR_HELMCHART_PROJECT} --repository-config=/$HOME/.helm/repository/repositories.yaml
with a tiny modification

'sed -i -e "s/apiVersion: ""/apiVersion: v1/g" /$HOME/.helm/repository/repositories.yaml'

add the repos to the standart file

helm repo add harbor-staging --username=${HARBOR_USER} --password=${HARBOR_PASSWORD} ${HARBOR_HELMCHART_PROJECT}

Thanks @LinuxArchitects
With this workaround I can push chart to my harbor chart repo successfully with:

helm push --ca-file /data/cert/ca.crt mysql-1.4.0.tgz myharborrepo

I still need to specify --ca-file even the repositories.yml contains "- caFile: /data/cert/ca.crt".
But after that when I fetch it I got the error again:

helm --ca-file /data/cert/ca.crt --username test --password Test1234! --key-file /data/cert/myharbor.test.com.key --cert-file /data/cert/myharbor.test.com.crt fetch myharborrepo/mysql

Error: Get https://myharbor.test.com/chartrepo/myharborrepo/charts/mysql-1.4.0.tgz: x509: certificate signed by unknown authority

You don’t need to specify the certificate unless it’s a self signed one :

Please retry without specifying certificates and send the result :

helm --username test --password Test1234! fetch myharborrepo/mysql

@LinuxArchitects ah my local harbor is self singed cert so I have to:)

Per comments, https://github.com/chartmuseum/helm-push/issues/37#issuecomment-565845431.
the helm-push v0.8.0 has been fixed this issue, close the issue as resovled.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

reasonerjt picture reasonerjt  ·  3Comments

abououdine picture abououdine  ·  3Comments

cedvan picture cedvan  ·  3Comments

levchik picture levchik  ·  4Comments

mramanathan picture mramanathan  ·  3Comments