Open sandorzelei opened 3 years ago
@sandorzelei I don't think it is possible now. However you can use /video/
API to download the files.
@vania-pooh thanks for the quick response. I changed my code to download the videos from the API, I also added the volume to the selenoid configuration.
My plan is to let selenoid container keep video files inside the container, because if I use any volume jenkins would not be able to remove these files.
version: '3'
services:
selenoid:
network_mode: bridge
image: aerokube/selenoid:latest-release
volumes:
- "${SELENOID_CONFIG}:/etc/selenoid"
- "videos:/opt/selenoid/video"
- "/var/run/docker.sock:/var/run/docker.sock"
command: ["-limit", "${SELENOID_LIMIT:-1}", "-conf", "/etc/selenoid/browsers.json", "-video-output-dir", "/opt/selenoid/video"]
ports:
- "4444:4444"
volumes:
videos:
I have this error:
[VIDEO_ERROR] [Failed to rename /opt/selenoid/video/selenoid1f30675253d63cd51461ad06ce4d1634.mp4 to /opt/selenoid/video/d2766b3dac475c05f11dbcc878a30b00.mp4: rename /opt/selenoid/video/selenoid1f30675253d63cd51461ad06ce4d1634.mp4 /opt/selenoid/video/d2766b3dac475c05f11dbcc878a30b00.mp4: no such file or directory]
Any idea what should I change in my configuration?
@sandorzelei you have to set OVERRIDE_VIDEO_OUTPUT_DIR
variable as is clearly stated in the documentation. https://aerokube.com/selenoid/latest/#_option_1_running_selenoid_in_default_docker_network
@vania-pooh Yes, and I tried to set it, it did not solved the issue.
2021/02/25 13:15:58 [1] [VIDEO_ERROR] [Failed to rename /opt/selenoid/video/selenoid38bd92d697f5cbfd34f3edf5c9125b82.mp4 to /opt/selenoid/video/24846614a09cf93322ee6fcc8a22fc4c.mp4: rename /opt/selenoid/video/selenoid38bd92d697f5cbfd34f3edf5c9125b82.mp4 /opt/selenoid/video/24846614a09cf93322ee6fcc8a22fc4c.mp4: no such file or directory]
It also said
You are passing an OVERRIDE_VIDEO_OUTPUT_DIR environment variable pointing to a directory on the host machine where video files are actually stored
But in my case, I do not map the directory to the host but keep in a unnamed volume.
I tried this config
- OVERRIDE_VIDEO_OUTPUT_DIR=/opt/selenoid/video
@vania-pooh I found a workaround that works for me, although if the selenoid container could save the video on a volume instead of the host, the all would be much cleaner. Might worth changing the root user to something else.
Thanks for the quick responses and keep up the good work.
@sandorzelei I also faced the issue, with video files created by root. How I managed to work around it was to add to my CI/CD agent(Jenkins in your case) a small script that creates the folders where the video will be stored and then point the docker-compose to it. For example:
mkdir src/test/resources/selenoid/video
mkdir src/test/resources/selenoid/logs
And then in your docker compose go for :
volumes:
- "$PWD:/etc/selenoid/"
- "/var/run/docker.sock:/var/run/docker.sock"
- "$PWD/src/test/resources/selenoid/video:/opt/selenoid/video"
- "$PWD/src/test/resources/selenoid/logs:/opt/selenoid/logs"
environment:
- OVERRIDE_VIDEO_OUTPUT_DIR=$PWD/src/test/resources/selenoid/video
- TZ=Europe/Berlin
command: [ "-conf", "/etc/selenoid/browsers.json", "-video-output-dir", "/opt/selenoid/video"
In this way regardless if your video files are created by root, as long as the parent folder is owned by jenkins it should be able to delete it at the end if you wish to do so.
Hope this helps.
Hi @VickoValch, thank you for sharing it, I used the API to download (and remove) the video files into my jenkins workspace, OVERRIDE_VIDEO_OUTPUT_DIR was set to the tmp directory of the host.
It would be quite nice to have a possibility to specify volume for "docker run video-recorder…" command, which hidden inside. Or pass any args at all. Or at least, run this container with --volumes-from=selenoid.
Hi,
I added the video recorder to my docker setup on jenkins, it works, but all files are created by root user. My jenkins jobs are running with a 'jenkins' user. Unfortunately jenkins user is not able to remove these video files after they were archived.
I tried to define the user for the video recorder and selenoid:latest-release as well, but no luck.
How can I change the owner of the video files?