Browse Source

Merge "Record handler tasks in json job output"

tags/3.10.2
Zuul 5 months ago
parent
commit
533659fe0c
3 changed files with 11 additions and 0 deletions
  1. +4
    -0
      tests/fixtures/config/job-output/git/common-config/playbooks/job-output.yaml
  2. +4
    -0
      tests/unit/test_v3.py
  3. +3
    -0
      zuul/ansible/base/callback/zuul_json.py

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

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

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

@@ -4926,6 +4926,10 @@ class TestJobOutput(AnsibleZuulTestCase):
['hosts']['localhost']['skipped'])
self.assertTrue(j[0]['plays'][0]['tasks'][2]
['hosts']['localhost']['failed'])
self.assertEqual(
"This is a handler",
j[0]['plays'][0]['tasks'][3]
['hosts']['localhost']['stdout'])

self.log.info(self._get_file(self.history[0],
'work/logs/job-output.txt'))

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

@@ -128,6 +128,9 @@ class CallbackModule(CallbackBase):
def v2_playbook_on_task_start(self, task, is_conditional):
self.results[-1]['tasks'].append(self._new_task(task))

def v2_playbook_on_handler_task_start(self, task):
self.v2_playbook_on_task_start(task, False)

def v2_runner_on_ok(self, result, **kwargs):
host = result._host
action = result._task.action

Loading…
Cancel
Save