1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

gitlab: use gitlab instance runner to create runner (#3965) (#4123)

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 929136808f)

Co-authored-by: Seena Fallah <seenafallah@gmail.com>
This commit is contained in:
patchback[bot] 2022-01-31 06:20:30 +01:00 committed by GitHub
parent 379b6d3523
commit 2554b4b0f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- 'gitlab_runner - use correct API endpoint to create and retrieve project level runners when using ``project`` (https://github.com/ansible-collections/community.general/pull/3965).'

View file

@ -248,7 +248,7 @@ class GitLabRunner(object):
return True
try:
runner = self._runners_endpoint.create(arguments)
runner = self._gitlab.runners.create(arguments)
except (gitlab.exceptions.GitlabCreateError) as e:
self._module.fail_json(msg="Failed to create runner: %s " % to_native(e))
@ -292,10 +292,10 @@ class GitLabRunner(object):
# object, so we need to handle both
if hasattr(runner, "description"):
if (runner.description == description):
return self._runners_endpoint.get(runner.id)
return self._gitlab.runners.get(runner.id)
else:
if (runner['description'] == description):
return self._runners_endpoint.get(runner['id'])
return self._gitlab.runners.get(runner['id'])
'''
@param description Description of the runner