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)

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>
This commit is contained in:
Seena Fallah 2022-01-31 08:28:00 +03:30 committed by GitHub
parent 0dd886bac8
commit 929136808f
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