Save artifacts from service image

I have a custom-made docker image for GitLab CI services that runs an X server and saves the entire session to a video file. The idea is simply to aid in debugging a flaky CI process that requires X. I’m trying to find a nice way to get the resulting video file from the service container into the job’s artifacts. Documentation about services doesn’t seem to cover this aspect; does anyone know of a way to pull it off?

Thanks for your help!

I figured it out. The documentation mentions:

Shared /builds directory

Services can access files from the build because all services have the job directory mounted as a volume under /builds.

It calls them “shared” and says all services have them, but it wasn’t really clear what this was. Turns out it’s shared with the job as well. I can put the video in there and the job can save it as an artifact, as long as the service waits for the job to actually check the project out there (do it too soon and the checkout process wipes it). Good enough!

I’ve proposed an update to the docs to be a little more clear about this.

1 Like

Amazing work, @kyrofa! In particular, thank you for the docs update MR. :bowing_man:

1 Like