Skip to content

$CI_BUILDS_DIR does not return builds_dir

Summary

Once the builds_dir has been set to a custom (absolute) path, then $CI_BUILDS_DIR returns only the last part of it. How should I get the current folder? Should I ask for pwd?

Steps to reproduce

  • set builds_dir to a given path e.g. "C:\gitlab-runner\builds"
  • set [runners.custom_build_dir] enabled=true
  • set variables: GIT_CLONE_PATH: $CI_BUILDS_DIR\myProject in gitlab-ci.yml
  • create a job in which you echo $CI_BUILDS_DIR

Actual behavior

$CI_BUILDS_DIR is reported to be 'builds'

Expected behavior

$CI_BUILDS_DIR must be 'C:\gitlab-runner\builds', shouldn't it?

Environment description

Project runner on Windows 10

config.toml contents
concurrent = 1
check_interval = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "obfuscated"
  url = "https://gitlab.com"
  id = obfuscated
  token = "obfuscated"
  token_obtained_at = 2022-10-11T08:16:30Z
  token_expires_at = 0001-01-01T00:00:00Z
  executor = "shell"
  shell = "powershell"
  builds_dir = "C:\gitlab-runner\builds"
  [runners.custom_build_dir]
    enabled = true
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]
    [runners.cache.azure]

Used GitLab Runner version

Version:      15.4.0
Git revision: 43b2dc3d
Git branch:   refs/pipelines/647216591
GO version:   go1.17.9
Built:        2022-09-21T22:15:09+0000
OS/Arch:      windows/amd64