-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
gitlab: use gitlab instance runner to create runner #3965
gitlab: use gitlab instance runner to create runner #3965
Conversation
Thanks for your contribution! This is a subset of the changes in #3935 (see https://github.com/ansible-collections/community.general/pull/3935/files#r775046631). I think it's a good idea to have the bugfixes separate from the new feature; @lgatellier what do you think? Also #3935 has some more changes that seem to be bugfixes that aren't in this PR (https://github.com/ansible-collections/community.general/pull/3935/files#r775046714 and a few lines below). I'm wondering whether these bugfixes are due to changes in GitLab's API though, since it did seem to work in the original PR that implemented the old behavior (#2971). CC @drzraf since they probably use this feature. I wonder whether this requires different behvaior depending on the GitLab version. |
Hi, Regarding an eventual Gitlab API evolution, I think it's a wrong use of the API. The |
cb5d5f9
to
24dece9
Compare
This commit is basically reverting 3 out of 5 reference to the "generic" variable ( |
@clwluvw can you please add a changelog fragment? @drzraf would you mind testing this fix with your GitLab instance, to see whether it works with it? Apparently these changes are necessary to make the module work with some other instances. |
24dece9
to
9dfba90
Compare
Done |
The endpoints Example on a self-hosted Gitlab-EE 14.4.4 Premium instance : # Registration attempt on a project as currently done by ansible gitlab_runner module, without this fix
$ curl -s -X POST --form "token=<project_runners_token>" --form "description=test-20220104" --form "locked=false" --form "active=false" --form "run_untagged=true" --form "access_level=not_protected" https://<my_gitlab_instance>/api/v4/projects/<project_id>/runners
{"message":"401 Unauthorized"}
# Registration attempt on a group as it would be done by ansible gitlab_runner module, without this fix
$ curl -s -X POST --form "token=<group_runners_token>" --form "description=test-20220104" --form "locked=false" --form "active=false" --form "run_untagged=true" --form "access_level=not_protected" https://<my_gitlab_instance>/api/v4/groups/<group_id>/runners
{"error":"404 Not Found"}
# The right call for runner registration
$ curl -s -X POST --form "token=<group_runners_token>" --form "description=test-20220104" --form "locked=false" --form "active=false" --form "run_untagged=true" --form "access_level=not_protected" https://<my_gitlab_instance>/api/v4/runners
{"id":<new_runner_id>,"token":"<new_runner_token>"} Which Gitlab version did you use when you added and tested project runner registration feature ? |
changelogs/fragments/3935-use-gitlab-instance-runner-to-create-runner.yml
Outdated
Show resolved
Hide resolved
Thank you for the precision.
Indeed, the endpoint Notes:
|
@drzraf with "the code today", do you mean the code in this PR, or the code in the |
When using project it will use project level runner to create runner that based on python-gitlab it will be used for enabling runner and needs a runner_id so for creating a new runner it should use gitlab level runner Signed-off-by: Seena Fallah <seenafallah@gmail.com>
9dfba90
to
a8898b1
Compare
I think there's something to do regarding projects endpoint and Maybe forcing |
unstale please |
@drzraf @clwluvw what do you think about @lgatellier's comment? |
|
OK, so if you're okay @drzraf @felixfontein, I suggest to validate this PR to fix the bug on project runner registration, and I'll open a new PR to change behavior between Then, I'll rebase & complete PR #3935 to properly add |
With |
Yes, that's what I mean, if @drzraf is okay ! ;-) |
@drzraf would be great if you could look at this tomorrow, since the 4.4.0 release will be on Tuesday (morning), and it would be great if this doesn't have to wait another three weeks :) |
Totally fine with this! |
Backport to stable-3: 💚 backport PR created✅ Backport PR branch: Backported as #4122 🤖 @patchback |
When using project it will use project level runner to create runner that based on python-gitlab it will be used for enabling runner and needs a runner_id so for creating a new runner it should use gitlab level runner Signed-off-by: Seena Fallah <seenafallah@gmail.com> (cherry picked from commit 9291368)
Backport to stable-4: 💚 backport PR created✅ Backport PR branch: Backported as #4123 🤖 @patchback |
@clwluvw thanks for fixing this! |
When using project it will use project level runner to create runner that based on python-gitlab it will be used for enabling runner and needs a runner_id so for creating a new runner it should use gitlab level runner Signed-off-by: Seena Fallah <seenafallah@gmail.com> (cherry picked from commit 9291368)
When using project it will use project level runner to create runner that based on python-gitlab it will be used for enabling runner and needs a runner_id so for creating a new runner it should use gitlab level runner Signed-off-by: Seena Fallah <seenafallah@gmail.com> (cherry picked from commit 9291368) Co-authored-by: Seena Fallah <seenafallah@gmail.com>
When using project it will use project level runner to create runner that based on python-gitlab it will be used for enabling runner and needs a runner_id so for creating a new runner it should use gitlab level runner Signed-off-by: Seena Fallah <seenafallah@gmail.com> (cherry picked from commit 9291368) Co-authored-by: Seena Fallah <seenafallah@gmail.com>
SUMMARY
When using project it will use project level runner to create runner that based on python-gitlab it will be used for enabling runner and needs a runner_id so for creating a new runner it should use gitlab level runner
ISSUE TYPE
COMPONENT NAME
gitlab_runner