Skip to content

Call askDocker when executor is docker-autoscaler

What does this MR do?

gitlab-runner register Cannot generate [runners.docker] configuration when using docker-autoscaler

Why was this MR needed?

Some customers need to write their own scripts to generate [runners.docker] , because we don't support it.

What's the best way to test this MR?

  1. Prepare a template file
config.template.toml
[[runners]]
  name = "__REDACTED__"
  executor = "docker-autoscaler"

  [runners.cache]
    Type = "s3"
    Path = "gitlab-runner/cache/"
    Shared = true
    MaxUploadedArchiveSize = 0
    [runners.cache.s3]
      BucketName = "__REDACTED__"
      BucketLocation = "__REDACTED__"

  # Docker Executor config
  [runners.docker]
    image = "busybox:latest"

  # Autoscaler config
  [runners.autoscaler]
    plugin = "fleeting-plugin-aws"

    capacity_per_instance = 1
    max_use_count = 1
    max_instances = 10

    [runners.autoscaler.plugin_config]
      name = "my-docker-asg"

    [runners.autoscaler.connector_config]
      username = "ec2-user"

    [[runners.autoscaler.policy]]
      idle_count = 5
      idle_time = "20m0s"

run

sudo gitlab-runner register \
  --template-config 'config.template.toml' \
  --non-interactive \
  --url "$GITLAB_URL" \
  --registration-token "$REGISTRATION_TOKEN" \
  --tag-list "$TAG_LIST" \
  --executor 'docker-autoscaler' \
  --docker-image 'busybox:latest'

then check ~/.gitlab-runner/config.toml

[runners.docker]
    tls_verify = false
    image = "busybox:latest"
    privileged = false
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 0

What are the relevant issue numbers?

Related to: #31096 (closed)

Merge request reports

Loading