54 lines
2.5 KiB
YAML
54 lines
2.5 KiB
YAML
---
|
|
# validation_group: validation group to execute
|
|
# skiplist_validations: comma separated string of the validations to be skipped in a group
|
|
# validation_allowed_groups: list of allowed groups to run
|
|
# validation_args: string containing extra arguments for the validation command. (defaults to empty string)
|
|
- block:
|
|
- name: "Retrieve validations for group {{ validation_group }}"
|
|
command: "openstack tripleo validator list --group {{ validation_group }} -f value -c ID"
|
|
register: validations_in_group
|
|
- name: Set fact validations_filtered which removes validations from skiplist
|
|
set_fact:
|
|
validations_filtered: "{{ validations_in_group.stdout_lines | difference( skiplist_validations.split(',') ) }}"
|
|
- name: "Running validations {{ validations_filtered }}"
|
|
register: validations_result
|
|
shell: |
|
|
set -o pipefail
|
|
source {{ undercloud_rc }}
|
|
openstack tripleo validator run --validation {{ validations_filtered | join(',') }} --inventory {{ upgrade_validation_inventory }} \
|
|
{{ validations_extra_args }} 2>&1 {{ timestamper_cmd }} >> validation-{{ validation_group }}.log
|
|
when:
|
|
- "validations_filtered|length > 0"
|
|
args:
|
|
executable: /usr/bin/bash
|
|
- name: Validation group not executed
|
|
debug:
|
|
msg: "Validation group {{ validation_group }} is skipped."
|
|
when:
|
|
- "validations_filtered|length == 0"
|
|
rescue:
|
|
- name: Retrieve the validations results
|
|
command: openstack tripleo validator show history -f json -c UUID -c Status
|
|
register: validation_history
|
|
- name: Set fact validation_status with the validations results
|
|
set_fact:
|
|
validations_failed: "{{ validation_history.stdout|default('')|from_json|json_query(\"[?Status != 'PASSED'].UUID\") }}"
|
|
when: validation_history is defined
|
|
- name: Log all the validations failed
|
|
shell: |
|
|
openstack tripleo validator show run {{ item }} &>> validation-{{ validation_group }}-failed.log
|
|
loop: "{{ validations_failed }}"
|
|
when:
|
|
- "validations_failed|length > 0"
|
|
- name: Fail if some validation is not PASSED
|
|
fail:
|
|
msg: "Validation failed: check the log in validation-{{ validation_group }}-failed.log."
|
|
when:
|
|
- "validations_failed|length > 0"
|
|
- name: Fail if the validations command didn't succeed
|
|
fail:
|
|
msg: "Validations failed: check the log in validation-{{ validation_group }}.log."
|
|
when:
|
|
- validations_result is not succeeded
|
|
when: "validation_group in validation_allowed_groups"
|