From 1475af7158b18d68b2da6a3780111bc4ad7724ab Mon Sep 17 00:00:00 2001 From: Tristan Cacqueray Date: Tue, 16 Oct 2018 06:46:09 +0000 Subject: [PATCH] run-test-command: support list in test_command variable This change enable run-test-command to use a list of commands. Change-Id: I7727c8330593a548a1bc66765bc632abfb9df1c8 --- playbooks/run-test-command/run.yaml | 13 ++++++++++++- zuul.yaml | 4 +++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/playbooks/run-test-command/run.yaml b/playbooks/run-test-command/run.yaml index aa87128c0..fb6963169 100644 --- a/playbooks/run-test-command/run.yaml +++ b/playbooks/run-test-command/run.yaml @@ -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 }}' diff --git a/zuul.yaml b/zuul.yaml index c9aeb376f..32cd900cf 100644 --- a/zuul.yaml +++ b/zuul.yaml @@ -481,7 +481,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"