-
Notifications
You must be signed in to change notification settings - Fork 384
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
cypress docker image root user misconfiguration #914
Comments
There are Jenkins examples listed in the table: cypress-io/cypress-example-kitchensink > CI Workflow Examples The Jenkins examples use cypress/base Docker images. Which type of Docker images were you having problems with ( If you were not using cypress/base perhaps you would like to try that out. |
Closing due to inactivity. |
@MikeMcC399 sorry, I've totally missed your previous question. We were actually using |
Thanks for your feedback and I have re-opened your issue. |
The Cypress binary installs in
The Cypress npm module installs in cypress-docker-images/factory/factory.Dockerfile Lines 111 to 113 in 55c80b6
|
Are you still experiencing problems running a custom-built Cypress Docker image with a non-root user? If yes, could you please provide more details, as some related issues are currently being addressed and I would like to know if there are any additional problems which are not yet dealt with. |
I don't remember the exact issues we have encountered previously as we don't use cypress anymore, but I tried a simple factory image test just now and this is what I've got.
Steps to reproduce
Jenkins is configured to run under non-root user, as most CI servers are. As far as I remember we have encountered similar issues with To correctly solve all the issues I've seen throughout the years I think: |
Thank you for your response and error log! Your error log is:
The log suggests that the custom Cypress Docker image is being run under user:group Following the cypress/factory > Usage instructions generates a custom Cypress Docker image with the only non-root user being There should be ways to set this up so it works correctly. Before proceeding, I would like to understand your environment. Could you please say which environment you are running Jenkins under?
There may be some changes which should be added to the There are already some special instructions for GitHub Actions and GitLab, so it would not be surprising if there is some need to add instructions for Jenkins. I understand if you say that you are no longer using Cypress anymore that you may not want to work on this. Please just let us know either way. |
In theory, under Linux, you don't need home directory or entry in /etc/passwd if you are not logging in the user. You can run Docker image under any ID. This is why such images as eclipse-temurin, or nginx works under Jenkins/GitHub Actions without modifications. NPM cache folder can be preset to /tmp/.cache or any other global folder in advance via
Rocky Linux 9.5
I understand that all these issues have workarounds, but then again, they are workarounds :). That's not the point why I have created this issue. IMHO, ideally cypress image should be runnable without modifications. I saw instructions for GitHub Actions, but to tell you the truth cypress image is the only image I have encountered which requires these instruction. I also glanced a bit at the current Dockerfile for images. If cypress is not installed into /root I think you could loose a lot of chmod hacks which are currently lingering in some places. Not to name a much cleaner documentation.
That's fine, I can spare some time :) I have also remembered that we tried to make custom image without installing cypress into it. This way we tried to achieve one custom image usable by multiple projects, which used different cypress versions (via package.json). We then encountered another set of issues regarding permissions and the same /root folder. |
Thank you for your details, your suggestions and your insights! I will link any PRs that I propose back to this issue. |
The following documentation updates have been added to cover workarounds arising from non-root node usage: README Known problems section
I was not able to test these in a Jenkins Docker agent environment so far. |
We tried to run cypress docker image under Jenkins which runs all docker images with non-root account. Unfortunately, this is not possible without hack and modifications in the image itself.
I've investigated this a bit and it seems that the source of this issue is that cypress is installed under /root folder by default. This is misconfiguration because /root folder is not designed to host global libraries or software. It translated then to all sorts of problems, like libraries not resolving, difficulties to run images under SaaS CI providers, etc.
My proposal is to have cypress installed into /usr/local or whatever is provided by default npm configuration under used OS.
The text was updated successfully, but these errors were encountered: