Support Ansible 2.8

Ansible has released 2.8 and now zuul also supports it. We've had to
update zuul_console to deal with new tasks stats, along with
gather_facts also now being exposed directly to the job.

Change-Id: Ifa4be7cf408b1f05b0f985fa0c9a5e3947858078
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Tobias Henkel 2019-01-19 18:07:35 +01:00 committed by Paul Belanger
parent 9f7c642ae1
commit 5b31159717
210 changed files with 366 additions and 1 deletions

View File

@ -45,6 +45,12 @@
vars: vars:
zuul_ansible_version: 2.7 zuul_ansible_version: 2.7
- job:
name: zuul-stream-functional-2.8
parent: zuul-stream-functional
vars:
zuul_ansible_version: 2.8
- job: - job:
name: zuul-tox-remote name: zuul-tox-remote
parent: tox parent: tox
@ -187,6 +193,7 @@
- zuul-stream-functional-2.5 - zuul-stream-functional-2.5
- zuul-stream-functional-2.6 - zuul-stream-functional-2.6
- zuul-stream-functional-2.7 - zuul-stream-functional-2.7
- zuul-stream-functional-2.8
- zuul-tox-remote - zuul-tox-remote
- zuul-quick-start: - zuul-quick-start:
dependencies: zuul-build-image dependencies: zuul-build-image
@ -223,6 +230,7 @@
- zuul-stream-functional-2.5 - zuul-stream-functional-2.5
- zuul-stream-functional-2.6 - zuul-stream-functional-2.6
- zuul-stream-functional-2.7 - zuul-stream-functional-2.7
- zuul-stream-functional-2.8
- zuul-tox-remote - zuul-tox-remote
- zuul-quick-start: - zuul-quick-start:
dependencies: zuul-upload-image dependencies: zuul-upload-image

View File

@ -0,0 +1,4 @@
---
features:
- |
Zuul now supports ansible 2.8 for running jobs.

View File

@ -60,6 +60,14 @@
test_ansible_version_major: 2 test_ansible_version_major: 2
test_ansible_version_minor: 7 test_ansible_version_minor: 7
- job:
name: ansible-28
parent: ansible-version
ansible-version: 2.8
vars:
test_ansible_version_major: 2
test_ansible_version_minor: 8
- project: - project:
name: common-config name: common-config
@ -69,6 +77,7 @@
- ansible-25 - ansible-25
- ansible-26 - ansible-26
- ansible-27 - ansible-27
- ansible-28
- project: - project:
name: org/project name: org/project
@ -78,3 +87,4 @@
- ansible-25 - ansible-25
- ansible-26 - ansible-26
- ansible-27 - ansible-27
- ansible-28

View File

@ -219,3 +219,7 @@ class TestActionModules26(TestActionModules25):
class TestActionModules27(TestActionModules25): class TestActionModules27(TestActionModules25):
ansible_version = '2.7' ansible_version = '2.7'
class TestActionModules28(TestActionModules25):
ansible_version = '2.8'

View File

@ -150,3 +150,44 @@ class TestZuulJSON26(TestZuulJSON25):
class TestZuulJSON27(TestZuulJSON25): class TestZuulJSON27(TestZuulJSON25):
ansible_version = '2.7' ansible_version = '2.7'
class TestZuulJSON28(TestZuulJSON25):
ansible_version = '2.8'
def test_json_task_action(self):
job = self._run_job('no-log')
with self.jobLog(job):
build = self.history[-1]
self.assertEqual(build.result, 'SUCCESS')
text = self._get_json_as_text(build)
json_result = json.loads(text)
tasks = json_result[0]['plays'][0]['tasks']
# NOTE(pabelanger): In 2.8 gather_facts are now logged as an
# expected action.
expected_actions = [
'gather_facts', 'debug', 'debug', 'debug', 'copy', 'find',
'stat', 'debug'
]
for i, expected in enumerate(expected_actions):
host_result = tasks[i]['hosts']['controller']
self.assertEquals(expected, host_result['action'])
def test_json_role_log(self):
job = self._run_job('json-role')
with self.jobLog(job):
build = self.history[-1]
self.assertEqual(build.result, 'SUCCESS')
text = self._get_json_as_text(build)
self.assertIn('json-role', text)
json_result = json.loads(text)
# NOTE(pabelanger): In 2.8 gather_facts are now logged as the
# first task.
role_name = json_result[0]['plays'][0]['tasks'][1]['role']['name']
self.assertEqual('json-role', role_name)
role_path = json_result[0]['plays'][0]['tasks'][1]['role']['path']
self.assertEqual('json-role', os.path.basename(role_path))

View File

@ -192,3 +192,80 @@ class TestZuulStream26(TestZuulStream25):
class TestZuulStream27(TestZuulStream25): class TestZuulStream27(TestZuulStream25):
ansible_version = '2.7' ansible_version = '2.7'
class TestZuulStream28(TestZuulStream25):
ansible_version = '2.8'
def test_command(self):
job = self._run_job('command')
with self.jobLog(job):
build = self.history[-1]
self.assertEqual(build.result, 'SUCCESS')
text = self._get_job_output(build)
self.assertLogLine(
r'RUN START: \[untrusted : review.example.com/org/project/'
r'playbooks/command.yaml@master\]', text)
self.assertLogLine(r'PLAY \[all\]', text)
self.assertLogLine(
r'Ansible version={}'.format(self.ansible_version), text)
self.assertLogLine(r'TASK \[Show contents of first file\]', text)
self.assertLogLine(r'controller \| command test one', text)
self.assertLogLine(
r'controller \| ok: Runtime: \d:\d\d:\d\d\.\d\d\d\d\d\d', text)
self.assertLogLine(r'TASK \[Show contents of second file\]', text)
self.assertLogLine(r'compute1 \| command test two', text)
self.assertLogLine(r'controller \| command test two', text)
self.assertLogLine(r'compute1 \| This is a rescue task', text)
self.assertLogLine(r'controller \| This is a rescue task', text)
self.assertLogLine(r'compute1 \| This is an always task', text)
self.assertLogLine(r'controller \| This is an always task', text)
self.assertLogLine(r'compute1 \| This is a handler', text)
self.assertLogLine(r'controller \| This is a handler', text)
self.assertLogLine(r'controller \| First free task', text)
self.assertLogLine(r'controller \| Second free task', text)
self.assertLogLine(r'controller \| This is a shell task after an '
'included role', text)
self.assertLogLine(r'compute1 \| This is a shell task after an '
'included role', text)
self.assertLogLine(r'controller \| This is a command task after '
'an included role', text)
self.assertLogLine(r'compute1 \| This is a command task after an '
'included role', text)
self.assertLogLine(r'controller \| This is a shell task with '
'delegate compute1', text)
self.assertLogLine(r'controller \| This is a shell task with '
'delegate controller', text)
self.assertLogLine(r'compute1 \| item_in_loop1', text)
self.assertLogLine(r'compute1 \| ok: Item: item_in_loop1 '
r'Runtime: \d:\d\d:\d\d\.\d\d\d\d\d\d', text)
self.assertLogLine(r'compute1 \| item_in_loop2', text)
self.assertLogLine(r'compute1 \| ok: Item: item_in_loop2 '
r'Runtime: \d:\d\d:\d\d\.\d\d\d\d\d\d', text)
self.assertLogLine(r'compute1 \| failed_in_loop1', text)
self.assertLogLine(r'compute1 \| ok: Item: failed_in_loop1 '
r'Result: 1', text)
self.assertLogLine(r'compute1 \| failed_in_loop2', text)
self.assertLogLine(r'compute1 \| ok: Item: failed_in_loop2 '
r'Result: 1', text)
self.assertLogLine(r'localhost \| .*No such file or directory: .*'
r'\'/local-shelltask/somewhere/'
r'that/does/not/exist\'', text)
self.assertLogLine(r'compute1 \| .*No such file or directory: .*'
r'\'/remote-shelltask/somewhere/'
r'that/does/not/exist\'', text)
self.assertLogLine(r'controller \| .*No such file or directory: .*'
r'\'/remote-shelltask/somewhere/'
r'that/does/not/exist\'', text)
self.assertLogLine(
r'controller \| ok: Runtime: \d:\d\d:\d\d\.\d\d\d\d\d\d', text)
self.assertLogLine('PLAY RECAP', text)
# NOTE(pabelanger): Ansible 2.8 added new stats
# skipped, rescued, ignored.
self.assertLogLine(
r'controller \| ok: \d+ changed: \d+ unreachable: 0 failed: 0 '
'skipped: 0 rescued: 1 ignored: 0', text)
self.assertLogLine(
r'RUN END RESULT_NORMAL: \[untrusted : review.example.com/'
r'org/project/playbooks/command.yaml@master]', text)

View File

@ -2731,6 +2731,10 @@ class TestAnsible27(TestAnsible25):
ansible_version = '2.7' ansible_version = '2.7'
class TestAnsible28(TestAnsible25):
ansible_version = '2.8'
class TestPrePlaybooks(AnsibleZuulTestCase): class TestPrePlaybooks(AnsibleZuulTestCase):
# A temporary class to hold new tests while others are disabled # A temporary class to hold new tests while others are disabled
@ -5767,6 +5771,7 @@ class TestAnsibleVersion(AnsibleZuulTestCase):
dict(name='ansible-25', result='SUCCESS', changes='1,1'), dict(name='ansible-25', result='SUCCESS', changes='1,1'),
dict(name='ansible-26', result='SUCCESS', changes='1,1'), dict(name='ansible-26', result='SUCCESS', changes='1,1'),
dict(name='ansible-27', result='SUCCESS', changes='1,1'), dict(name='ansible-27', result='SUCCESS', changes='1,1'),
dict(name='ansible-28', result='SUCCESS', changes='1,1'),
], ordered=False) ], ordered=False)
@ -5788,6 +5793,7 @@ class TestDefaultAnsibleVersion(AnsibleZuulTestCase):
dict(name='ansible-25', result='SUCCESS', changes='1,1'), dict(name='ansible-25', result='SUCCESS', changes='1,1'),
dict(name='ansible-26', result='SUCCESS', changes='1,1'), dict(name='ansible-26', result='SUCCESS', changes='1,1'),
dict(name='ansible-27', result='SUCCESS', changes='1,1'), dict(name='ansible-27', result='SUCCESS', changes='1,1'),
dict(name='ansible-28', result='SUCCESS', changes='1,1'),
], ordered=False) ], ordered=False)

View File

@ -0,0 +1 @@
../../base/action/__init__.py

View File

@ -0,0 +1 @@
../../base/action/add_host.py

View File

@ -0,0 +1 @@
../../base/action/add_host.pyi

View File

@ -0,0 +1 @@
../../base/action/aireos.py

View File

@ -0,0 +1 @@
../../base/action/aireos.pyi

View File

@ -0,0 +1 @@
../../base/action/aireos_config.py

View File

@ -0,0 +1 @@
../../base/action/aireos_config.pyi

View File

@ -0,0 +1 @@
../../base/action/aruba.py

View File

@ -0,0 +1 @@
../../base/action/aruba.pyi

View File

@ -0,0 +1 @@
../../base/action/aruba_config.py

View File

@ -0,0 +1 @@
../../base/action/aruba_config.pyi

View File

@ -0,0 +1 @@
../../base/action/asa.py

View File

@ -0,0 +1 @@
../../base/action/asa.pyi

View File

@ -0,0 +1 @@
../../base/action/asa_config.py

View File

@ -0,0 +1 @@
../../base/action/asa_config.pyi

View File

@ -0,0 +1 @@
../../base/action/asa_template.py

View File

@ -0,0 +1 @@
../../base/action/asa_template.pyi

View File

@ -0,0 +1 @@
../../base/action/assemble.py

View File

@ -0,0 +1 @@
../../base/action/assemble.pyi

View File

@ -0,0 +1 @@
../../base/action/aws_s3.py

View File

@ -0,0 +1 @@
../../base/action/aws_s3.pyi

View File

@ -0,0 +1 @@
../../base/action/ce.py

View File

@ -0,0 +1 @@
../../base/action/ce.pyi

View File

@ -0,0 +1 @@
../../base/action/ce_config.py

View File

@ -0,0 +1 @@
../../base/action/ce_config.pyi

View File

@ -0,0 +1 @@
../../base/action/ce_template.py

View File

@ -0,0 +1 @@
../../base/action/ce_template.pyi

View File

@ -0,0 +1 @@
../../base/action/copy.py

View File

@ -0,0 +1 @@
../../base/action/copy.pyi

View File

@ -0,0 +1 @@
../../base/action/dellos10_config.py

View File

@ -0,0 +1 @@
../../base/action/dellos10_config.pyi

View File

@ -0,0 +1 @@
../../base/action/dellos6_config.py

View File

@ -0,0 +1 @@
../../base/action/dellos6_config.pyi

View File

@ -0,0 +1 @@
../../base/action/dellos9_config.py

View File

@ -0,0 +1 @@
../../base/action/dellos9_config.pyi

View File

@ -0,0 +1 @@
../../base/action/eos_config.py

View File

@ -0,0 +1 @@
../../base/action/eos_config.pyi

View File

@ -0,0 +1 @@
../../base/action/eos_template.py

View File

@ -0,0 +1 @@
../../base/action/eos_template.pyi

View File

@ -0,0 +1 @@
../../base/action/fetch.py

View File

@ -0,0 +1 @@
../../base/action/fetch.pyi

View File

@ -0,0 +1 @@
../../base/action/fortios_config.py

View File

@ -0,0 +1 @@
../../base/action/fortios_config.pyi

View File

@ -0,0 +1 @@
../../base/action/include_vars.py

View File

@ -0,0 +1 @@
../../base/action/include_vars.pyi

View File

@ -0,0 +1 @@
../../base/action/ios_config.py

View File

@ -0,0 +1 @@
../../base/action/ios_config.pyi

View File

@ -0,0 +1 @@
../../base/action/ios_template.py

View File

@ -0,0 +1 @@
../../base/action/ios_template.pyi

View File

@ -0,0 +1 @@
../../base/action/iosxr_config.py

View File

@ -0,0 +1 @@
../../base/action/iosxr_config.pyi

View File

@ -0,0 +1 @@
../../base/action/iosxr_template.py

View File

@ -0,0 +1 @@
../../base/action/iosxr_template.pyi

View File

@ -0,0 +1 @@
../../base/action/junos_config.py

View File

@ -0,0 +1 @@
../../base/action/junos_config.pyi

View File

@ -0,0 +1 @@
../../base/action/junos_template.py

View File

@ -0,0 +1 @@
../../base/action/junos_template.pyi

View File

@ -0,0 +1 @@
../../base/action/net_banner.py

View File

@ -0,0 +1 @@
../../base/action/net_banner.pyi

View File

@ -0,0 +1 @@
../../base/action/net_base.py

View File

@ -0,0 +1 @@
../../base/action/net_base.pyi

View File

@ -0,0 +1 @@
../../base/action/net_config.py

View File

@ -0,0 +1 @@
../../base/action/net_config.pyi

View File

@ -0,0 +1 @@
../../base/action/net_get.py

View File

@ -0,0 +1 @@
../../base/action/net_get.pyi

View File

@ -0,0 +1 @@
../../base/action/net_interface.py

View File

@ -0,0 +1 @@
../../base/action/net_interface.pyi

View File

@ -0,0 +1 @@
../../base/action/net_l2_interface.py

View File

@ -0,0 +1 @@
../../base/action/net_l2_interface.pyi

View File

@ -0,0 +1 @@
../../base/action/net_l3_interface.py

View File

@ -0,0 +1 @@
../../base/action/net_l3_interface.pyi

View File

@ -0,0 +1 @@
../../base/action/net_linkagg.py

View File

@ -0,0 +1 @@
../../base/action/net_linkagg.pyi

View File

@ -0,0 +1 @@
../../base/action/net_lldp.py

View File

@ -0,0 +1 @@
../../base/action/net_lldp.pyi

View File

@ -0,0 +1 @@
../../base/action/net_lldp_interface.py

View File

@ -0,0 +1 @@
../../base/action/net_lldp_interface.pyi

View File

@ -0,0 +1 @@
../../base/action/net_logging.py

View File

@ -0,0 +1 @@
../../base/action/net_logging.pyi

View File

@ -0,0 +1 @@
../../base/action/net_ping.py

View File

@ -0,0 +1 @@
../../base/action/net_ping.pyi

View File

@ -0,0 +1 @@
../../base/action/net_static_route.py

View File

@ -0,0 +1 @@
../../base/action/net_static_route.pyi

View File

@ -0,0 +1 @@
../../base/action/net_system.py

View File

@ -0,0 +1 @@
../../base/action/net_system.pyi

View File

@ -0,0 +1 @@
../../base/action/net_template.py

View File

@ -0,0 +1 @@
../../base/action/net_template.pyi

View File

@ -0,0 +1 @@
../../base/action/net_user.py

View File

@ -0,0 +1 @@
../../base/action/net_user.pyi

View File

@ -0,0 +1 @@
../../base/action/net_vlan.py

View File

@ -0,0 +1 @@
../../base/action/net_vlan.pyi

View File

@ -0,0 +1 @@
../../base/action/net_vrf.py

View File

@ -0,0 +1 @@
../../base/action/net_vrf.pyi

Some files were not shown because too many files have changed in this diff Show More