arkade
arkade copied to clipboard
How to fail if tool is not supported in os/arch?
What's the recommendation on handling binaries that are not available on the users OS or arch? E.g. I'm looking into adding kubie, but they only have binaries for linux and macos on amd64.
Is there a way to fail arkade get
with a friendly message?
Hi @rberrelleza - not as far as I know, what happens currently - 404?
We could give an error like, Server returned a not found error, APP may not be available for your system.
If we know which arche/os combos are supported can we create a map/list for a tool and verify the client conforms before trying a get?
could be a
map[string][]string
"linux": ["amd64", "arm64", "i386"],
"macos": ["amd64"]
Hang that off the Tool
and add a func (t *Tool) IsSupported(os, arch string) bool
then have a func that takes that map, given os
and arch
and sees if its there?
Today, depending on the tool, you might get a 404 or a template-related error (for cases where a variable might not generated or something like that).
I like @Waterdrips approach here. I think we could add that as an optional field, so that we can give the user a more specific error message (e.g. "kubie is not available on Windows") rather than a more cryptic, or implementation specific error, like a 404.
I think that handling the HTTP code would be a simple approach. The templates just need to go to an invalid URL when there's no package available
There shouldn't be errors from the template. Can you show some examples?
There shouldn't be errors from the template. Can you show some examples?
None of the ones in arkade. This came to me while I was working on adding kubie. It doesn't have a windows or arm release, and didn't know what best practice to follow.
I think that just allowing the code to hit a 404 should be OK.
It seems that we get a "404 not found" message, I'm OK with that. We could perhaps write something like "arkade didn't find a compatible binary for your system"
Adding --os --arch flags to arkade get
would be helpful for testing though, where we can inject/override the values.
Since then, we have the --os
and --arch
flags with a graceful handling of 404 may I close this?
Fine with me!
/close