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

docs: recommend CYPRESS_INSTALL_BINARY=0 for cypress/included Docker image #1202

Merged

Conversation

MikeMcC399
Copy link
Collaborator

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:

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).

Change

Add advice to README > Docker image to set CYPRESS_INSTALL_BINARY=0 with cypress/included Docker images.

@MikeMcC399 MikeMcC399 added the documentation Improvements or additions to documentation label Jun 17, 2024
@MikeMcC399 MikeMcC399 self-assigned this Jun 17, 2024
@cypress-app-bot
Copy link

@MikeMcC399 MikeMcC399 force-pushed the cypress-included-setup branch from 52c1ebc to 6d7a0ac Compare June 19, 2024 12:09
@MikeMcC399

This comment was marked as outdated.

@jennifer-shehane jennifer-shehane merged commit aaca9cc into cypress-io:master Jun 19, 2024
74 checks passed
@MikeMcC399 MikeMcC399 deleted the cypress-included-setup branch June 19, 2024 16:21
Copy link

🎉 This PR is included in version 6.7.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants