-
-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add new authentication method for GitLab >= 16 #876
Conversation
Signed-off-by: François Bibron <[email protected]>
Signed-off-by: François Bibron <[email protected]>
Signed-off-by: François Bibron <[email protected]>
Support gitlab 16
Hey @Kadeux! 👋 Thank you for your contribution to the project. Please refer to the contribution rules for a quick overview of the process. Make sure that this PR clearly explains:
With submitting this PR you confirm that you hold the rights of the code added and agree that it will published under this LICENSE. The following ChatOps commands are supported:
Simply add a comment with the command in the first line. If you need to pass more information, separate it with a blank line from the command. This message was generated automatically. You are welcome to improve it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for solving this issue, @Kadeux
I have some questions and suggestions which came into my mind. Especially because everyone needs to adjust his config at the moment.
Could you please also update the default example and describe how to configure the new authentication method?
Signed-off-by: François Bibron <[email protected]>
Signed-off-by: François Bibron <[email protected]>
Signed-off-by: François Bibron <[email protected]>
Linter still complains about an unused variable |
Signed-off-by: François Bibron <[email protected]>
Sorry I didn't see it, I still don't know why did I put this variable here :) |
Signed-off-by: François Bibron <[email protected]>
Signed-off-by: François Bibron <[email protected]>
Signed-off-by: François Bibron <[email protected]>
Signed-off-by: François Bibron <[email protected]>
@kayman-mk : Any additional remarks on this change? Do not hesitate to ask for more changes if required. Best regards, |
Environment for testing: Upgraded my runner to this version and verify that jobs are still processed without changing my configuration: success |
Tried to use the new authentication. But it didn't work. runner_gitlab_access_token_secure_parameter_store_name = aws_ssm_parameter.gitlab_runner_registration_token_new.name
runner_gitlab_registration_config = {
# registration_token = var.gitlab_runner_registration_token.value
tag_list = "test"
description = "runner for testing new version (${each.value.availability_zone})"
locked_to_project = "false"
run_untagged = "false"
maximum_timeout = "10800"
type = "group"
group_id = 123
} It still uses the old registration method. The new EDIT: I used the runner before and there was a runner token present, which is handled by the module internally. Thus we have to remove this token in order to upgrade to the new authentication method. ❗ EDIT: EDIT: fetching the token does not work. GitLab returns 401 not authorized. EDIT: It seems that we need a personal access token now to access the |
Regarding the registration process of the runners: The module needs a PAT to access GitLab and register the runner. I think in an enterprise environment we shouldn't give a PAT to our module. I suggest that users register the runner manually and we use the |
Seems that my question is obsolete as there are access tokens on group level available. https://about.gitlab.com/blog/2023/07/06/how-to-automate-creation-of-runners/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice feature you implemented! Appreciated to be able to use the module with GitLab 17+
Signed-off-by: François Bibron <[email protected]>
Looks good. Needs a final test on my side. |
Signed-off-by: François Bibron <[email protected]>
Signed-off-by: François Bibron <[email protected]>
…up`. It doesn't work with `optional(string, "")` as the variable is always filled.
…the correct `if` to avoid unnecessary errors in the logs
Successfully tested the new authentication schema. Had some problems as I added the new variables into the wrong blocks and got no error. Guess this is one of the downsides using maps as variables. |
…the empty string to make sure that the user set something
Tested both scenarios with success. @Kadeux Could you please have a look at my (minor) changes, please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Let's go with the new authentication method. Thanks for your work.
EDIT: Waiting for feedback from @Kadeux I am good to go.
Looks good to me ! Thanks. |
🤖 I have created a release *beep* *boop* --- ## [7.2.0](7.1.1...7.2.0) (2023-11-07) ### Features * add new authentication method for GitLab >= 16 ([#876](#876)) ([c870745](c870745)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Signed-off-by: Niek Palm <[email protected]> Co-authored-by: cattle-ops-releaser-2[bot] <134548870+cattle-ops-releaser-2[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description
GitLab released a new authentication architecture for their runners since the version 16.0.0. This MR handle this new architecture while maintaining backward compatibility.
Migrations required
Highly recommended as the old GitLab Runner registration method will be removed with GitLab 17.
Migration steps:
runner_gitlab.access_token_secure_parameter_store_name
to this SSM parameterrunner_gitlab_registration_config.registration_token
. No longer needed.type =
project or group,
group_id =(for group runners) or
project_id =(for project runners) to the
runner_gitlab_registration_config` section.Verification