I'm using a gitlab runner to deploy application
-shared gitlab runner and concurrent count is 4
/etc/gitlab-runner/config.toml
concurrent = 4
check_interval = 0
executor = shell
All jobs run in a different stage each other.
.gitlab-ci.yml
stages:
- build-prod-stage
- deploy-prod-stage
BUILD_PROD_JOB:
stage: build-prod-stage
variables:
GIT_CLEAN_FLAGS: none
script:
- xxxxxx
- xxxxx
DEPLOY_PROD_JOB:
variables:
GIT_CLEAN_FLAGS: none
stage: deploy-prod-stage
script:
- xxxxxx
- xxxxxx*
Mostly, BUILD_PROD_JOB and DEPLOY_PROD_JOB run in a same build directory.
But, sometimes they use a different directory each other
gitlab-runner log
BUILD_PROD_JOB
Fetching changes with git depth set to 50...
Initialized empty Git repository in /xxxx/gitlab-runner/builds/(gitlab-runner name)/1/(respository name)/.git/
.....
DEPLOY_PROD_JOB
Fetching changes with git depth set to 50...
Initialized empty Git repository in /xxxx/gitlab-runner/builds/(gitlab-runner name)/0/(respository name)/.git/
....
I guessed why this things happen.
- BUILD_PROD_JOB started to run while other job is running. so, CI_CONCURRENT_ID is 1
- DEPLOY_PROD_JOB started to run after other jobs is completed, so CI_CONCURRENT_ID is 0
In this case, can I force "DEPLO_PROD_JOB" runs in same build_dir of "BUILD_PROD_JOB"?
- BUILD_PRODJOB --> /xxxx/gitlab-runner/builds/(gitlab-runner name)/1/(respository name)/.git/
- DEPLOY_PRODJOB --> /xxxx/gitlab-runner/builds/(gitlab-runner name)/1/(respository name)/.git/