action-cache-http
action-cache-http copied to clipboard
Dependencies on the host operating system: curl not found
This Github Action is implemented a "JavaScript" action but in fact passes through the work to a shell script. The shell script in turn requires a number of commands to exist on the host besides sh, but the code doesn't check to see if any the commands exist, which can result in less helpful failure modes, like this:
Error: Command failed: /__w/_actions/kevincobain2000/action-cache-http/v2/cache-http.sh
/__w/_actions/kevincobain2000/action-cache-http/v2/cache-http.sh: 33: [: =: unexpected operator
/__w/_actions/kevincobain2000/action-cache-http/v2/cache-http.sh: 33: [: =: unexpected operator
I think that failed because the curl command is required but not found on the host. Another dependency is the openssl command.
Requiring extra dependencies on the host could be avoided if this were implemented as a container action instead of JavaScript action that calls a shell script.
Otherwise, it would be helpful there were at least explicit checks for curl and openssl to generate better failure messages along with docs that they are required.
I ran into this again today for a different project, trying to use a standard "ubuntu:18.04" image as the base, but that image includes wget but not curl in the base install. There's no need to use the non-standard curl command, as the more-common wget command will do. Or as mentioned above, just use the native JavaScript environment provided by Github Actions.
I started the curl to wget syntax conversion, and then realized I had an internal container handy that had curl installed so I gave up. But if someone else is motivated to write the curl syntax with wget, here's my start:
http_proxy=$INPUT_HTTP_PROXY wget \
--http-user=$INPUT_BASIC_AUTH_USER_NAME \
--http-password=$INPUT_BASIC_AUTH_PASSWORD \
--method=GET \
$INPUT_CACHE_HTTP_API/health
It's still probably a better idea to use the the native JavaScript Github Actions support and completely eliminate dependencies on the host.