Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 - allow maximum timeout to be disabled by passing ``0`` to ``maximum_timeout`` (https://github.com/ansible-collections/community.general/pull/11174).
8 changes: 6 additions & 2 deletions plugins/modules/gitlab_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
maximum_timeout:
description:
- The maximum time that a runner has to complete a specific job.
- Use V(0) to disable the timeout. This is available since community.general 12.1.0.
default: 3600
type: int
run_untagged:
Expand Down Expand Up @@ -365,7 +366,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 +476,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