r-hub / rhub

R-hub API client
https://r-hub.github.io/rhub/
Other
353 stars 51 forks source link

Git not installed on containers (/git submodules) #612

Closed fhenz closed 4 months ago

fhenz commented 4 months ago

Git seems to not be installed on at least GCC14 & clang19 containers when the repo gets checked out (step r-hub/actions/checkout@v1).

I encountered this originally because I was testing git submodules, and manually added submodules: true to that step in the workflow file. This then led the action to fail (Input 'submodules' not supported when falling back to download using the GitHub REST API. To create a local Git repository instead, add Git 2.18 or higher to the PATH.). I checked afterwards and even without submodules, checkouts output contains this: The repository will be downloaded using the GitHub REST API To create a local Git repository instead, add Git 2.18 or higher to the PATH.

My first workaround attempt was running git submodule update --init --recursive after the checkout, but this then gave the error /__w/_temp/f02433a2-2220-4eaa-8f18-86cf765ab970.sh: line 1: git: command not found. After some debugging (which git/git --version) it seemed git was not installed on the container.

The second attempt was adding git as SystemRequirements to the DESCRIPTION file (following #600) and running the submodule update after r-hub/actions/setup-deps@v1. This kind of works, the problem here is that the original checkout doesn't create a local git repository (since fallback to REST API) so the submodule update returns: fatal: not a git repository.

My solution now is to install git via the package manager in a step before checkout (then submodules: true works), but this is of course not great with the different containers (dnf for gcc14, apt-get for clang19, etc.).

gaborcsardi commented 4 months ago

Yeah, originally this was intentional, because git was also not installed on some of the CRAN machines. OTOH, I am not sure if that's still true, and since we are running the checks on GitHub, it certainly causes problems.

So yeah, I think we should install git on the containers.

gaborcsardi commented 4 months ago

The containers will be rebuilt overnight, so this should be fixed tomorrow.

fhenz commented 4 months ago

Cool, thanks for the quick response & resolution!