From 4c8d34ddd11d84adbfd874e7e8ccd768f92172c3 Mon Sep 17 00:00:00 2001 From: Hans-Josef Koehler Date: Wed, 23 Feb 2022 17:52:59 +0100 Subject: [PATCH 1/5] jira: Use fields in comment to merge in additional data --- plugins/modules/web_infrastructure/jira.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/plugins/modules/web_infrastructure/jira.py b/plugins/modules/web_infrastructure/jira.py index 676b4620d20..3fb1d5d4151 100644 --- a/plugins/modules/web_infrastructure/jira.py +++ b/plugins/modules/web_infrastructure/jira.py @@ -261,6 +261,20 @@ type: role value: Developers +- name: Comment on issue with property to mark it internal + community.general.jira: + uri: '{{ server }}' + username: '{{ user }}' + password: '{{ pass }}' + issue: '{{ issue.meta.key }}' + operation: comment + comment: A comment added by Ansible + fields: + properties: + - key: 'sd.public.comment' + value: + internal: true + # Assign an existing issue using edit - name: Assign an issue using free-form fields community.general.jira: @@ -502,6 +516,10 @@ def operation_comment(self): if self.vars.comment_visibility is not None: data['visibility'] = self.vars.comment_visibility + # Use 'fields' to merge in any additional data + if self.vars.fields: + data.update(self.vars.fields) + url = self.vars.restbase + '/issue/' + self.vars.issue + '/comment' self.vars.meta = self.post(url, data) From aa5336d155af1e426a3f2aa3bc69a88d95fe6a69 Mon Sep 17 00:00:00 2001 From: Hans-Josef Koehler Date: Wed, 2 Mar 2022 09:07:56 +0100 Subject: [PATCH 2/5] changlog fragment added --- changelogs/fragments/4304-jira-fields-in-comment.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelogs/fragments/4304-jira-fields-in-comment.yml diff --git a/changelogs/fragments/4304-jira-fields-in-comment.yml b/changelogs/fragments/4304-jira-fields-in-comment.yml new file mode 100644 index 00000000000..d8b26c2aa74 --- /dev/null +++ b/changelogs/fragments/4304-jira-fields-in-comment.yml @@ -0,0 +1,2 @@ +minor_changes: + - jira - when creating a comment, ``fields`` is used for additional data (https://github.com/ansible-collections/community.general/pull/4304) From 99327efe0621dcc348b5874a4f77cd7ac3b10bdb Mon Sep 17 00:00:00 2001 From: Boosai <51994151+Boosai@users.noreply.github.com> Date: Thu, 3 Mar 2022 10:05:14 +0100 Subject: [PATCH 3/5] Update changelogs/fragments/4304-jira-fields-in-comment.yml Co-authored-by: Felix Fontein --- changelogs/fragments/4304-jira-fields-in-comment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelogs/fragments/4304-jira-fields-in-comment.yml b/changelogs/fragments/4304-jira-fields-in-comment.yml index d8b26c2aa74..2f7402b6371 100644 --- a/changelogs/fragments/4304-jira-fields-in-comment.yml +++ b/changelogs/fragments/4304-jira-fields-in-comment.yml @@ -1,2 +1,2 @@ minor_changes: - - jira - when creating a comment, ``fields`` is used for additional data (https://github.com/ansible-collections/community.general/pull/4304) + - jira - when creating a comment, ``fields`` now is used for additional data (https://github.com/ansible-collections/community.general/pull/4304). From 3034e1547b6d9cb1d1e34203d11ee728705c6420 Mon Sep 17 00:00:00 2001 From: Hans-Josef Koehler Date: Thu, 3 Mar 2022 10:22:10 +0100 Subject: [PATCH 4/5] updated fields documentation --- plugins/modules/web_infrastructure/jira.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/modules/web_infrastructure/jira.py b/plugins/modules/web_infrastructure/jira.py index 3fb1d5d4151..eea96eaab9a 100644 --- a/plugins/modules/web_infrastructure/jira.py +++ b/plugins/modules/web_infrastructure/jira.py @@ -158,6 +158,7 @@ - This is a free-form data structure that can contain arbitrary data. This is passed directly to the JIRA REST API (possibly after merging with other required data, as when passed to create). See examples for more information, and the JIRA REST API for the structure required for various fields. + - When passed to comment, the data structure is merged at the first level. Useful to add JIRA properties for example. - Note that JIRA may not allow changing field values on specific transitions or states. jql: From 0a5aa4c6e99ba32057de4fccedec5b5b8486866d Mon Sep 17 00:00:00 2001 From: Boosai <51994151+Boosai@users.noreply.github.com> Date: Thu, 3 Mar 2022 14:31:20 +0100 Subject: [PATCH 5/5] Update plugins/modules/web_infrastructure/jira.py Co-authored-by: Felix Fontein --- plugins/modules/web_infrastructure/jira.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/modules/web_infrastructure/jira.py b/plugins/modules/web_infrastructure/jira.py index eea96eaab9a..d6c76538357 100644 --- a/plugins/modules/web_infrastructure/jira.py +++ b/plugins/modules/web_infrastructure/jira.py @@ -158,7 +158,7 @@ - This is a free-form data structure that can contain arbitrary data. This is passed directly to the JIRA REST API (possibly after merging with other required data, as when passed to create). See examples for more information, and the JIRA REST API for the structure required for various fields. - - When passed to comment, the data structure is merged at the first level. Useful to add JIRA properties for example. + - When passed to comment, the data structure is merged at the first level since community.general 4.6.0. Useful to add JIRA properties for example. - Note that JIRA may not allow changing field values on specific transitions or states. jql: