CMake and gitlab-runner build directory change between jobs is a no go


CMake and gitlab-runner

When config.toml configuration file has set concurrent = 3 to allow multiple jobs being performed at the same time a problem occurs.
The by the CMake created cmake-build-debug directory is cached between jobs.
GitLab-runner caching means the cmake-build-debug directory is zipped and unzipped between jobs.

But the jobs are not performed in a directory with the same absolute path on which CMake depends and makes the pipeline fail.

So by adding dependencies between jobs and using the template below I resolved the issue.

# Template to mount source root on a fixed directory path for Linux compiler.
    # Bind/Mount the current directory so the path is the same.
    - mkdir -p "${SF_DIR_MOUNT}" && bindfs ./ "${SF_DIR_MOUNT}"
    # Unmount the bind directory.
    - fusermount -u "${SF_DIR_MOUNT}"
    # Remove directory after.
    - rmdir "${SF_DIR_MOUNT}"

I’m new to this GitLab CI/CD thing and I cannot imagine that someone developer at GitLab had a similar problem and already has a built-in solution for it :slight_smile:

Can someone tell me how to solve this in a GitLab decent way?