hub icon indicating copy to clipboard operation
hub copied to clipboard

API: support search by repo URL

Open brsolomon-deloitte opened this issue 2 years ago • 5 comments

I see that /repositories/search takes a name but not a url. Is it possible to search by URL to locate a repository and its metadata?

For example:

  • I have https://charts.bitnami.com/bitnami as URL
  • I want to be able to /repositories/search with url=https://charts.bitnami.com/bitnami and see in result that the repo is bitnami
  • and then execute /packages/helm/bitnami/keycloak

brsolomon-deloitte avatar Feb 07 '22 15:02 brsolomon-deloitte

Hi @brsolomon-deloitte 👋

This could be a nice addition, we'll look into it 👍

Thanks!

tegioz avatar Feb 07 '22 18:02 tegioz

@tegioz is there any multi-step workaround you can think of, even it is a little messy? (Perhaps even with helm or something else?)

I am having a surprisingly tough time just doing a map-lookup of the repo name from its url.

brsolomon-deloitte avatar Feb 07 '22 18:02 brsolomon-deloitte

For some background, we are looking to create a "Helm Dependabot" that will periodically scan for possible Helm chart version updates. It currently has the repo URL and current version (and can easily grab it via yq) but not the repo name itself in Chart.yaml.

brsolomon-deloitte avatar Feb 07 '22 18:02 brsolomon-deloitte

Maybe the endpoint below can be of help 🙂

https://artifacthub.io/docs/api/#/Integrations/getHelmExporterDump

It was created for a tool with a similar purpose actually. It'll give you a short summary of all repositories, that includes the url for a fast local lookup.

Hope it helps.

tegioz avatar Feb 07 '22 18:02 tegioz

Nice, here's what I put together (could also just pipe curl to jq):

$ curl -fsSL \
  -o helm-export.json \
  'https://artifacthub.io/api/v1/helm-exporter' \
  -H 'accept: application/json'
$ jq -M '.[] | select(.repository.url == "https://charts.bitnami.com/bitnami" and .name == "keycloak")' helm-export.json 
{
  "name": "keycloak",
  "version": "6.1.4",
  "repository": {
    "name": "bitnami",
    "url": "https://charts.bitnami.com/bitnami"
  }
}

brsolomon-deloitte avatar Feb 07 '22 18:02 brsolomon-deloitte