Browse Source

Merge "Record handler tasks in json job output"

tags/3.10.2
Zuul 1 week ago
parent
commit
533659fe0c

+ 4
- 0
tests/fixtures/config/job-output/git/common-config/playbooks/job-output.yaml View File

@@ -1,6 +1,10 @@
1 1
 - hosts: all
2
+  handlers:
3
+    - name: handler
4
+      shell: echo "This is a handler"
2 5
   tasks:
3 6
     - shell: echo "Standard output test {{ zuul.executor.src_root }}"
7
+      notify: handler
4 8
     - shell: echo "This should be skipped"
5 9
       when: false
6 10
     - fail:

+ 4
- 0
tests/unit/test_v3.py View File

@@ -4926,6 +4926,10 @@ class TestJobOutput(AnsibleZuulTestCase):
4926 4926
                         ['hosts']['localhost']['skipped'])
4927 4927
         self.assertTrue(j[0]['plays'][0]['tasks'][2]
4928 4928
                         ['hosts']['localhost']['failed'])
4929
+        self.assertEqual(
4930
+            "This is a handler",
4931
+            j[0]['plays'][0]['tasks'][3]
4932
+            ['hosts']['localhost']['stdout'])
4929 4933
 
4930 4934
         self.log.info(self._get_file(self.history[0],
4931 4935
                                      'work/logs/job-output.txt'))

+ 3
- 0
zuul/ansible/base/callback/zuul_json.py View File

@@ -128,6 +128,9 @@ class CallbackModule(CallbackBase):
128 128
     def v2_playbook_on_task_start(self, task, is_conditional):
129 129
         self.results[-1]['tasks'].append(self._new_task(task))
130 130
 
131
+    def v2_playbook_on_handler_task_start(self, task):
132
+        self.v2_playbook_on_task_start(task, False)
133
+
131 134
     def v2_runner_on_ok(self, result, **kwargs):
132 135
         host = result._host
133 136
         action = result._task.action

Loading…
Cancel
Save