sonatype-nexus-community / nexus-repository-helm

At the Helm, Helm Yeah, v k8s
Eclipse Public License 1.0
97 stars 71 forks source link

404 issue when adding helm repo, maybe regression? #103

Closed jondkelley closed 4 years ago

jondkelley commented 4 years ago

Versions:


I created a repository called helm_hosted which is a hosted repository using an s3 blob store.

I also tried "Rebuild index" in case that did something, it did not help this issue.

helm repo add helm-hosted https://xxxx:xxxx@artifacts.my-org.tld/repository/helm_hosted/

Output:

Error: looks like "https://xxxx:xxxx@artifacts.my-org.tld/repository/helm_hosted/" is not a valid chart repository or cannot be reached: failed to fetch https://xxxx:xxxx@artifacts.my-org.tld/repository/helm_hosted/index.yaml : 404 Not Found

I want to publish a helm chart, but I need to add a repository to publish to first.

This might be a regression of https://github.com/sonatype-nexus-community/nexus-repository-helm/commit/7c4166885e693c902faff529577de5019aa13431

Other people seem to be using this plugin?

Not sure if this is user error, or a bug. Let me know if this is a simple fix.

We might want to update the README if the helm repo add command is incorrect in the context of using Nexus.

A lot of tools and everything I see says you need a repository first before you can release a chart. In github they have you add a blank index.yaml so the repo add command works.

I can't touch a file in Nexus to get this to work, so I am not sure if this is a bug (since it was already patched?)

cwash commented 4 years ago

I've installed 0.0.13 against 3.20.0-04, and I was able to create a helm hosted repo and upload a locally packaged tar.gz chart just fine using curl.

I do get a weird warning during upload, but I'm also never able to get index.yaml to render appropriately. Nexus promptly returns me a 404. I can, however, curl down the .tar.gz just fine, and browse the artifact and metadata just fine in the Nexus UI.

Here's part of the stacktrace spit out with the warning in the logs when successfully uploading an artifact - seems to me it may be a version related red herring, not sure if it would have anything to do with being able to render the yaml.

Unexpected exception: java.lang.NoSuchMethodError: org.sonatype.nexus.transaction.Operations.withDb(Lcom/google/common/base/Supplier;)Lorg/sonatype/nexus/transaction/Operations;
java.lang.NoSuchMethodError: org.sonatype.nexus.transaction.Operations.withDb(Lcom/google/common/base/Supplier;)Lorg/sonatype/nexus/transaction/Operations;
    at org.sonatype.repository.helm.HelmUploadHandler.handle(HelmUploadHandler.java:102)
    at org.sonatype.nexus.repository.upload.internal.UploadManagerImpl.handle(UploadManagerImpl.java:98)
mlukaretkyi commented 4 years ago

@jondkelley I have tried to reproduce your problem but with no success. I tried:

  1. Create helm hosted repo with s3 blob store
  2. Upload MySQL chart to repo
  3. Add to helm repository using helm client

I think, that the problem is not s3, I guess the problem with your NXRM In your error, I see 404. I can get 404 if I try to use a not existed repository.

  1. Can you try to create repo using default blobstore. I want to make sure, that the problem is not s3.
  2. Upload some chart using REST and download index.yaml

For example. NXRM is running on localhost:8081 and repo called helm-hosted http://localhost:8081/repository/helm-hosted/index.yaml

@cwash Are you sure, that you use helm 0.0.13 and NXRM 3.20.0? Because 0.0.13 work with 3.19.0. By the way, I also tried to reproduce your issue and with no success. Can you try 0.0.13 and 3.19.0 because your code looks like a not compatible

However, coming soon will release 3.21 and helm will be included as a dependency

dylanpiergies commented 4 years ago

I'm getting similar:

$ helm repo add proxy https://nexus/repository/helm-internal/
Error: looks like "https://nexus/repository/helm-internal/" is not a valid chart repository or cannot be reached: failed to fetch https://nexus/repository/helm-internal/index.yaml : 404 Not Found

I have also tried uploading a chart using curl -d @my-chart-0.0.1.tgz -u me:mypassword https://nexus/repository/helm-internal/ and get a 500 response instead.

Finally, using the Sonatype community Helm Push plugin:

$ helm nexus-push https://nexus/repository/helm-internal/ . -u 'me' -p 'mypass'
Pushing . to repo /...
Error: plugin "nexus-push" exited with error

@mlukaretkyi Could you provide more details on you attempted reproduction? e.g. "Upload MySQL chart to repo"... how?

cdivitotawela commented 4 years ago

I am using Nexus-OSS-3.20.1 and Helm tag 0.0.13. I have created helm repository and using the local filesystem blobstore called hosted. This is empty directory.

When I try to add the repository using helm client I get the error

helm repo add nexus http://repository.sbx.company.com/repository/helm-release-hosted/
Error: looks like "http://repository.sbx.company.com/repository/helm-release-hosted/" is not a valid chart repository or cannot be reached: failed to fetch http://repository.sbx.company.com/repository/helm-release-hosted/index.yaml : 404 Not Found

Then I thought let me upload a package and run the build index. But when I try to upload the artifact I get following UI error Ext.JSON.decode(): You're trying to decode an invalid JSON String: ERROR: (ID f0efb022-f3f1-42dd-85e1-355b72819dbb) java.lang.NoSuchMethodError: org.sonatype.nexus.transaction.Operations.withDb(Lcom/google/common/base/Supplier;)Lorg/sonatype/nexus/transaction/Operations;

It same as @cwash getting.

Today I have noticed more recent version 1.0.2. Let me try and see any better.

cdivitotawela commented 4 years ago

Nexus repository 3.21.0 now available with inbuilt Helm. Thanks for getting in main stream. Nice work! I am going to check it now.

aornatovskyy commented 4 years ago

Nexus repository 3.21.0 now available with inbuilt Helm. Thanks for getting in main stream. Nice work! I am going to check it now.

@cdivitotawela can you please update with results?

cdivitotawela commented 4 years ago

@aornatovskyy I installed 3.21.0 (I use docker image) and added the helm repo-hosted repo using the API. I can see repo does have index.yaml created and could add the repository with following command helm repo add hosted http://<nexus-server>/repository/helm-hosted/. Looks good so far. Don't see the issue I noticed with 0.0.13.

Looking good so far. Next I will be implementing CI pipeline to push the packages to Helm and I would not expect to see issues there.

So I can confirm that if anyone experienced issue on this ticket with 0.0.13, please update Nexus to 3.21.0 which Helm is available bundled to Nexus.

cdivitotawela commented 4 years ago

Official documentation here https://help.sonatype.com/repomanager3/formats/helm-repositories

aornatovskyy commented 4 years ago

@aornatovskyy I installed 3.21.0 (I use docker image) and added the helm repo-hosted repo using the API. I can see repo does have index.yaml created and could add the repository with following command helm repo add hosted http://<nexus-server>/repository/helm-hosted/. Looks good so far. Don't see the issue I noticed with 0.0.13.

Looking good so far. Next I will be implementing CI pipeline to push the packages to Helm and I would not expect to see issues there.

So I can confirm that if anyone experienced issue on this ticket with 0.0.13, please update Nexus to 3.21.0 which Helm is available bundled to Nexus.

Thanks for update @cdivitotawela

aornatovskyy commented 4 years ago

Going to close an issue if you don't mind? @jondkelley

aornatovskyy commented 4 years ago

Close the issue.

Sanjanare commented 4 years ago

@aornatovskyy i see the same issue with 3.21.2 nexus as well, i have created helm-hosted repo on nexus which uses ldap , i see the same error,

Error: Looks like "https://*****.com/repository/helm/" is not a valid chart repository or cannot be reached: Failed to fetch https://******.com/repository/helm/index.yaml : 401 Unauthorized

i see error with helm nexus-push plugin as well i am able to upload the .tgz file using UI but when i do from remote machine i get above error.

aornatovskyy commented 4 years ago

@aornatovskyy i see the same issue with 3.21.2 nexus as well, i have created helm-hosted repo on nexus which uses ldap , i see the same error,

Error: Looks like "https://*****.com/repository/helm/" is not a valid chart repository or cannot be reached: Failed to fetch https://******.com/repository/helm/index.yaml : 401 Unauthorized

i see error with helm nexus-push plugin as well i am able to upload the .tgz file using UI but when i do from remote machine i get above error.

Hi @Sanjanare sorry for the long silence. Are you still facing this issue? Please post a ticket. https://issues.sonatype.org/ Regards!

aornatovskyy commented 4 years ago

@Sanjanare looks like you are not authorized. Can I ask you use nxrm basic authorization. I want to make sure, that this is no problem with LPAD connection. Try helm repo add nexusrepo http://$HOST_DOMAIN:8081/repository/<helm-repo-name>/ --username <your_username> --password <your_password>

Sanjanare commented 4 years ago

@aornatovskyy my problem is resolved, i have created a local user in the nexus repo , and passed the username and password of local user from remote, that worked, thank you so much for checking :)

Sanjanare commented 4 years ago

@aornatovskyy ldap user also worked , gave to wrong permissions before :)