Merge "run-test-command: support list in test_command variable"

This commit is contained in:
Zuul 2019-03-26 16:34:41 +00:00 committed by Gerrit Code Review
commit 884b77472c
2 changed files with 15 additions and 2 deletions

View File

@ -1,7 +1,18 @@
- hosts: all
tasks:
- name: Convert test_command to list
set_fact:
test_commands: ['{{ test_command }}']
when: test_command | type_debug != 'list'
- name: Use test_command list
set_fact:
test_commands: '{{ test_command }}'
when: test_command | type_debug == 'list'
- name: Run test_command
command: '{{ test_command }}'
command: '{{ item }}'
args:
chdir: '{{ zuul.project.src_dir }}'
with_items: '{{ test_commands }}'

View File

@ -525,7 +525,9 @@
description: |
Run simple command as test.
To use this, set the ``test_command`` variable.
To use this, set the ``test_command`` variable to a single command or
a list of commands. For complex list of commands, it is recommended to
use a single command that run a proper script.
run: playbooks/run-test-command/run.yaml
vars:
test_command: "exit 1"