Parameterize the test-setup role

The patch will allow jobs to set environment variables and pass
command line arguments to the test-setup.sh script defined by a
project.

This can be used to customize the setup based on the particular job
being run.

Change-Id: I11e1ab15fd2bf3c734544121d9b4040b99ee63da
This commit is contained in:
Kenneth Giusti 2017-10-10 11:02:55 -04:00
parent 2862cddb6a
commit 1eafcaabbb
3 changed files with 18 additions and 1 deletions

View File

@ -8,3 +8,15 @@ be run.
This allows projects to specify test-setup steps (such as creating or
initializing a database) in a form that can be easily run by both an
automated testing system and developers.
**Role Variables**
.. zuul:rolevar:: test_setup_environment
Environment variables to pass in to the test-setup script.
.. zuul:rolevar:: test_setup_args
String of optional command line options passed to
the test-setup script.

View File

@ -1,2 +1,6 @@
---
test_setup_args: ""
test_setup_environment: {}
zuul_work_dir: "src/{{ zuul.project.canonical_name }}"

View File

@ -4,7 +4,8 @@
register: p
- name: Run tools/test-setup.sh
command: tools/test-setup.sh
command: tools/test-setup.sh {{ test_setup_args }}
environment: "{{ test_setup_environment }}"
args:
chdir: "{{ zuul_work_dir }}"
when: