Skip to content

Forward-port "gitlab: Fix cannot overwrite directory error when symlinking" into 1.18

Nirbheek Chauhan requested to merge nirbheek/gst-ci:fix-overwrite-dir-error into 1.18

Originally commited to the 1.16 branch in !370 (merged)


GitLab doesn't wipe images entirely before reusing them across jobs. It relies on the build scripts to not write outside the workdir. However, we create symlinks outside of the workdir, which breaks in weird ways.

Specifically, when ../../gstreamer/cerbero exists, ln -sf creates ../../gstreamer/cerbero/cerbero, which is wrong, but doesn't cause an error. However, when the image is reused again after this, ../../gstreamer/cerbero/cerbero already exists, so ln -sf yields:

ln: ../../gstreamer/cerbero/cerbero: cannot overwrite directory

This is fixed in master after overhauling the scripts to never write outside of workdir, but for 1.16 we need to hack it by not symlinking if the target dir already exists.


The proper fix will be backported from master, but let's fix this error in the meantime so it doesn't roadblock the 1.18 stable releases

Most recently at https://gitlab.freedesktop.org/tpm/cerbero/-/jobs/5267358

Edited by Nirbheek Chauhan

Merge request reports