custom_build_dir is not enabled by default
Summary
On https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runnerscustom_build_dir-section it says:
Please notice, that the feature - if not configured explicitly - will be enabled by default for kubernetes, docker, docker-ssh, docker+machine and docker-ssh+machine executors. It will be disabled by default for all other executors.
However, when I try using GIT_CLONE_PATH on my Kubernetes runner I get an error message.
What's worse, there doesn't seem to be a way to set custom_build_dir
via the Helm chart.
Steps to reproduce
.gitlab-ci.yml
binaries:
stage: build
image: golang:alpine
variables:
GOPATH: $CI_BUILDS_DIR/go
GIT_CLONE_PATH: $GOPATH/src/gitlab.com/$CI_PROJECT_PATH
script:
- echo whatever
Actual behavior
ERROR: Job failed: setting GIT_CLONE_PATH is not allowed, enable `custom_build_dir` feature
Expected behavior
Job runs normally.
Relevant logs and/or screenshots
job log
Running with gitlab-runner 11.10.0 (3001a600)
on [...]
ERROR: Job failed: setting GIT_CLONE_PATH is not allowed, enable `custom_build_dir` feature
Environment description
GitLab runner is deployed on Kubernetes using the Helm chart.
values.yml
gitlabUrl: [...]
runnerRegistrationToken: "[...]"
runners:
image: alpine:latest
imagePullPolicy: always
rbac:
create: true
checkInterval: 3
Resultant config.toml from within the pod:
config.toml contents
listen_address = "[::]:9252"
concurrent = 10
check_interval = 3
log_level = "info"
[session_server]
session_timeout = 1800
[[runners]]
name = "[...]"
url = "[...]"
token = "[...]"
executor = "kubernetes"
[runners.custom_build_dir]
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
[runners.kubernetes]
host = ""
bearer_token_overwrite_allowed = false
image = "alpine:latest"
namespace = "gitlab-runner"
namespace_overwrite_allowed = ""
privileged = false
pull_policy = "always"
service_account_overwrite_allowed = ""
pod_annotations_overwrite_allowed = ""
[runners.kubernetes.volumes]
Used GitLab Runner version
Version: 11.10.0
Git revision: 3001a600
Git branch: 11-10-stable
GO version: go1.8.7
Built: 2019-04-19T09:48:55+0000
OS/Arch: linux/amd64
Possible solutions
The reason for this is because in here we are checking if it's nil or not, if it's nil we fallback to the default configuration. But the issue here is that it's never nil for new runners since we automatically create [runners.custom_build_dir]
as part of the configuration, so it ends up being false
by default.
So we need to figure out the following:
- Do we want to stick true to the documentation, and have it enabled by default? (I think this is the best option) To do so we need to have to nullify the value explicitly on register to make sure it's set correctly by the default value.
- We update the documentation specifying that it's disabled by default.