CI_PROJECT_DIR what is the '0' value in the path?

I need to access files from build directory of another project, so I decided to build its build path dynamically. I’ve found out that CI_PROJECT_DIR is built by concatenating CI_BUILDS_DIR and CI_RUNNER_SHORT_TOKEN. Next in the path there is ‘0’ value but I don’t know where does this value come from.
CI_PROJECT_DIR = D:\GitLab-Runner\builds\4pTLQv-G\0\MyGroup\MyProject
CI_BUILDS_DIR = D:\GitLab-Runner\builds
CI_PROJECT_PATH = MyGroup\MyProject

I’ll be very thankful for any help.

I don’t have a finite answer on where the 0 comes from.

However, this seems like a bad practice. You are putting a reliance on CI variables as well as the specific version of the gitlab-runner. It’s possible that an updated gitlab-runner will completely change how the file structure gets created, and you are trying to rely on a build directory that may or may not exist at the time of your pipeline.

What exactly is it that you need from the build path from another pipeline? Could you not upload the artifacts in the CI job (using the gitlab-ci artifacts field) and retrieve them from your other project? Could you create a deploy key that is stored in your CI/CD variables for both projects and the first project commits and pushes changes to a separate “artifacts repo” project and then the second project just clones or downloads specific files from the artifacts project?

The best thing to do would be to have an object storage server to upload your artifacts to which can then be pulled from your other project.

you’re right @tmos22 that simple things should be made as simple as possible. I’m using “artifacts” now. Thank you.

1 Like

I’ve discovered that “0” in the project build directory is one of the “CI_CONCURRENT_ID” and “CI_CONCURRENT_PROJECT_ID”.

1 Like

Glad I could help. And nice to know where that variable is coming from.