refactor(molecule): use docker instead of podman
The scenario now starts its containers with community.docker instead of containers.podman, because docker is the container runtime available on the CI runner. The connection plugin, the login command and the declared collections were adjusted accordingly and the docker SDK for python is installed in the workflow, since the module requires it. Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -24,7 +24,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
apt update --yes
|
apt update --yes
|
||||||
apt install --yes python3-pip
|
apt install --yes python3-pip
|
||||||
pip3 install --break-system-packages molecule
|
pip3 install --break-system-packages molecule docker
|
||||||
- name: Run molecule
|
- name: Run molecule
|
||||||
run: molecule test
|
run: molecule test
|
||||||
working-directory: certificate_authority
|
working-directory: certificate_authority
|
||||||
|
|||||||
@@ -33,16 +33,16 @@ certificate_authority_client_subject_alternative_names:
|
|||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
|
|
||||||
The role is tested with [Molecule](https://ansible.readthedocs.io/projects/molecule/). The scenario starts one podman
|
The role is tested with [Molecule](https://ansible.readthedocs.io/projects/molecule/). The scenario starts one docker
|
||||||
container per supported distribution family, applies the role, asserts that a second run reports no change and finally
|
container per supported distribution family, applies the role, asserts that a second run reports no change and finally
|
||||||
verifies the issued certificates with `openssl verify`, their file permissions and the anchor in the systems trust
|
verifies the issued certificates with `openssl verify`, their file permissions and the anchor in the systems trust
|
||||||
store.
|
store.
|
||||||
|
|
||||||
Molecule ships only its `default` driver, therefore `podman` is required besides molecule itself. The collections are
|
Molecule ships only its `default` driver, therefore `docker` is required besides molecule itself. The collections are
|
||||||
declared in `molecule/default/collections.yml` and installed by molecule.
|
declared in `molecule/default/collections.yml` and installed by molecule.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install molecule
|
pip install molecule docker
|
||||||
```
|
```
|
||||||
|
|
||||||
The complete sequence creates the containers, tests them and removes them afterwards.
|
The complete sequence creates the containers, tests them and removes them afterwards.
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
collections:
|
collections:
|
||||||
- name: community.crypto
|
- name: community.crypto
|
||||||
- name: containers.podman
|
- name: community.docker
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
gather_facts: false
|
gather_facts: false
|
||||||
tasks:
|
tasks:
|
||||||
- name: Start a container per platform
|
- name: Start a container per platform
|
||||||
containers.podman.podman_container:
|
community.docker.docker_container:
|
||||||
name: "{{ item.name }}"
|
name: "{{ item.name }}"
|
||||||
image: "{{ item.image }}"
|
image: "{{ item.image }}"
|
||||||
command: "sleep infinity"
|
command: "sleep infinity"
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
content: |
|
content: |
|
||||||
{% for platform in molecule_yml.platforms %}
|
{% for platform in molecule_yml.platforms %}
|
||||||
- instance: {{ platform.name }}
|
- instance: {{ platform.name }}
|
||||||
connection: containers.podman.podman
|
connection: community.docker.docker
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
dest: "{{ molecule_instance_config }}"
|
dest: "{{ molecule_instance_config }}"
|
||||||
mode: "0600"
|
mode: "0600"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
gather_facts: false
|
gather_facts: false
|
||||||
tasks:
|
tasks:
|
||||||
- name: Remove the container of every platform
|
- name: Remove the container of every platform
|
||||||
containers.podman.podman_container:
|
community.docker.docker_container:
|
||||||
name: "{{ item.name }}"
|
name: "{{ item.name }}"
|
||||||
state: absent
|
state: absent
|
||||||
loop: "{{ molecule_yml.platforms }}"
|
loop: "{{ molecule_yml.platforms }}"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ driver:
|
|||||||
name: default
|
name: default
|
||||||
options:
|
options:
|
||||||
managed: true
|
managed: true
|
||||||
login_cmd_template: "podman exec --interactive --tty {instance} bash"
|
login_cmd_template: "docker exec --interactive --tty {instance} bash"
|
||||||
|
|
||||||
platforms:
|
platforms:
|
||||||
- name: certificate-authority-archlinux
|
- name: certificate-authority-archlinux
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
dnf install --assumeyes ca-certificates gawk openssl python3
|
dnf install --assumeyes ca-certificates gawk openssl python3
|
||||||
fi
|
fi
|
||||||
tasks:
|
tasks:
|
||||||
# The podman connection plugin splits raw commands instead of passing them to a shell.
|
# The raw command is wrapped explicitly, because the bootstrap relies on shell builtins.
|
||||||
- name: Bootstrap the python interpreter and the tools required by the role
|
- name: Bootstrap the python interpreter and the tools required by the role
|
||||||
ansible.builtin.raw: "/bin/sh -c {{ _bootstrap | quote }}"
|
ansible.builtin.raw: "/bin/sh -c {{ _bootstrap | quote }}"
|
||||||
changed_when: true
|
changed_when: true
|
||||||
|
|||||||
+1
-1
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
collections:
|
collections:
|
||||||
- name: community.crypto
|
- name: community.crypto
|
||||||
- name: containers.podman
|
- name: community.docker
|
||||||
|
|||||||
Reference in New Issue
Block a user