master
在这种情况下,我正在尝试弄清楚当特定分支的测试失败时如何立即停止我的剧本。
这是我的 Ansible 代码:
- name: 'Run Tests'
shell: testing.sh | tee "testing.log"
register: testing
- name: 'Show log'
debug:
msg: "{{ testing.stdout_lines }}"
- name: 'Set fact'
set_fact:
tests: >-
{{
testing.stdout_lines | join(' ') | regex_findall('(\d+)\s*failed') | map('int') | max == 0
}}