Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup-r-dependencies cache failing on container ghcr.io/r-hub/r-minimal/r-minimal:patched #881

Closed
pascalgulikers opened this issue Jul 18, 2024 · 7 comments

Comments

@pascalgulikers
Copy link

STOP

If you are debugging a failed build or have a question about GitHub Actions in
general do NOT open an issue here. Either post on the Actions sections of
the GitHub Community or the RStudio Community forums.

Open an issue here only if you have a bug in one of the
custom R specific actions themselves.

Describe the bug
We're using pre-built base images in our CI workflow, based on the r-minimal:patched image. Unfortunately caching is failing. See output below.

To Reproduce
Relevant output:

Run r-lib/actions/setup-r-dependencies@v2
  with:
    extra-packages: devtools, lintr, testthat, roxygen2
    needs: check
    lockfile-create-lib: .libPaths()[1]
    cache: true
    cache-version: 1
    packages: deps::., any::sessioninfo
    pak-version: stable
    working-directory: .
    dependencies: "all"
    upgrade: FALSE
    pandoc-version: 3.1.11
Run actions/cache@v4
  with:
    path: /*
  !/pak
  
    key: Alpine Linux v3.19-R version 4.4.1 Patched (2024-07-08 r86902)-1-172c76f3b3c809379ef4687b1968f323c4cf52a4f6e538e3bb754f740f80b681
    restore-keys: Alpine Linux v3.19-R version 4.4.1 Patched (2024-07-08 r86902)-1-
    save-always: false
    enableCrossOsArchive: false
    fail-on-cache-miss: false
    lookup-only: false

Post Install dependencies:

Post job cleanup.
Post job cleanup.
Post job cleanup.
/usr/bin/docker exec  48bfdfc038d6268b97026531cfbece85cb34f63006cf45a68a053fe88753eadf sh -c "cat /etc/*release | grep ^ID"
/usr/bin/tar --posix -cf cache.tgz --exclude cache.tgz -P -C /__w/MyRepo/MyRepo --files-from manifest.txt -z
/usr/bin/tar: ../../../proc/bus/pci/00/00.0: File shrank by 192 bytes; padding with zeros
/usr/bin/tar: ../../../proc/bus/pci/00/01.0: File shrank by 192 bytes; padding with zeros
/usr/bin/tar: ../../../proc/bus/pci/00/01.3: File shrank by 192 bytes; padding with zeros
**output truncated***
/usr/bin/tar: ../../../sys/module/drm/initstate: File shrank by 4091 bytes; padding with zeros
/usr/bin/tar: Exiting with failure status due to previous errors
Warning: Failed to save: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2

Expected behavior
To be able to save the cache in order to speed up future runs

Additional context
Add any other context about the problem here.

@pascalgulikers pascalgulikers added the bug an unexpected problem or unintended behavior label Jul 18, 2024
@gaborcsardi
Copy link
Member

You can't tar & untar files in /proc. Caching /* is a bad idea in general. It'll not work for special files (devices, sockets, /proc etc.) and a typical Linux / file system has many special files.

This also has nothing to do with our actions.

@gaborcsardi gaborcsardi removed the bug an unexpected problem or unintended behavior label Jul 18, 2024
@pascalgulikers
Copy link
Author

Are you saying that our env.R_LIBS_USER is not correct? Because the path is set in setup-r-dependencies and cannot be altered other than with env.R_LIBS_USER

${{ env.R_LIBS_USER }}/*

@gaborcsardi
Copy link
Member

Right, you probably do not set R_LIBS_USER at all, that could possibly cause this.

To quote the Bug Report template:

You MUST include a link to the full logs of the failed build. Bug reports which do not contain a link, or only contain a screenshot of the failed build will be closed.

@pascalgulikers
Copy link
Author

pascalgulikers commented Jul 18, 2024

I see, well Sys.getenv("R_LIBS_USER") gives back /usr/local/lib/R/library since it's defined in the container image, but it isn't exposed as a GHA env variable. The script is therefore not consistent (using env.VARIABLE and Sys.getenv("VARIABLE")) in different lines of code, but I can see why you can't use an R script as parameter to the actions/cache action. Perhaps in a extra previous step, like so:

- name: Convert container env variable to Github env variable
  shell: bash
  run: |
    echo "R_LIBS_USER=${R_LIBS_USER}" >> $GITHUB_ENV

@gaborcsardi
Copy link
Member

There is no such thing as a GitHub env variable. ${{ env }} has access to all env vars. But R_LIBS_USER is not set on your container, it is only set inside R. You'll need to set it for all processes, not just R.

@pascalgulikers
Copy link
Author

pascalgulikers commented Jul 18, 2024

I think you got that wrong imho Gabor, please see: https://docs.github.com/en/actions/learn-github-actions/variables#about-variables
Env variables in a workflow are not the same as the ones in the container, otherwise a lot could be exposed unwanted in a workflow

Copy link

github-actions bot commented Aug 2, 2024

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue and include a link to this issue

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants