cypress-io / cypress-docker-images

Docker images with Cypress dependencies and browsers
https://on.cypress.io/continuous-integration
MIT License
1k stars 376 forks source link

Non-fatal caching error with cypress/included in GitHub Actions with non-root user #1119

Open MikeMcC399 opened 3 weeks ago

MikeMcC399 commented 3 weeks ago

Issue

If cypress-io/github-action is used to run cypress/included 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

The workflow includes the following:

    container:
      image: cypress/included
      options: --user 1001

This problem does not occur the first time a workflow is run in a branch. It happens on subsequent runs when caches have been established.

The caching error does not prevent the action from successfully completing Cypress tests.

Logs

/usr/bin/tar -xf /__w/_temp/ca2a82ec-2d14-4f9f-a1e8-869a277f1c39/cache.tgz -P -C /__w/cypress-docker-images/cypress-docker-images -z
/usr/bin/tar: ../../../root/.cache/Cypress/13.11.0/Cypress/resources/app/packages/resolve-dist: Cannot utime: Operation not permitted
/usr/bin/tar: ../../../root/.cache/Cypress/13.11.0/Cypress/resources/app/packages/resolve-dist: Cannot change mode to rwxr-xr-x: Operation not permitted
/usr/bin/tar: ../../../root/.cache/Cypress/13.11.0/Cypress/resources/app/packages/net-stubbing/node_modules/mime-db: Cannot utime: Operation not permitted
/usr/bin/tar: ../../../root/.cache/Cypress/13.11.0/Cypress/resources/app/packages/net-stubbing/node_modules/mime-db: Cannot change mode to rwxr-xr-x: Operation not permitted
/usr/bin/tar: ../../../root/.cache/Cypress/13.11.0/Cypress/resources/app/packages/net-stubbing/node_modules/mime-types: Cannot utime: Operation not permitted
/usr/bin/tar: ../../../root/.cache/Cypress/13.11.0/Cypress/resources/app/packages/net-stubbing/node_modules/mime-types: Cannot change mode to rwxr-xr-x: Operation not permitted
...
...
/usr/bin/tar: ../../../root/.cache/Cypress: Cannot utime: Operation not permitted
/usr/bin/tar: ../../../root/.cache/Cypress: Cannot change mode to rwxr-xr-x: Operation not permitted
/usr/bin/tar: Exiting with failure status due to previous errors
Warning: Failed to restore: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2

Workaround

Set the environment variable CYPRESS_INSTALL_BINARY=0 to avoid unnecessary caching of the Cypress binary. For instance:

  docker-included:
    runs-on: ubuntu-22.04
    container:
      image: cypress/included
      options: --user 1001
    steps:
      - uses: actions/checkout@v4
      - uses: cypress-io/github-action@v6
        env:
          CYPRESS_INSTALL_BINARY: 0

This setting should be added to the documentation.