diff --git a/infrared_plugin/plugin.spec b/infrared_plugin/plugin.spec index 5f38fdf13..8af70c69d 100644 --- a/infrared_plugin/plugin.spec +++ b/infrared_plugin/plugin.spec @@ -127,6 +127,10 @@ subparsers: type: Value help: name of workflow to execute ansible_variable: test_workflow + failfast: + type: Flag + help: Stop the test run on the first step error or failure + ansible_variable: test_failfast tox-dir: type: Value help: directory from where run tox (typically test_dir) diff --git a/roles/tobiko-common/defaults/main.yaml b/roles/tobiko-common/defaults/main.yaml index 86e8318d2..cd2a462b4 100644 --- a/roles/tobiko-common/defaults/main.yaml +++ b/roles/tobiko-common/defaults/main.yaml @@ -22,6 +22,7 @@ test_git_version: 'master' test_src_dir: '' test_user: '{{ ansible_user | default(omit) }}' test_group: '{{ test_user }}' +test_mode: '{{ omit }}' # NOTE: if test_dir and tobiko_dir variables endup being the same actual @@ -38,6 +39,7 @@ tobiko_git_version: 'master' tobiko_src_dir: '' tobiko_user: '{{ ansible_user | default(omit) }}' tobiko_group: '{{ tobiko_user }}' +tobiko_mode: '{{ omit }}' # --- Test configuration options ---------------------------------------------- diff --git a/roles/tobiko-deploy/defaults/main.yaml b/roles/tobiko-deploy/defaults/main.yaml index ce1f04ebd..e484ac5d4 100644 --- a/roles/tobiko-deploy/defaults/main.yaml +++ b/roles/tobiko-deploy/defaults/main.yaml @@ -8,6 +8,7 @@ test_deploy_dirs: # test suite directory - clean_dir: '{{ clean_deploy_dir }}' dest_dir: '{{ test_dir }}' + dest_mode: '{{ test_mode }}' dest_user: '{{ test_user }}' dest_group: '{{ test_group }}' git_repo: '{{ test_git_repo }}' @@ -19,6 +20,7 @@ test_deploy_dirs: # Tobiko framework directory - clean_dir: '{{ clean_deploy_dir }}' dest_dir: '{{ tobiko_dir }}' + dest_mode: '{{ tobiko_mode }}' dest_user: '{{ tobiko_user }}' dest_group: '{{ tobiko_group }}' git_repo: '{{ tobiko_git_repo }}' diff --git a/roles/tobiko-deploy/tasks/deploy-dir.yaml b/roles/tobiko-deploy/tasks/deploy-dir.yaml index 5dff16c20..a315353b0 100644 --- a/roles/tobiko-deploy/tasks/deploy-dir.yaml +++ b/roles/tobiko-deploy/tasks/deploy-dir.yaml @@ -22,7 +22,7 @@ state: directory owner: '{{ dest_user | default(omit) }}' group: '{{ dest_group | default(omit) }}' - mode: '0755' + mode: '{{ dest_mode | default(omit) }}' recurse: yes become: '{{ test_become | bool }}' register: create_dest_dir diff --git a/roles/tobiko-run/defaults/main.yaml b/roles/tobiko-run/defaults/main.yaml index 27d2d35b9..585633594 100644 --- a/roles/tobiko-run/defaults/main.yaml +++ b/roles/tobiko-run/defaults/main.yaml @@ -1,5 +1,7 @@ --- +test_failfast: false test_workflow: default tox_step_name: tox_step_index: 0 +test_step_failures: [] diff --git a/roles/tobiko-run/tasks/main.yaml b/roles/tobiko-run/tasks/main.yaml index b145ecc2c..586edb5cf 100644 --- a/roles/tobiko-run/tasks/main.yaml +++ b/roles/tobiko-run/tasks/main.yaml @@ -14,3 +14,9 @@ loop_control: label: '{{ test_step.tox_description }}' loop_var: test_step + + +- name: "report test step failures" + debug: var=test_step_failures + when: '(test_step_failures | length) > 0' + failed_when: yes diff --git a/roles/tobiko-run/tasks/run.yaml b/roles/tobiko-run/tasks/run.yaml index a5670ace8..b79678aca 100644 --- a/roles/tobiko-run/tasks/run.yaml +++ b/roles/tobiko-run/tasks/run.yaml @@ -15,6 +15,17 @@ - (test_workflow_steps | length) > 1 -- name: '{{ test_step.tox_description }}' - include_role: - name: tobiko-tox +- block: + - name: '{{ test_step.tox_description }}' + include_role: + name: tobiko-tox + + rescue: + - name: "add step failure: '{{ tox_step_name }}'" + set_fact: + test_step_failures: '{{ test_step_failures + [test_step] }}' + + - name: "abort execution at first failure" + debug: var=test_step + when: test_failfast + failed_when: yes