How to properly disassemble selenium/video to generate evidence in gitlab-ci? #2258
Unanswered
alexandremariano4
asked this question in
Q&A
Replies: 2 comments 7 replies
-
May I know video image tag is used in this setup? |
Beta Was this translation helpful? Give feedback.
6 replies
-
I had a similar issue in (selenium-video:ffmpeg-7.0.1-20240820) resulting in corrupted video. It seems that the problem is really with the shutdown of the video service container. What I did as a workaround was to manually kill the video container inside the script step of my job, after my tests are finished: variables:
FF_NETWORK_PER_BUILD: 1
DISPLAY_CONTAINER_NAME: chrome
SE_FRAME_RATE: 22
SE_VIDEO_RECORD_STANDALONE: true
FILE_NAME: chrome_${CI_COMMIT_REF_SLUG}_${CI_COMMIT_SHORT_SHA}.mp4
VIDEO_FOLDER: /cache/videos
services:
- name: selenium/standalone-chrome:127.0-chromedriver-127.0-20240820
alias: chrome
- name: selenium-video:ffmpeg-7.0.1-20240820_force-recording
alias: chrome_video
artifacts:
paths:
- ${CI_PROJECT_DIR}/${FILE_NAME}
- /builds/sistemas/myproject/target/surefire-reports
when: always
script:
- |
# ...
mvn $MAVEN_CLI_OPTS test || true
# Stops the video container so the .mp4 is finished and writed to the disk
VIDEO_SERVICE_CONTAINER_ID=$(docker ps -f "label=com.gitlab.gitlab-runner.job.id=${CI_JOB_ID}" -f name=selenium-video -q)
docker stop ${VIDEO_SERVICE_CONTAINER_ID} && docker rm ${VIDEO_SERVICE_CONTAINER_ID}
cp -v ${VIDEO_FOLDER}/${FILE_NAME} ${CI_PROJECT_DIR}/${FILE_NAME} It works for now, but the video actually has a long blackscreen at the start, because the container starts to record as soon as it starts. So it's definitlly not a long term solution. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have the following test scenario:
I have a gitlab that is using runner that I have configured on my machine, so the configuration is something simple, it is being done as follows:
And my gitlab-ci.yml file, which is basically my pipelnie, looks like this
Using this way, I'm getting the audio file to be correctly sent to my project folder so that I can use it as evidence and later visualization in case of errors.
However, the file is coming in at 256KB, which basically means that there is no content in this video file. From what I've investigated, I've come to the conclusion that the video container that runs inside Runner wasn't having a "soft drop", I don't know what expression to use for that.
But basically, while on my machine I could use a docker compose file to do "docker compose up -d" and then "docker compose down" which gives the container time to shut down and compile the video correctly, when this scenario goes to gitlab's Runner this no longer happens, as it is shut down abruptly.
In the image below you can see the exact moment when the local container is closed and selenium/video has time to correctly create the .mp4 file
Now, on the other hand, when the selenium/video container that is running in the gitlab runner is shut down, it shuts down dramatically and consequently doesn't mount the video correctly.
Has anyone had this problem and managed to solve it in any way other than "docker:dind"?
Beta Was this translation helpful? Give feedback.
All reactions