CI_CONCURRENT_PROJECT_ID inconsistent at config stage and other stages in custom executor
Summary
I have a custom executor, with this config.toml:
concurrent = 100
check_interval = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "gitlab-runner"
url = "https://gitlab.com"
token = "my token"
executor = "custom"
[runners.custom]
config_exec = "/home/someuser/gitlab-runner/bin/config.sh"
prepare_exec = "/home/someuser/gitlab-runner/bin/prepare.sh"
run_exec = "/home/someuser/gitlab-runner/bin/run.sh"
cleanup_exec = "/home/someuser/gitlab-runner/bin/cleanup.sh"
My config.sh looks like this:
cat << EOS
{
"builds_dir": "/tmp/gitlab-runner/builds/${CUSTOM_ENV_CI_RUNNER_SHORT_TOKEN}/${CUSTOM_ENV_CI_CONCURRENT_PROJECT_ID}/${CUSTOM_ENV_CI_PROJECT_PATH_SLUG}",
"cache_dir": "/tmp/gitlab-runner/cache/${CUSTOM_ENV_CI_RUNNER_SHORT_TOKEN}/${CUSTOM_ENV_CI_CONCURRENT_PROJECT_ID}/${CUSTOM_ENV_CI_PROJECT_PATH_SLUG}",
"builds_dir_is_shared": false,
"driver": {
"name": "Gitlab runner",
"version": "v0.1.0"
}
}
EOS
This runner runs perfectly fine with v15.8.2, when two jobs are running concurrently. I get exactly the expected behaviour, which is one job has CI_CONCURRENT_PROJECT_ID being 0 throughout all stages and the other job has ID=1 throughout all stages.
However with version v15.9.1 I see a strange behaviour, when two jobs run concurrently:
In the script config.sh
the variable CUSTOM_ENV_CI_CONCURRENT_PROJECT_ID
has in both jobs the value 0, but in all other stages it has in one job the value 0 and in the other job the value 1.
Steps to reproduce
I can consistently reproduce it with v15.9.1. With this setup I will have in the prepare and run stage a shared CI_BUILDS_DIR, which is not what I want.
Expected behavior
I would expect the CI_CONCURRENT_PROJECT_ID to be consistent between config/prepare/run stages, and to be different for concurrent jobs.
Additional
I did only test with v15.8.2 and v15.9.1. Any version in between I did not test.