cypress: Cypress should not require write access of root folder
Why do we check if the root of the project is writeable? π i.e. the fs.accessAsync(projectRoot, fs.W_OK)
cc:/ @zacblazic
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 16
- Comments: 43 (20 by maintainers)
npm install --unsafe-permsolved it for meFYI this may become a blocker for using Cypress under Angular CLI at some point, when we use a buildtool that creates a readonlyFS for hermeticity during testing
Here is Cypress attempting to gain access to root of a docker image where our install is happening. Please note that this isnβt even us running cypress. The project is simply running itβs normal build process but this time we have added cypress to the project and during a yarn/npm install cypress attempts to access root to make a
/.cache/Cypressdirectory. It seems like an install script that cypress attempts to run regardless of whether itβs CI or not and in our jenkins pipeline it will fail as these are being built on docker images. Our options then are either to disable all scripts which could be detrimental with other dependencies, or to remove Cypress completely from the projectβ¦ which we would rather not doβ¦ just yetβ¦Any update on this? Would be great for the check to be removed for the read only FS use case. And Videos/Screenshots will be written into a custom writable location.
I am currently experiencing the same issue while running it on Bitrise. Is there an expected timeline as to when this will get completed? If there is a working solution already Iβd love to take a look at it.
Because we seed the project with
cypress.jsonand thecypressfolder and example spec code, and plugins, and fixtures, etc.Could we get some movement here? Itβs a pretty easy code change from the looks of it.
@brian-mann So if we disabled video / screenshot generation. And you disable the hard coded write access check (replace with warning) Then there shouldnβt be anything stopped us from using Cypress in a containerized read only FS, correct?
Hereβs Angularβs use case: for performance, we are rolling out a remote execution system where a farm of machines can run build/test actions. When a test runs remotely, we copy over the declared inputs, run the test executor, then collect the outputs written to specified locations back to your machine. The remote execution uses a containerized FS where we prevent writes to the project directory, as these would be lost and not copied back to your machine.
I would like to run Cypress on such a remote build/test farm, which requires that we be able to configure the locations where it writes files, and it shouldnβt check for write access in other locations.
I assume that stdout is used for the primary pass/fail UI. Iβd like to configure a directory where those additional files are written.
On Sat, Jul 7, 2018, 11:04 AM Brian Mann notifications@github.com wrote:
@brian-mann Right. Weβre using this in Docker and common practice is to run the app as non-root. This means that weβd have to give the user access to write to the root of the app which is unnecessary since our app already has
cypress.jsonandcypress/. Just giving you more context.That said, seeding the project happens once and probably locally, right? Is this check really necessary?
The code for this is done in cypress-io/cypress#7126, but has yet to be released. Weβll update this issue and reference the changelog when itβs released.
@bahmutov this happens beffore the
(Run Starting)messageWhats the resolution here? Are we getting the FS check removed? (or replaced with a warning)
@brian-mann ty for the tip about the advanced installation. Adding an env var for caching the binary pointed somewhere within the working directory path helped.
For anyone else with a similar error to the one I mentioned, using
CYPRESS_CACHE_FOLDERas referenced in https://on.cypress.io/installing-cypress#Overriding-the-Binary-Cache-Folder might help.@Bhavik-P to get on the same page I think we need to define terms a bit better.
You say:
root access to appsbut this makes no sense to me. Cypress does not require root access - it requires write access to the projectβs root directory. This is simply the folder that containscypress.json. It would be the same folder thatβs created with thegit clonecommand.We only write inside of that project folder. This is the same level of access that any
node_modulewould need when runningnpm install.In fact⦠how does your project ever run
npm install? That needs the same level of write access as Cypress does tonode_modules.Yes. And this is why when the official Docker image set the user to a non-root user, many people were simply unable to work with it because of permission denied errors. See https://github.com/cypress-io/cypress-docker-images/issues/10. The solution then was just to use root and let userβs do whatever they want on their own images.
Just wanted to check with you guys if youβre aware of this use case and the implications of this part of the code to that use case.
That said, I think my work is done. Iβm not sure if I should keep this open or not. π€