Add zuul_work_dir to run-test-command

To make it so that a repo can host a simple command which is an
integration test of multiple projects, add the semi-standard
zuul_work_dir variable to the job.

Change-Id: I265469ac9c12c3a38a11b243f3ff747d27141f21
This commit is contained in:
James E. Blair 2020-05-13 11:31:01 -07:00
parent adf84f02db
commit a3ba8e309a
2 changed files with 6 additions and 1 deletions

View File

@ -14,5 +14,5 @@
- name: Run test_command - name: Run test_command
command: '{{ item }}' command: '{{ item }}'
args: args:
chdir: '{{ zuul.project.src_dir }}' chdir: '{{ zuul_work_dir | default(zuul.project.src_dir) }}'
with_items: '{{ test_commands }}' with_items: '{{ test_commands }}'

View File

@ -36,6 +36,11 @@
To use this, set the ``test_command`` variable to a single command or 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 a list of commands. For complex list of commands, it is recommended to
use a single command that runs a proper script. use a single command that runs a proper script.
.. zuul:jobvar:: zuul_work_dir
:default: {{ zuul.project.src_dir }}
Path to operate in.
run: playbooks/run-test-command/run.yaml run: playbooks/run-test-command/run.yaml
vars: vars:
test_command: "exit 1" test_command: "exit 1"