Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions ci/report_result.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@
vars_files:
- vars/common.yml
tasks:
- name: Check whether the log dir exists
ansible.builtin.stat:
path: "{{ logs_dir }}"
register: stat_out

- name: show whetehr the log dir exists
ansible.builtin.debug:
var: stat_out

- name: Create log dir
when: not stat_out.stat.exists
ansible.builtin.file:
path: "{{ logs_dir }}"
state: directory
Expand Down Expand Up @@ -34,10 +44,20 @@
msg: "There were no XML files found in {{ logs_dir }}."
when: verbose_matches.stdout_lines | length == 0

- name: "Get the number of testcase errors"
ansible.builtin.set_fact:
tasks_errored: "{{ verbose_matches.stdout | regex_replace('.*errors=\"([0-9]*)\".*>', '\\1') | split('\n') | map('int') | sum }}"

- name: "Get the number of failed testcases"
ansible.builtin.set_fact:
tasks_failed: "{{ verbose_matches.stdout | regex_replace('.*failures=\"([0-9]*)\".*>', '\\1') | split('\n') | map('int') | sum }}"

# The RC from grep is 0 if the string is matched
- name: Fail when there's a testcase error
ansible.builtin.fail:
msg: There were {{ tasks_errored }} errors in the testcases.
when: tasks_errored | int > 0 and verbose_matches.rc == 0

# The RC from grep is 0 if the string is matched
- name: Fail when there's a testcase failure
ansible.builtin.fail:
Expand Down