Create zuul.executor.hostname ansible variable
It will be helpful to know which executor ansible-playbook is run from so pass this info into vars.yaml. Additionally, update our test_v3 playbook test to also validate our other executor ansible variables. Change-Id: I22091c8e764ad519878e5d530e5bc72ffd2a4870 Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
parent
bb366dabc5
commit
e2b8d49ef1
|
@ -6,3 +6,10 @@
|
|||
- nodepool_az == 'test-az'
|
||||
- nodepool_region == 'test-region'
|
||||
- nodepool_provider == 'test-provider'
|
||||
|
||||
- name: Assert zuul-executor variables are valid.
|
||||
assert:
|
||||
that:
|
||||
- zuul.executor.hostname is defined
|
||||
- zuul.executor.src_root is defined
|
||||
- zuul.executor.log_root is defined
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
- job:
|
||||
parent: python27
|
||||
name: nodepool
|
||||
name: check-vars
|
||||
nodes:
|
||||
- name: ubuntu-xenial
|
||||
image: ubuntu-xenial
|
||||
|
|
|
@ -8,5 +8,5 @@
|
|||
jobs:
|
||||
- python27
|
||||
- faillocal
|
||||
- nodepool
|
||||
- check-vars
|
||||
- timeout
|
||||
|
|
|
@ -266,7 +266,7 @@ class TestAnsible(AnsibleZuulTestCase):
|
|||
self.assertEqual(build.result, 'ABORTED')
|
||||
build = self.getJobFromHistory('faillocal')
|
||||
self.assertEqual(build.result, 'FAILURE')
|
||||
build = self.getJobFromHistory('nodepool')
|
||||
build = self.getJobFromHistory('check-vars')
|
||||
self.assertEqual(build.result, 'SUCCESS')
|
||||
build = self.getJobFromHistory('python27')
|
||||
self.assertEqual(build.result, 'SUCCESS')
|
||||
|
|
|
@ -819,8 +819,10 @@ class AnsibleJob(object):
|
|||
|
||||
with open(self.jobdir.vars, 'w') as vars_yaml:
|
||||
zuul_vars = dict(args['vars'])
|
||||
zuul_vars['zuul']['executor'] = dict(src_root=self.jobdir.src_root,
|
||||
log_root=self.jobdir.log_root)
|
||||
zuul_vars['zuul']['executor'] = dict(
|
||||
hostname=self.executor_server.hostname,
|
||||
src_root=self.jobdir.src_root,
|
||||
log_root=self.jobdir.log_root)
|
||||
vars_yaml.write(
|
||||
yaml.safe_dump(zuul_vars, default_flow_style=False))
|
||||
self.writeAnsibleConfig(self.jobdir.untrusted_config)
|
||||
|
|
Loading…
Reference in New Issue