Config-map Environment field is not used during configuration

Summary

It seems that adding environment variable in config.toml file using config-map doesn't affect /home/gitlab-runner/.gitlab-runner/config.toml file correctly.

Steps to reproduce

  1. Change runner-gitlab-runner ConfigMap to something like this:
check_interval = 3
log_level = "info"
listen_address = '[::]:9252'
    [[runners]]
      name = 'uncapped-ci-cd'
      environment = ["DOCKER_TLS_CERTDIR=","DOCKER_HOST=tcp://localhost:2375"]
      executor = "kubernetes"      
      [runners.kubernetes]
       privileged = true
  1. Restart your pod of gitlab-runner
  2. Once you login in to POD in your /home/gitlab-runner/.gitlab-runner/config.toml you will something similar:
listen_address = "[::]:9252"
concurrent = 4
check_interval = 3
log_level = "info"

[session_server]
  session_timeout = 1800

[[runners]]
  name = "ci-cd"
  url = ""
  token = ""
  executor = "kubernetes"
  environment = ["DOCKER_TLS_CERTDIR=", "DOCKER_HOST=tcp://localhost:2375"]
  [runners.kubernetes]
    host = ""
    bearer_token_overwrite_allowed = false
    image = ""
    namespace = ""
    namespace_overwrite_allowed = ""
    privileged = true
    service_account_overwrite_allowed = ""
    pod_annotations_overwrite_allowed = ""
    [runners.kubernetes.pod_security_context]
    [runners.kubernetes.volumes]

[[runners]]
  name = "runner-gitlab-runner-fbdc845fb-grxch"
  request_concurrency = 1
  url = "https://gitlab.com/"
  token = "S4xxx4VEgsyUqRopSvRd"
  executor = "kubernetes"
  [runners.custom_build_dir]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]
  [runners.kubernetes]
    host = ""
    bearer_token_overwrite_allowed = false
    image = "ubuntu:16.04"
    namespace = "gitlab-managed-apps"
    namespace_overwrite_allowed = ""
    privileged = true
    service_account_overwrite_allowed = ""
    pod_annotations_overwrite_allowed = ""
    [runners.kubernetes.pod_security_context]
    [runners.kubernetes.volumes]

Expected behavior

Changing config-map changes only part of configuration which is not merged properly. Changing Config-map should reflect changes in gitlab-runner configuration file where you should see only single configuration

Environment description

The whole installation of the runner was done from UI of gitlab.com. We using single group runner.

Used GitLab Runner version

runner-gitlab-runner: gitlab/gitlab-runner:alpine-v12.3.0

Possible fixes

No idea what we can do right now.

Edited by Steve Xuereb