Skip to content

ci_builds_dir & runners.custom_build_dir not working

Summary

I would like define builds_dirfor my shell executor.

Steps to reproduce

/etc/gitlab-runner/config.toml

[[runners]]
  name = "runner_name"
  url = "https://www"
  executor = "shell"
  builds_dir = /darskpace/gitlab-runner/builds
  [runners.custom_build_dir]
    enable = true
.gitlab-ci.yml

export-variables-display:
  stage: test
  script:
    - export
  tags:
    - shell

Actual behavior

$ export
...
declare -x CI_BUILDS_DIR="/home/gitlab-runner/builds"
declare -x CI_PROJECT_DIR="/home/gitlab-runner/builds/t1_9oyyF1/0/hats-for-cats/web"
declare -x CI_SERVER_TLS_CA_FILE="/home/gitlab-runner/builds/t1_9oyyF1/0/hats-for-cats/web.tmp/CI_SERVER_TLS_CA_FILE"
declare -x GITLAB_ENV="/home/gitlab-runner/builds/t1_9oyyF1/0/hats-for-cats/web.tmp/gitlab_runner_env"
...

Expected behavior

declare -x CI_BUILDS_DIR="/darskpace/gitlab-runner/builds"
declare -x CI_PROJECT_DIR="/darskpace/gitlab-runner/builds/t1_9oyyF1/0/hats-for-cats/web"
declare -x CI_SERVER_TLS_CA_FILE="/darskpace/gitlab-runner/builds/t1_9oyyF1/0/hats-for-cats/web.tmp/CI_SERVER_TLS_CA_FILE"
declare -x GITLAB_ENV="/darskpace/gitlab-runner/builds/t1_9oyyF1/0/hats-for-cats/web.tmp/gitlab_runner_env"

Relevant logs and/or screenshots

job log
Add the job log

Environment description

config.toml contents
concurrent = 1
check_interval = 0
connection_max_age = "15m0s"
shutdown_timeout = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "runner_name"
  url = "https://www"
  executor = "shell"
  builds_dir = /darkspace/gitlab-runner/builds
  [runners.custom_build_dir]
    enable = true
  [runners.cache]
    MaxUploadedArchiveSize = 0
    [runners.cache.s3]
    [runners.cache.gcs]
    [runners.cache.azure]

Used GitLab Runner version

gitlab-runner --version
Version:      17.8.3
Git revision: 690ce25c
Git branch:   17-8-stable
GO version:   go1.23.2 X:cacheprog
Built:        unknown
OS/Arch:      linux/amd64

Possible fixes

Edited by mikl_solo