From 810bbec5905e5273b38cccd6f1ac5dd0ac33e76b Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Mon, 6 Jan 2025 11:40:07 +0100 Subject: [PATCH] Add noop molecule job to the integrated repo In order to verify that molecule requirements are satisfied we add a noop molecule scenario that installs requirements and run a noop task. We can expand the scenario in the futute or add new ones, though for now goal is to ensure that updating requirements is not breaking other roles having valid scenarios around. Change-Id: Id0abc217d404af4a08532707e60d738613c9a7ed --- molecule/default/converge.yml | 8 ++++++++ molecule/default/molecule.yml | 28 ++++++++++++++++++++++++++++ tox.ini | 17 +++++++++++++++++ zuul.d/project.yaml | 1 + 4 files changed, 54 insertions(+) create mode 100644 molecule/default/converge.yml create mode 100644 molecule/default/molecule.yml diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml new file mode 100644 index 0000000000..e42907f500 --- /dev/null +++ b/molecule/default/converge.yml @@ -0,0 +1,8 @@ +--- + +- name: Noop converge playbook + hosts: localhost + tasks: + - name: Print out hostname + ansible.builtin.debug: + var: inventory_hostname diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml new file mode 100644 index 0000000000..7dbe369b46 --- /dev/null +++ b/molecule/default/molecule.yml @@ -0,0 +1,28 @@ +--- +dependency: + name: galaxy + options: + requirements-file: ansible-collection-requirements.yml + force: true + +driver: + name: docker + +platforms: + - name: "integrated-${MOLECULE_SCENARIO_NAME}" + image: "${DOCKER_REGISTRY:-quay.io/gotmax23}/${DOCKER_IMAGE_TAG:-debian-systemd:bookworm}" + command: ${DOCKER_COMMAND:-""} + pre_build_image: true + privileged: true + systemd: true + +provisioner: + name: ansible + lint: + name: ansible-lint + config_options: + defaults: + inject_facts_as_vars: false + +scenario: + name: default diff --git a/tox.ini b/tox.ini index 520fa8a77c..3782a138f2 100644 --- a/tox.ini +++ b/tox.ini @@ -158,3 +158,20 @@ commands = {[testenv:ansible-lint]commands} {[testenv:ansible-syntax]commands} {[testenv:inventory]commands} + +[testenv:molecule] +# You can use DOCKER_REGISTRY and DOCKER_IMAGE_TAG to switch between +# tested distros. I.e: +# DOCKER_IMAGE_TAG=ubuntu-systemd:jammy tox -e molecule +deps = + -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} + -rtest-requirements.txt + +commands = + molecule test + +passenv = + {[testenv]passenv} + DOCKER_REGISTRY + DOCKER_IMAGE_TAG + DOCKER_COMMAND diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml index 58d4ac4623..9c401b189d 100644 --- a/zuul.d/project.yaml +++ b/zuul.d/project.yaml @@ -24,6 +24,7 @@ - openstack-ansible-deploy-ceph-jobs - openstack-ansible-deploy-proxy-jobs - openstack-ansible-deploy-stepca-jobs + - openstack-ansible-molecule - check-requirements - publish-openstack-docs-pti - release-notes-jobs-python3