julia-actions / cache

A shortcut action to cache Julia artifacts, packages, and registries.
MIT License
38 stars 8 forks source link

Cannot assume `jq` is installed on runners named `GitHub Actions` #104

Closed IanButterworth closed 6 months ago

IanButterworth commented 6 months ago

Posted by @musoke here https://github.com/julia-actions/cache/pull/88#issuecomment-1892663926


FYI: this change seems to have broken one of my CI runs. I think the problem is that I'm running in a container on a GitHub hosted runner, so jq isn't installed. v1.4.1 works but v1.5.1 does not.

here's a log: https://github.com/musoke/WolframExpr.jl/actions/runs/7532058237/job/20501935392#step:5:65

omus commented 6 months ago

When we added the if: ${{ !startsWith(runner.name, 'GitHub Actions') }} check we were only considering jobs running on GitHub-hosted runners vs. self-hosted runners. In this particular case the user running inside a container running on a GitHub-hosted runner so this step is skipped as the runner.name does start with "GitHub Actions" however the container doesn't have jq installed.

We can probably detect a job running in a container via the job context. If that doesn't work we can perform a runtime check to see if jq is installed or alternatively just always try to install jq.

musoke commented 6 months ago

Does that jq install action work inside containers?

Why does check for a GitHub hosted runner exist? Presumably this is because those runners already have jq installed. Is there a problem with trying to install jq anyway? It looks like it is set not to force installation if it is already installed. Perhaps those checks are brittle too?

musoke commented 6 months ago

I'm happy submit a PR if there is a clear/straightforward solution.