-
Notifications
You must be signed in to change notification settings - Fork 382
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
Firefox doesn't run on GitLab (as root) #1220
Comments
Possibly you are running into the problem Firefox not found.
|
BTW
|
@MikeMcC399 gitlab ci's on a custom runner, it's just a docker image built on top of the original one with some stuff added, I didn't explicitly specify a user for the runner though, so that could be it maybe |
If you add firefox --version into your GitLab workflow, you should get a usable error message if you are running the container under the (default) This is the message for GitHub. Check which
|
Thanks for the suggestion, after running the command in gitlab-ci and changing the user to the one spewed out it seems like the browser wants to launch, but gets confused as to where it's HOME is, since now I get For the time being I'll probably drop firefox testing and maybe look into fixing it by just bruteforcing firefox to be able to be ran as a root user, since that creates less issues overall, and it's only in an image so it basically doesn't matter. Additionally I kind of have to run cypress as root in that scenario because of some cursed things we have to do to prepare our full test suite. At this time I need docker to run commands, though I might look into allowing things to run through a http api instead, which would eliminate the need to even modify the image in the first place. |
Thanks for your progress report and I'm sorry to hear you weren't able to get this to work so far. Could you please change the title of your post, for example "Firefox doesn't run on GitLab"? The current title is misleading for anybody with the same issue. |
There is a simple working example of running Firefox in GitLab CI on the Cypress documentation site using a Cypress Docker image Testing with Cypress Docker Images as stages:
- test
test:
image: cypress/browsers:node-20.14.0-chrome-126.0.6478.114-1-ff-127.0.1-edge-126.0.2592.61-1
stage: test
script:
# install dependencies
- npm ci
# start the server in the background
- npm start &
# run Cypress tests
- npx cypress run --browser firefox |
Thanks, but as mentioned already my setup requires me to start about 20 different services and then have access to docker to run some commands on them (from inside cypress), because of which cypress itself must contain docker (as a separate image), and it needs access to docker (so root), so that example does nothing for me. |
We would need a reproducible failing example in order to investigate this issue further. I successfully ran the following simple pipeline on GitLab, testing against Firefox. This runs by default as stages:
- test
test:
image:
name: cypress/included:13.15.0
entrypoint: [""]
stage: test
script:
- npx cypress verify
- npx cypress cache list
- id
- firefox --version
- npx cypress run --browser firefox
|
I'll drop in the full docker file tomorrow |
That's it really. And yes, I need docker access inside of cypress (for exec), I know it's not great but for the time being it's required. Additionally my entrypoint in gitlab is |
Would you like to try using
I built a Docker image using your docker build . -t firefox-test
docker run -it --rm -v .:/app -w /app --entrypoint cypress firefox-test run --browser firefox So this did not point to any issue with the image itself. Note that |
I could use I updated the entrypoint to [""], and, well, it seems something changed?
I'm so confused. It seems like now it works but can't find something, but I have an idea why that might be the case. I wish I could read, I would spare both of us some time. |
It appears that there is something wrong in the way that you are running the image if you are getting "Permission denied"
The
|
I don't know quite what you mean here. #1220 (comment) gave an example of how to use |
Not quite. The reason was that for caching purposes (composer/npm) I long ago set up a volume in the runner we use to point to the home directory of the CI server instead of the image. So /root in the image would be my /home/gitlab-runner. So any files in the images would be lost. I've updated that mount point to no longer point to /root, instead mount only .ssh and other such folders. Firefox now starts. Regardless of the image I'd use I'd need to add docker on top of it. This way I can install the dependencies we use in the image itself instead of installing them every time the job runs. And yeah, sure, you can cache them, but it's still slower. It doesn't really matter that much though. In hindsight it was silly to not look more in the configuration of the runner itself, thank you for the help. |
What I find confusing is that chromium based browsers don't even care that /root is mounted over. Like nothing happened. Maybe add a note to the firefox section suggesting that the /root path is mounted over? Anyway, again thanks a lot. |
You're welcome! I don't believe there is any specific warning in the documentation about the |
Hello, I've build an image adding docker stuff on top of
cypress/included:cypress-13.15.0-node-20.17.0-chrome-129.0.6668.70-1-ff-130.0.1-edge-129.0.2792.52-1
, but when I run it in CI it complains that firefox is not installed?I'm not sure what happened along the way to make firefox no longer available in CI.
Sorry if this is my error, but I'm confused how could I remove an entire browser by simply installing docker and running
npm install -g typescript ts-node
in said image.The text was updated successfully, but these errors were encountered: