From 8751f0feea08b5964b512f247cbd5f12947f0eaa Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Mon, 14 Apr 2025 22:51:12 +0200 Subject: [PATCH] [PR #9960/ab6e18b6 backport][stable-10] gitlab_project: add `build_timeout` option (#9995) gitlab_project: add `build_timeout` option (#9960) * gitlab_project: add `build_timeout` option * gitlab_project: document unspecified build_timeout on creation (cherry picked from commit ab6e18b6cf6f7ffcbdb3c0210428a16de94f5518) Co-authored-by: David Phillips --- .../9960-gitlab_project-add-build_timeout-option.yml | 2 ++ plugins/modules/gitlab_project.py | 10 ++++++++++ 2 files changed, 12 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..eec2b0fa7a 100644 --- a/plugins/modules/gitlab_project.py +++ b/plugins/modules/gitlab_project.py @@ -44,6 +44,12 @@ 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. + - If not specified on creation, GitLab will impose a default value. + 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 +436,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 +598,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 +672,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 +757,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,