Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/11174-gitlab-runner-timeout.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- gitlab_runner - Convert ``maximum_timeout`` to ``None`` when set to 0 (https://github.com/ansible-collections/community.general/pull/11174).
9 changes: 6 additions & 3 deletions plugins/modules/gitlab_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
version_added: 6.3.0
maximum_timeout:
description:
- The maximum time that a runner has to complete a specific job.
- The maximum time that a runner has to complete a specific job. Use 0 to set to None.
default: 3600
type: int
run_untagged:
Expand Down Expand Up @@ -365,7 +365,7 @@ def update_runner(self, runner, arguments):
changed = False

for arg_key, arg_value in arguments.items():
if arg_value is not None:
if arg_value is not None or arg_key == "maximum_timeout":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After changing the disable value to 0, I think the change in this line has become redundant, but I have not checked it thoroughly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the value of maximum_timeout is already converted to None at this stage without this check a value of 0 would end up being skipped for updates.

if isinstance(arg_value, list):
list1 = getattr(runner, arg_key)
list1.sort()
Expand Down Expand Up @@ -475,7 +475,10 @@ def main():
run_untagged = module.params["run_untagged"]
runner_locked = module.params["locked"]
access_level = module.params["access_level"]
maximum_timeout = module.params["maximum_timeout"]
if module.params["maximum_timeout"] == 0:
maximum_timeout = None
else:
maximum_timeout = module.params["maximum_timeout"]
registration_token = module.params["registration_token"]
project = module.params["project"]
group = module.params["group"]
Expand Down