If cypress-io/github-action is used to run a Cypress Docker image cypress/included as a container with --user 1001 (as recommended), then GitHub actions may report a caching error:
Failed to restore: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2
Background
cypress/included Docker images include the Cypress binary installed in /root/.cache/Cypress with owner root (see environment variable CYPRESS_CACHE_FOLDER of Docker image).
By default cypress-io/github-action attempts to cache and restore the Cypress binary. Any such restore action fails if the user has been set to a non-root value, since the owner of $CYPRESS_CACHE_FOLDER is root.
Caching the Cypress binary is superfluous when the Docker image already includes the binary.
If the environment variable CYPRESS_INSTALL_BINARY=0 is set (see Skipping installation) then isCypressBinarySkipped is set internally in the action and no CYPRESS_BINARY_CACHE is saved. If no cache is saved, then restoreCachedCypressBinary will not be able to restore a cache and will not provoke any error condition.
Note that this is not quite error proof because if a workflow has run without CYPRESS_INSTALL_BINARY=0 and has stored a cache, then this will be picked up and provoke an error message. This is mitigated by the fact that the error is cosmetic, in that it does not cause the workflow to fail. It is also self-correcting since cache entries which have not been accessed in over 7 days are removed (see User limits and eviction policy).
Issue
If
cypress-io/github-action
is used to run a Cypress Docker image cypress/included as a container with--user 1001
(as recommended), then GitHub actions may report a caching error:Background
cypress/included Docker images include the Cypress binary installed in
/root/.cache/Cypress
with ownerroot
(see environment variableCYPRESS_CACHE_FOLDER
of Docker image).By default
cypress-io/github-action
attempts to cache and restore the Cypress binary. Any such restore action fails if the user has been set to a non-root value, since the owner of$CYPRESS_CACHE_FOLDER
isroot
.Caching the Cypress binary is superfluous when the Docker image already includes the binary.
If the environment variable
CYPRESS_INSTALL_BINARY=0
is set (see Skipping installation) thenisCypressBinarySkipped
is set internally in the action and noCYPRESS_BINARY_CACHE
is saved. If no cache is saved, thenrestoreCachedCypressBinary
will not be able to restore a cache and will not provoke any error condition.Note that this is not quite error proof because if a workflow has run without
CYPRESS_INSTALL_BINARY=0
and has stored a cache, then this will be picked up and provoke an error message. This is mitigated by the fact that the error is cosmetic, in that it does not cause the workflow to fail. It is also self-correcting since cache entries which have not been accessed in over 7 days are removed (see User limits and eviction policy).Change
Add advice to README > Docker image to set
CYPRESS_INSTALL_BINARY=0
with cypress/included Docker images.