From 6a020dc328f7cf2e4ef63983cc1d95926923106a Mon Sep 17 00:00:00 2001 From: David Phillips Date: Thu, 3 Apr 2025 08:37:24 +1300 Subject: [PATCH] gitlab_project: add `build_timeout` option --- .../9960-gitlab_project-add-build_timeout-option.yml | 2 ++ plugins/modules/gitlab_project.py | 9 +++++++++ 2 files changed, 11 insertions(+) create mode 100644 changelogs/fragments/9960-gitlab_project-add-build_timeout-option.yml diff --git a/changelogs/fragments/9960-gitlab_project-add-build_timeout-option.yml b/changelogs/fragments/9960-gitlab_project-add-build_timeout-option.yml new file mode 100644 index 0000000000..4178484509 --- /dev/null +++ b/changelogs/fragments/9960-gitlab_project-add-build_timeout-option.yml @@ -0,0 +1,2 @@ +minor_changes: + - gitlab_project - add option ``build_timeout`` (https://github.com/ansible-collections/community.general/pull/9960). diff --git a/plugins/modules/gitlab_project.py b/plugins/modules/gitlab_project.py index 8ef73de1fd..9605856d21 100644 --- a/plugins/modules/gitlab_project.py +++ b/plugins/modules/gitlab_project.py @@ -44,6 +44,11 @@ options: - This option is only used on creation, not for updates. type: path version_added: "4.2.0" + build_timeout: + description: + - Maximum number of seconds a CI job can run. + type: int + version_added: "10.6.0" builds_access_level: description: - V(private) means that repository CI/CD is allowed only to project members. @@ -430,6 +435,7 @@ class GitLabProject(object): project_options = { 'allow_merge_on_skipped_pipeline': options['allow_merge_on_skipped_pipeline'], 'builds_access_level': options['builds_access_level'], + 'build_timeout': options['build_timeout'], 'ci_config_path': options['ci_config_path'], 'container_expiration_policy': options['container_expiration_policy'], 'container_registry_access_level': options['container_registry_access_level'], @@ -591,6 +597,7 @@ def main(): allow_merge_on_skipped_pipeline=dict(type='bool'), avatar_path=dict(type='path'), builds_access_level=dict(type='str', choices=['private', 'disabled', 'enabled']), + build_timeout=dict(type='int'), ci_config_path=dict(type='str'), container_expiration_policy=dict(type='dict', default=None, options=dict( cadence=dict(type='str', choices=["1d", "7d", "14d", "1month", "3month"]), @@ -664,6 +671,7 @@ def main(): allow_merge_on_skipped_pipeline = module.params['allow_merge_on_skipped_pipeline'] avatar_path = module.params['avatar_path'] builds_access_level = module.params['builds_access_level'] + build_timeout = module.params['build_timeout'] ci_config_path = module.params['ci_config_path'] container_expiration_policy = module.params['container_expiration_policy'] container_registry_access_level = module.params['container_registry_access_level'] @@ -748,6 +756,7 @@ def main(): "allow_merge_on_skipped_pipeline": allow_merge_on_skipped_pipeline, "avatar_path": avatar_path, "builds_access_level": builds_access_level, + "build_timeout": build_timeout, "ci_config_path": ci_config_path, "container_expiration_policy": container_expiration_policy, "container_registry_access_level": container_registry_access_level,