Pipeline fails to handle directories containing dots (.)

I’m using a self-managed Gitlab and try to make my first pipeline work with little success. I have a group runner that uses docker.

My pipeline looks like this:

image: mcr.microsoft.com/dotnet/sdk:6.0

  - build

  - ls -l

  stage: build
    - cd $(ls -d *.FileProcessor/)
    - dotnet build $(ls -d *.csproj/)

The ls is there so I can see the files in docker. The output of ls is the following (I include only the main things here):

total 136
drwxrwxrwx  3 root root  4096 Dec 13 21:36 Database
drwxrwxrwx  3 root root  4096 Dec 13 21:36 Libs
drwxrwxrwx  6 root root  4096 Dec 13 21:36 Service.FileProcessor

If I simply try to “cd” into Service.FileProcessor I get the error “/bin/bash: line 144: cd: Service.FileProcessor: No such file or directory” even though the folder is there! So I made an ugly workaround: cd $(ls -d *.FileProcessor/) and it works… The problem is this project references another one which relative path is …/Service.Common/. Since this directory name also contains a dot (.) I get a lot of reference errors during build stating that this project rerefence cannot be resolved. The weird thing is that if I remove the dot from the directory name the thing seems to work. Any explanation or workaround on this issue?

Have you seen what the $(ls -d *.FileProcessor/) is outputting? Could be possible that there is some escape char needed like Service\.FileProcessor/ or you might need to just wrap it in single ticks ( cd ‘Service.FileProcessor’).

$(ls -d *.FileProcessor/) outputs simply Service.FileProcessor/.

You are right if I put it inside single ticks, cd works. But the build still fails stating that

Skipping project "/builds/ProjectName/Service.Common/Service.Common.csproj" because it was not found.

Although the project is there.

So the new script you are trying is like this,

    - cd 'Service.FileProcessor'
    - dotnet build 'Service.Common.csproj'