jankatins/yep

Handle downloads from http lists of releases (like kubectl and helm)

jankatins opened this issue · 0 comments

Description

Some high profile downloads are behind some kind of releases list as a normal web page. Automating the download from such page is usually

  1. Go to a webpage
  2. Click on a release and go to that page
  3. Click on a link on that page which downloads the release archive

zinit handled that by an annex which works in steps: download a specific URL which extracts a version (e.g. by going through all links and get the highest one) and then adds that version into the final download URL.

Another idea is to embedded something like xpath/jsonpath and use that to extract the final download URL.

This would end up as

  • GET <url> | xpath_extract(<xpath_expression>) | download
  • GET <json url> | jsonpath_extract(<jsonpath_expression>) | download
  • GET <json url> | jsonpath_extract(<jsonpath_expression>) | select_by_version | download: the jsonpath returns a list and the select_by_version does the equivalent of echo $list | grep $version
  • GET <json url> | jsonpath_extract(<jsonpath_expression>) | download(<url_with_%VERSION%_in_it>) -> extracts just a single item which is s&r into the ´%version%` part

Another alternative is using the shell for that, because for sure there is some curl/jq/... magic to do the same...