Browse Source

Continue running workflow steps after step failures

Introduce new IR plugin option '--failfast' to abort
execution at the first failing workflow step

Change-Id: Ia79968cf7846f33fdaa05ac5bd511b614ae0784a
changes/71/724671/5
Federico Ressi 1 year ago
parent
commit
9501f7589a
  1. 4
      infrared_plugin/plugin.spec
  2. 2
      roles/tobiko-common/defaults/main.yaml
  3. 2
      roles/tobiko-deploy/defaults/main.yaml
  4. 2
      roles/tobiko-deploy/tasks/deploy-dir.yaml
  5. 2
      roles/tobiko-run/defaults/main.yaml
  6. 6
      roles/tobiko-run/tasks/main.yaml
  7. 17
      roles/tobiko-run/tasks/run.yaml

4
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)

2
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 ----------------------------------------------

2
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 }}'

2
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

2
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: []

6
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

17
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
Loading…
Cancel
Save