From 607708f46dea77f7adfa9a0bc214a971d6639cc0 Mon Sep 17 00:00:00 2001 From: Kamil Páral Date: Jan 26 2018 12:10:30 +0000 Subject: fix exit code of the playbook Also print artifacts dir at the end. --- diff --git a/process_results.py b/process_results.py index e819f44..a43b49e 100644 --- a/process_results.py +++ b/process_results.py @@ -55,8 +55,11 @@ def run(koji_build, workdir='.', artifactsdir='artifacts', with open(results_path, 'w') as results_file: results_file.write(output) - #FIXME detail vs details, outcome aggregation - return 0 if details[0].outcome in ['PASSED', 'INFO'] else 1 + overall_detail = [detail for detail in details + if detail.checkname == testcase] + assert len(overall_detail) == 1 + overall_detail = overall_detail[0] + return 0 if overall_detail.outcome in ['PASSED', 'INFO'] else 1 def read_results(unpackeddir): diff --git a/tests.yml b/tests.yml index 6e6dc4d..cc65d12 100644 --- a/tests.yml +++ b/tests.yml @@ -30,7 +30,7 @@ tempfile: path: /var/tmp state: directory - prefix: task-rpmgrill_ + prefix: task-{{ testcase }}_ register: workdir - name: Print work dir @@ -45,27 +45,28 @@ debug: var: download_arches - - name: Download RPMs from koji - # use realpath because when running in local mode, artifacts is a - # relative path and we use chdir - shell: > - koji download-build --arch {{ download_arches | join(' --arch ') }} - {{ taskotron_item }} - &>> {{ artifacts | realpath }}/test.log - args: - chdir: "{{ workdir.path }}" + - block: + - name: Download RPMs from koji + # use realpath because when running in local mode, artifacts is a + # relative path and we use chdir + shell: > + koji download-build --arch {{ download_arches | join(' --arch ') }} + {{ taskotron_item }} + &>> {{ artifacts | realpath }}/test.log + args: + chdir: "{{ workdir.path }}" - - name: Prepare directories and run rpmgrill - shell: > - bash run_rpmgrill.sh {{ workdir.path }} - &>> {{ artifacts }}/test.log + - name: Prepare directories and run rpmgrill + shell: > + bash run_rpmgrill.sh {{ workdir.path }} + &>> {{ artifacts }}/test.log - - name: Process and report rpmgrill results - shell: > - python process_results.py {{ taskotron_item }} {{ workdir.path }} - {{ artifacts }} {{ testcase }} - &>> {{ artifacts }}/test.log - - - name: Print results location - debug: - msg: 'You can see task results at: {{ artifacts | realpath }}' + - name: Process and report rpmgrill results + shell: > + python process_results.py {{ taskotron_item }} {{ workdir.path }} + {{ artifacts }} {{ testcase }} + &>> {{ artifacts }}/test.log + always: + - name: Print results location + debug: + msg: 'You can see task results at: {{ artifacts | realpath }}'