I am new with drone, so sorry if questions is dumb.
I try to run selenium in drone. I am using official selenium docker image for chrome standalone. https://hub.docker.com/r/selenium/standalone-chrome/~/dockerfile/
I got error: /bin/sh: 3: cannot create /root/.netrc: Permission denied
From searching I understand I have to change user to match the one in image. Current user in image is seluser. Can I overwrite USER in dron? I searched dron enviorements, but there was no option like that.
What’s the syntax?
Here is my .dron.yml file:
- pip install -r requierements.txt
- python tests.py
Maybe I am trying to do it in stupid way?
Thanks and regards
Actually it seems to be the other way around! I believe Drone is mounting a shared volume at /root/ as “root” user (the .netrc file is used to authenticate with GitHub). But the selenium image can’t mount it because its not started as root.
So if you could configure Selenium to start as “root” it should fix this. You could try creating a new selenium image and overwrite the user.
I remember having a similar issue with the Gradle image, and the solution above fixed it: GitHub - fernandrone/docker-gradle: Docker images with Gradle with root user
We should wait for an official response, but I remember trying to overwrite it without success. Technically docker-compose supports it, but it seems Drone does not support it yet.
But yeah, it’d be pretty cool to do something like this:
Not sure if this is something that could be addressed though (and I’m not completely sure this would solve the problem, which has to do with mounting volumes, would need to test it).
By the way, as a bonus, in one of my pipelines I’m running Selenium as a service, and had no issues:
But then you have to configure your tests to point to a remote selenium server. I’m doing this with a Cucumber based image:
Typically I would expect the Seleneium image to be used as a service like this: https://github.com/drone-demos/drone-go-selenium/blob/master/.drone.yml
The Selenium image needs to start a daemon, and when you use the image in your pipeline section and you specify the
commands section, it overrides the default entrypoint, which means the daemon won’t start. So this is why you want it as a service.