Handle downloads from http lists of releases (like kubectl and helm)
jankatins opened this issue · 0 comments
jankatins commented
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
- Go to a webpage
- Click on a release and go to that page
- 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 ofecho $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...