Add Ansible 8

This is the currently supported version of Ansible.  Since 7 is out
of support, let's skip it.

Change-Id: I1d13c23189dce7fd9db291ee03a452089b92a421
This commit is contained in:
James E. Blair 2023-07-11 13:42:03 -07:00
parent c7adffc244
commit 60a8dfd451
33 changed files with 150 additions and 21 deletions

View File

@ -39,6 +39,12 @@
vars:
zuul_ansible_version: 6
- job:
name: zuul-stream-functional-8
parent: zuul-stream-functional
vars:
zuul_ansible_version: 8
- job:
name: zuul-nox
description: |
@ -111,16 +117,6 @@
nox_force_python: "3.11"
python_version: "3.11"
- job:
name: zuul-nox-py38
parent: zuul-nox
timeout: 7200 # 120 minutes
vars:
nox_keyword: tests
nox_force_python: "3.8"
python_version: "3.8"
nodeset: ubuntu-focal
- job:
name: zuul-nox-py311-multi-scheduler
parent: zuul-nox-py311
@ -345,7 +341,6 @@
vars:
nox_install_bindep: false
nodeset: ubuntu-jammy
- zuul-nox-py38
- zuul-nox-py311
- zuul-nox-py311-multi-scheduler
- zuul-build-dashboard-openstack-whitelabel
@ -362,6 +357,7 @@
- web/.*
nodeset: ubuntu-jammy
- zuul-stream-functional-6
- zuul-stream-functional-8
- zuul-nox-remote
- zuul-quick-start:
requires: nodepool-container-image
@ -376,7 +372,6 @@
vars:
nox_install_bindep: false
nodeset: ubuntu-jammy
- zuul-nox-py38
- zuul-nox-py311
- zuul-build-dashboard
- nodejs-run-lint:
@ -390,6 +385,7 @@
- web/.*
nodeset: ubuntu-jammy
- zuul-stream-functional-6
- zuul-stream-functional-8
- zuul-nox-remote
- zuul-quick-start:
requires: nodepool-container-image

View File

@ -0,0 +1,6 @@
---
features:
- |
Ansible version 8 is now available. The default Ansible version
is still 6, but version 8 may be selected by using
:attr:`job.ansible-version`.

View File

@ -19,7 +19,8 @@ class CallbackModule(CallbackBase):
test callback
"""
CALLBACK_VERSION = 2.0
CALLBACK_NEEDS_WHITELIST = True
CALLBACK_NEEDS_WHITELIST = True # 6.0
CALLBACK_NEEDS_ENABLED = True # 8.0
# aggregate means we can be loaded and not be the stdout plugin
CALLBACK_TYPE = 'aggregate'
CALLBACK_NAME = 'test_callback'

View File

@ -0,0 +1,7 @@
- tenant:
name: tenant-one
default-ansible-version: '8'
source:
gerrit:
config-projects:
- common-config

View File

@ -29,14 +29,15 @@
# This job is used by a test case specifying a different ansible version in
# fixtures/zuul-default-ansible-version.conf
# TODO: make this something other than the Zuul default once there is
# another version of Ansible available.
# NOTE: make this something other than the Zuul default whenever there
# is more than one version of Ansible available. Update
# zuul-default-ansible-version.conf to match
- job:
name: ansible-default-zuul-conf
parent: ansible-version
vars:
test_ansible_version_major: 2
test_ansible_version_minor: 13
test_ansible_version_minor: 15
- job:
name: ansible-6
@ -46,12 +47,21 @@
test_ansible_version_major: 2
test_ansible_version_minor: 13
- job:
name: ansible-8
parent: ansible-version
ansible-version: 8
vars:
test_ansible_version_major: 2
test_ansible_version_minor: 15
- project:
name: common-config
check:
jobs:
- ansible-default
- ansible-6
- ansible-8
- project:
name: org/project
@ -59,3 +69,4 @@
jobs:
- ansible-default-zuul-conf
- ansible-6
- ansible-8

View File

@ -0,0 +1,11 @@
- tenant:
name: tenant-one
default-ansible-version: '8'
source:
gerrit:
config-projects:
- common-config
untrusted-projects:
- org/project
- bare-role
- org/ansible

View File

@ -0,0 +1,9 @@
- tenant:
name: tenant-one
default-ansible-version: '8'
source:
gerrit:
config-projects:
- common-config
untrusted-projects:
- org/project

View File

@ -122,3 +122,12 @@
label: ubuntu-xenial
ansible-version: '6'
run: playbooks/ansible-version.yaml
- job:
name: ansible-version8-inventory
nodeset:
nodes:
- name: ubuntu-xenial
label: ubuntu-xenial
ansible-version: '8'
run: playbooks/ansible-version.yaml

View File

@ -8,3 +8,4 @@
- group-inventory
- hostvars-inventory
- ansible-version6-inventory
- ansible-version8-inventory

View File

@ -7,7 +7,7 @@ server=127.0.0.1
tenant_config=main.yaml
relative_priority=true
# Used by ansible-default-zuul-conf job
default_ansible_version=6
default_ansible_version=8
[merger]
git_dir=/tmp/zuul-test/merger-git

View File

@ -93,3 +93,11 @@ class TestActionModules6(AnsibleZuulTestCase, FunctionalActionModulesMixIn):
def setUp(self):
super().setUp()
self._setUp()
class TestActionModules8(AnsibleZuulTestCase, FunctionalActionModulesMixIn):
ansible_version = '8'
def setUp(self):
super().setUp()
self._setUp()

View File

@ -150,3 +150,11 @@ class TestZuulJSON6(AnsibleZuulTestCase, FunctionalZuulJSONMixIn):
def setUp(self):
super().setUp()
self._setUp()
class TestZuulJSON8(AnsibleZuulTestCase, FunctionalZuulJSONMixIn):
ansible_version = '8'
def setUp(self):
super().setUp()
self._setUp()

View File

@ -260,3 +260,12 @@ class TestZuulStream6(AnsibleZuulTestCase, FunctionalZuulStreamMixIn):
def setUp(self):
super().setUp()
self._setUp()
class TestZuulStream8(AnsibleZuulTestCase, FunctionalZuulStreamMixIn):
ansible_version = '8'
ansible_core_version = '2.15'
def setUp(self):
super().setUp()
self._setUp()

View File

@ -875,6 +875,11 @@ class TestExecutorFacts6(AnsibleZuulTestCase, ExecutorFactsMixin):
ansible_major_minor = '2.13'
class TestExecutorFacts8(AnsibleZuulTestCase, ExecutorFactsMixin):
tenant_config_file = 'config/executor-facts/main8.yaml'
ansible_major_minor = '2.15'
class AnsibleCallbackConfigsMixin:
config_file = 'zuul-executor-ansible-callback.conf'
@ -933,6 +938,13 @@ class TestAnsibleCallbackConfigs6(AnsibleZuulTestCase,
ansible_major_minor = '2.13'
class TestAnsibleCallbackConfigs8(AnsibleZuulTestCase,
AnsibleCallbackConfigsMixin):
config_file = 'zuul-executor-ansible-callback.conf'
tenant_config_file = 'config/ansible-callbacks/main8.yaml'
ansible_major_minor = '2.15'
class TestExecutorEnvironment(AnsibleZuulTestCase):
tenant_config_file = 'config/zuul-environment-filter/main.yaml'

View File

@ -183,10 +183,12 @@ class TestInventoryShellType(TestInventoryBase):
self.waitUntilSettled()
class TestInventoryAutoPython(TestInventoryBase):
class InventoryAutoPythonMixin:
ansible_version = 'X'
def test_auto_python_ansible6_inventory(self):
inventory = self._get_build_inventory('ansible-version6-inventory')
inventory = self._get_build_inventory(
f'ansible-version{self.ansible_version}-inventory')
all_nodes = ('ubuntu-xenial',)
self.assertIn('all', inventory)
@ -203,13 +205,24 @@ class TestInventoryAutoPython(TestInventoryBase):
self.assertIn('executor', z_vars)
self.assertIn('src_root', z_vars['executor'])
self.assertIn('job', z_vars)
self.assertEqual(z_vars['job'], 'ansible-version6-inventory')
self.assertEqual(z_vars['job'],
f'ansible-version{self.ansible_version}-inventory')
self.assertEqual(z_vars['message'], 'QQ==')
self.executor_server.release()
self.waitUntilSettled()
class TestInventoryAutoPythonAnsible6(TestInventoryBase,
InventoryAutoPythonMixin):
ansible_version = '6'
class TestInventoryAutoPythonAnsible8(TestInventoryBase,
InventoryAutoPythonMixin):
ansible_version = '8'
class TestInventory(TestInventoryBase):
def test_single_inventory(self):

View File

@ -4240,6 +4240,11 @@ class TestAnsible6(AnsibleZuulTestCase, FunctionalAnsibleMixIn):
ansible_major_minor = '2.13'
class TestAnsible8(AnsibleZuulTestCase, FunctionalAnsibleMixIn):
tenant_config_file = 'config/ansible/main8.yaml'
ansible_major_minor = '2.15'
class TestPrePlaybooks(AnsibleZuulTestCase):
# A temporary class to hold new tests while others are disabled
@ -8649,6 +8654,7 @@ class TestAnsibleVersion(AnsibleZuulTestCase):
self.assertHistory([
dict(name='ansible-default', result='SUCCESS', changes='1,1'),
dict(name='ansible-6', result='SUCCESS', changes='1,1'),
dict(name='ansible-8', result='SUCCESS', changes='1,1'),
], ordered=False)
@ -8668,6 +8674,7 @@ class TestDefaultAnsibleVersion(AnsibleZuulTestCase):
dict(name='ansible-default-zuul-conf', result='SUCCESS',
changes='1,1'),
dict(name='ansible-6', result='SUCCESS', changes='1,1'),
dict(name='ansible-8', result='SUCCESS', changes='1,1'),
], ordered=False)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1 @@
../../base/callback/zuul_json.py

View File

@ -0,0 +1 @@
../../base/callback/zuul_stream.py

View File

@ -0,0 +1 @@
../../base/callback/zuul_unreachable.py

View File

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

View File

@ -0,0 +1 @@
../../base/filter/zuul_filters.py

View File

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

View File

@ -0,0 +1 @@
../../base/library/command.py

View File

@ -0,0 +1 @@
../../base/library/zuul_console.py

1
zuul/ansible/8/logconfig.py Symbolic link
View File

@ -0,0 +1 @@
../logconfig.py

1
zuul/ansible/8/paths.py Symbolic link
View File

@ -0,0 +1 @@
../paths.py

View File

@ -2653,7 +2653,10 @@ class AnsibleJob(object):
config.write('internal_poll_interval = 0.01\n')
if self.ansible_callbacks:
config.write('callback_whitelist =\n')
if self.ansible_version == '6':
config.write('callback_whitelist =\n')
else:
config.write('callbacks_enabled =\n')
for callback in self.ansible_callbacks.keys():
config.write(' %s,\n' % callback)

View File

@ -6,3 +6,6 @@ requirements = openstacksdk<0.99 openshift jmespath google-cloud-storage pywinrm
[6]
requirements = ansible>=6.0,<7.0
[8]
requirements = ansible>=8.0,<9.0