Videos
There isn't an easy way to do what you want, from what I can find in the GitLab documentation and some open issues that they have.
Here is an issue that describes something similar to what you want:
https://gitlab.com/gitlab-org/gitlab-runner/issues/3540
Here is what I think is GitLab's goal with how to register runners:
https://gitlab.com/gitlab-org/gitlab-ce/issues/40693
I believe that the only thing that you can't change from the .toml file is the name of the runner, and maybe not the tags either. Then name is only created when you register the runner. I read something somewhere that you can change the tags of a shared runner, but I can't find it now.
Here is a workaround to make the process of registering a bit more automatic:
https://gitlab.com/gitlab-org/gitlab-runner/issues/3553#note_108527430
He used this API:
curl --request POST "https://gitlab.com/api/v4/runners" --form "token=<registration-token>" --form "description=test-1-20150125-test" --form "tag_list=ruby,mysql,tag1,tag2"
Then he got the following response back:
{"id":401513,"token":"<runner-token>"}
He could then inject the runner-token into his already pre-made .toml file.
For you, it would have been possible to use the registration token for your group, and then to write in the description/name of the runner and the tags. You could then have re-used your config.toml and only changed the runner-token, and it should have worked.
A gitlab runner can be registered with multiple projects and/or groups. This will just append the configurations in /etc/gitlab-runner/config.toml (with sudo). Can we just do the following steps:
- Un-register the gitlab-runner associated with the "project"
- Register the the gitlab-runner associated with the "group"
config.toml stores all the configuration which is passed to gitlab-runner register including any environment variables which are listed under gitlab-runner register -h command.
I am not sure why do you need to save the config.toml.
Also, I believe one source of confusion could be gitlab-runner-token VS gitlab-runner-registration-token. The registration-token can NOT be used inside config.toml which may be the reason why you failed after just a replacement. If you do not want to use gitlab-runner register command and just update the config.toml then follow the steps defined in the above ans to fetch the gitlab-runner-token and use it in config.toml. We can then try and stop and start the gitlab-runner service using sudo service gitlab-runner stop and sudo service gitlab-runner start