From 1dd697bdc26487568e8923eb2531e32cfa46d287 Mon Sep 17 00:00:00 2001 From: Zoran Krleza Date: Sun, 18 Feb 2024 18:13:47 +0100 Subject: [PATCH] Adding releases events option to gitlab_hook module (#7956) * Adding releases events option to gitlab_hook module * Fixing typo in documentation for gitlab_hook module * No default value for releases_events * Adding changelog fragment --- ...g-releases_events-option-to-gitlab_hook-module.yaml | 2 ++ plugins/modules/gitlab_hook.py | 10 ++++++++++ 2 files changed, 12 insertions(+) create mode 100644 changelogs/fragments/7956-adding-releases_events-option-to-gitlab_hook-module.yaml diff --git a/changelogs/fragments/7956-adding-releases_events-option-to-gitlab_hook-module.yaml b/changelogs/fragments/7956-adding-releases_events-option-to-gitlab_hook-module.yaml new file mode 100644 index 0000000000..30186804d4 --- /dev/null +++ b/changelogs/fragments/7956-adding-releases_events-option-to-gitlab_hook-module.yaml @@ -0,0 +1,2 @@ +minor_changes: + - gitlab_hook - adds ``releases_events`` parameter for supporting Releases events triggers on GitLab hooks (https://github.com/ansible-collections/community.general/pull/7956). \ No newline at end of file diff --git a/plugins/modules/gitlab_hook.py b/plugins/modules/gitlab_hook.py index ec39d0e0c7..6c2230bbc7 100644 --- a/plugins/modules/gitlab_hook.py +++ b/plugins/modules/gitlab_hook.py @@ -97,6 +97,11 @@ options: - Trigger hook on wiki events. type: bool default: false + releases_events: + description: + - Trigger hook on release events. + type: bool + version_added: '8.4.0' hook_validate_certs: description: - Whether GitLab will do SSL verification when triggering the hook. @@ -201,6 +206,7 @@ class GitLabHook(object): 'job_events': options['job_events'], 'pipeline_events': options['pipeline_events'], 'wiki_page_events': options['wiki_page_events'], + 'releases_events': options['releases_events'], 'enable_ssl_verification': options['enable_ssl_verification'], 'token': options['token'], }) @@ -216,6 +222,7 @@ class GitLabHook(object): 'job_events': options['job_events'], 'pipeline_events': options['pipeline_events'], 'wiki_page_events': options['wiki_page_events'], + 'releases_events': options['releases_events'], 'enable_ssl_verification': options['enable_ssl_verification'], 'token': options['token'], }) @@ -302,6 +309,7 @@ def main(): job_events=dict(type='bool', default=False), pipeline_events=dict(type='bool', default=False), wiki_page_events=dict(type='bool', default=False), + releases_events=dict(type='bool', default=None), hook_validate_certs=dict(type='bool', default=False, aliases=['enable_ssl_verification']), token=dict(type='str', no_log=True), )) @@ -339,6 +347,7 @@ def main(): job_events = module.params['job_events'] pipeline_events = module.params['pipeline_events'] wiki_page_events = module.params['wiki_page_events'] + releases_events = module.params['releases_events'] enable_ssl_verification = module.params['hook_validate_certs'] hook_token = module.params['token'] @@ -369,6 +378,7 @@ def main(): "job_events": job_events, "pipeline_events": pipeline_events, "wiki_page_events": wiki_page_events, + "releases_events": releases_events, "enable_ssl_verification": enable_ssl_verification, "token": hook_token, }):