Skip to content

Commit

Permalink
gitlab: use gitlab instance runner to create runner (#3965)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
clwluvw authored Jan 31, 2022
1 parent 0dd886b commit 9291368
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -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).'
6 changes: 3 additions & 3 deletions plugins/modules/source_control/gitlab/gitlab_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def create_runner(self, arguments):
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))

Expand Down Expand Up @@ -292,10 +292,10 @@ def find_runner(self, description, owned=False):
# 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
Expand Down

0 comments on commit 9291368

Please sign in to comment.