cypress-docker-images icon indicating copy to clipboard operation
cypress-docker-images copied to clipboard

Cypress in docker fails to run with read-only project dir

Open varac opened this issue 2 years ago • 10 comments

Current behavior

Currently, when using the cypress/included docker image and mounting a project dir read-only, cypress fails to run.

Desired behavior

It should not fail and run the tests. It could issue a warning that it is not able to save screenshots or videos.

Test code to reproduce

❯ docker run --rm -it -v $PWD:/e2e:ro -w /e2e cypress/included:10.2.0
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[213:0624/072239.698161:ERROR:sandbox_linux.cc(377)] InitializeSandbox() called with multiple threads in process gpu-process.
[213:0624/072239.700359:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.
EROFS: read-only file system, access '/e2e'
Error: EROFS: read-only file system, access '/e2e'

Cypress Version

10.2.0

Other

These issues/PRs might be related, however I was not able to determine if this behaviour should be already fixed or not:

  • cypress-io/cypress#7126
  • cypress-io/cypress#6407
  • cypress-io/cypress#1281
  • cypress-io/cypress#7310

varac avatar Jun 24 '22 07:06 varac

Interestingly, this seems to only happen in docker. Running is locally (installed with npm) leads to the desired result:

❯ touch /tmp/cytest/de
touch: cannot touch '/tmp/cytest/de': Permission denied

❯ ./node_modules/.bin/cypress run -P /tmp/cytest 
This folder is not writable: /tmp/cytest

Writing to this directory is required by Cypress in order to store screenshots and videos.

Enable write permissions to this directory to ensure screenshots and videos are stored.

If you don't require screenshots or videos to be stored you can safely ignore this warning.
Warning: We failed to trash the existing run results.

This error will not alter the exit code.

Error: EACCES: permission denied, unlink '/tmp/cytest/cypress/videos/test-nextcloud.cy.js.mp4'



====================================================================================================

  (Run Starting)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Cypress:        10.2.0                                                                         │
  │ Browser:        Electron 100 (headless)                                                        │
  │ Node Version:   v16.15.1 (/snap/node/6378/bin/node)                                            │
  │ Specs:          1 found (test-nextcloud.cy.js)                                                 │
  │ Searched:       cypress/e2e/**/*.cy.{js,jsx,ts,tsx}                                            │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  test-nextcloud.cy.js                                                            (1 of 1)
...

varac avatar Jun 24 '22 07:06 varac

The use-case is that I want to run cypress in kubernetes, and the project dir is mounted from a readonly configmap.

varac avatar Jun 24 '22 07:06 varac

I'm encountering this too. Desperately looking for a fix

hai-le-niteco avatar Aug 04 '22 08:08 hai-le-niteco

Encountering this in a gitlab pipeline, also see the error is related here as well: https://github.com/cypress-io/cypress/issues/23326

Tigatok avatar Aug 15 '22 18:08 Tigatok

Similar errors displayed here, with Kubernetes. Surprisingly, the tests are working fine. And I managed to remove the ALSA errors, but not yet the "libva error". But I wish Cypress would not display "This folder is not writable" in quiet mode...

[14887:0901/193637.064164:ERROR:zygote_host_impl_linux.cc(263)] Failed to adjust OOM score of renderer with pid 15064: Permission denied (13)
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[15064:0901/193637.106703:ERROR:sandbox_linux.cc(377)] InitializeSandbox() called with multiple threads in process gpu-process.
[15064:0901/193637.112561:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.
This folder is not writable: /usr/src/app

Writing to this directory is required by Cypress in order to store screenshots and videos.

Enable write permissions to this directory to ensure screenshots and videos are stored.

If you don't require screenshots or videos to be stored you can safely ignore this warning.
[14887:0901/193640.509047:ERROR:zygote_host_impl_linux.cc(263)] Failed to adjust OOM score of renderer with pid 15243: Permission denied (13)
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM default
[15394:0901/193650.405867:ERROR:alsa_util.cc(204)] PcmOpen: default,No such file or directory
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM default
[15394:0901/193650.406082:ERROR:alsa_util.cc(204)] PcmOpen: plug:default,No such file or directory

SvartAlfe avatar Sep 02 '22 08:09 SvartAlfe

I have this problem too, on Cypress version 12.17.4

immogish avatar Apr 03 '24 16:04 immogish