Gitlab-runner register with --*-args not properly handled?

the gitlab-runner register command do all we need without writing config files. But when I see Autoscaling GitLab CI on AWS Fargate | GitLab the file is created by hand. Because I use different runner, I would like to register multiple one. But it seems impossible to pass several argument to gitlab-runner

here is an example (/usr/share/gitlab-runner/runner_template.toml is common to all my runner)

  gitlab-runner register \
    --template-config /usr/share/gitlab-runner/runner_template.toml \
    --name "XXX" \
    --non-interactive \
    --url "<some url>" \
    --registration-token "<my registration token>" \
    --builds-dir /opt/gitlab-runner/builds/XXX/ \
    --cache-dir /opt/gitlab-runner/cache/XXX/ \
    --run-untagged="true" \
    --locked="true" \
    --executor "custom" \
    --custom-config-exec /usr/local/bin/gitlab-runner-fargate \
    --custom-config-args --config /etc/gitlab-runner/driver_fargate.toml custom config \
    --custom-prepare-exec /usr/local/bin/gitlab-runner-fargate \
    --custom-prepare-args --config /etc/gitlab-runner/driver_fargate.toml custom prepare \
    --custom-run-exec /usr/local/bin/gitlab-runner-fargate \
    --custom-run-args --config /etc/gitlab-runner/driver_fargate.toml custom run \
    --custom-cleanup-exec /usr/local/bin/gitlab-runner-fargate \
    --custom-cleanup-args --config /etc/gitlab-runner/driver_fargate.toml custom cleanup

I try to add bracket, quote, … it never succeed to create the file with the proper parameters

  1. Is it required to create multiple template to handle several parameters? Is it a bug? Did I miss something?

  2. Except directly using the api of gitlab (and then create the config file ourselve), is there another way to have the register token?


for information, temporary, I solve this issue with multiple template.