From a27bb25479e4916eb6a28763fb9b6a8fe65c972d Mon Sep 17 00:00:00 2001 From: Troy W Date: Sun, 9 Jun 2024 00:38:19 -0400 Subject: [PATCH 1/3] Fixed Molecule (#1282) Work contributed by @jon4hz --- .github/workflows/proxy.yml | 6 +++--- molecule/zabbix_proxy/Dockerfile.redhat.j2 | 3 --- molecule/zabbix_proxy/destroy.yml | 23 ---------------------- molecule/zabbix_proxy/molecule.yml | 7 +++---- 4 files changed, 6 insertions(+), 33 deletions(-) delete mode 100644 molecule/zabbix_proxy/Dockerfile.redhat.j2 delete mode 100644 molecule/zabbix_proxy/destroy.yml diff --git a/.github/workflows/proxy.yml b/.github/workflows/proxy.yml index 8579e2e28..c77294fbc 100644 --- a/.github/workflows/proxy.yml +++ b/.github/workflows/proxy.yml @@ -76,9 +76,9 @@ jobs: - name: Run role tests run: >- - MY_MOLECULE_CONTAINER=${{ matrix.container.name }} - MY_MOLECULE_IMAGE=${{ matrix.container.base_image }} - MY_MOLECULE_OS_FAMILY=${{ matrix.container.os_family }} + MY_MOLECULE_CONTAINER=${{ matrix.container }} + MY_MOLECULE_IMAGE=${{ matrix.container }} MY_MOLECULE_VERSION=${{ matrix.version }} MY_MOLECULE_DATABASE=${{ matrix.database }} + MY_MOLECULE_DOCKER_COMMAND=${{ matrix.command }} molecule test -s ${{ matrix.collection_role }} diff --git a/molecule/zabbix_proxy/Dockerfile.redhat.j2 b/molecule/zabbix_proxy/Dockerfile.redhat.j2 deleted file mode 100644 index dd48ee3b7..000000000 --- a/molecule/zabbix_proxy/Dockerfile.redhat.j2 +++ /dev/null @@ -1,3 +0,0 @@ -FROM {{ item.base_image }} -RUN yum install -y python3-pip -CMD ["/sbin/init"] diff --git a/molecule/zabbix_proxy/destroy.yml b/molecule/zabbix_proxy/destroy.yml deleted file mode 100644 index 7ef374be5..000000000 --- a/molecule/zabbix_proxy/destroy.yml +++ /dev/null @@ -1,23 +0,0 @@ ---- -- name: Destroy - hosts: localhost - connection: local - gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" - vars: - molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}" - molecule_yml: "{{ lookup('file', molecule_file) | from_yaml }}" - tasks: - - name: Destroy molecule instance(s) - docker_container: - name: "{{ item.name }}" - state: absent - force_kill: "{{ item.force_kill | default(True) }}" - with_items: "{{ molecule_yml.platforms }}" - - - name: Destroy 3rd party instance(s) - docker_container: - name: "{{ item.name }}-db" - state: absent - force_kill: true - loop: "{{ molecule_yml.platforms }}" diff --git a/molecule/zabbix_proxy/molecule.yml b/molecule/zabbix_proxy/molecule.yml index 8c7b3df48..ac0d7e33c 100644 --- a/molecule/zabbix_proxy/molecule.yml +++ b/molecule/zabbix_proxy/molecule.yml @@ -3,11 +3,10 @@ driver: name: docker platforms: - name: zabbix-proxy-${MY_MOLECULE_VERSION:-v70}-${MY_MOLECULE_DATABASE:-mysql}-${MY_MOLECULE_CONTAINER:-rockylinux8} - dockerfile: Dockerfile.${MY_MOLECULE_OS_FAMILY:-redhat}.j2 - base_image: ${MY_MOLECULE_IMAGE:-rockylinux/rockylinux:8-ubi-init} - image: ${MY_MOLECULE_CONTAINER:-rockylinux8} + image: geerlingguy/docker-${MY_MOLECULE_IMAGE:-rockylinux8}-ansible:latest privileged: true - command: /sbin/init + pre_build_image: true + command: ${MOLECULE_DOCKER_COMMAND:-""} networks: - name: zabbix volumes: From 6e000c793eaf46d52de6fd6da3909e0d8ed12e6d Mon Sep 17 00:00:00 2001 From: Troy W Date: Sun, 9 Jun 2024 00:53:18 -0400 Subject: [PATCH 2/3] Revert "Fixed Molecule (#1282)" (#1283) This reverts commit a27bb25479e4916eb6a28763fb9b6a8fe65c972d. --- .github/workflows/proxy.yml | 6 +++--- molecule/zabbix_proxy/Dockerfile.redhat.j2 | 3 +++ molecule/zabbix_proxy/destroy.yml | 23 ++++++++++++++++++++++ molecule/zabbix_proxy/molecule.yml | 7 ++++--- 4 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 molecule/zabbix_proxy/Dockerfile.redhat.j2 create mode 100644 molecule/zabbix_proxy/destroy.yml diff --git a/.github/workflows/proxy.yml b/.github/workflows/proxy.yml index c77294fbc..8579e2e28 100644 --- a/.github/workflows/proxy.yml +++ b/.github/workflows/proxy.yml @@ -76,9 +76,9 @@ jobs: - name: Run role tests run: >- - MY_MOLECULE_CONTAINER=${{ matrix.container }} - MY_MOLECULE_IMAGE=${{ matrix.container }} + MY_MOLECULE_CONTAINER=${{ matrix.container.name }} + MY_MOLECULE_IMAGE=${{ matrix.container.base_image }} + MY_MOLECULE_OS_FAMILY=${{ matrix.container.os_family }} MY_MOLECULE_VERSION=${{ matrix.version }} MY_MOLECULE_DATABASE=${{ matrix.database }} - MY_MOLECULE_DOCKER_COMMAND=${{ matrix.command }} molecule test -s ${{ matrix.collection_role }} diff --git a/molecule/zabbix_proxy/Dockerfile.redhat.j2 b/molecule/zabbix_proxy/Dockerfile.redhat.j2 new file mode 100644 index 000000000..dd48ee3b7 --- /dev/null +++ b/molecule/zabbix_proxy/Dockerfile.redhat.j2 @@ -0,0 +1,3 @@ +FROM {{ item.base_image }} +RUN yum install -y python3-pip +CMD ["/sbin/init"] diff --git a/molecule/zabbix_proxy/destroy.yml b/molecule/zabbix_proxy/destroy.yml new file mode 100644 index 000000000..7ef374be5 --- /dev/null +++ b/molecule/zabbix_proxy/destroy.yml @@ -0,0 +1,23 @@ +--- +- name: Destroy + hosts: localhost + connection: local + gather_facts: false + no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + vars: + molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}" + molecule_yml: "{{ lookup('file', molecule_file) | from_yaml }}" + tasks: + - name: Destroy molecule instance(s) + docker_container: + name: "{{ item.name }}" + state: absent + force_kill: "{{ item.force_kill | default(True) }}" + with_items: "{{ molecule_yml.platforms }}" + + - name: Destroy 3rd party instance(s) + docker_container: + name: "{{ item.name }}-db" + state: absent + force_kill: true + loop: "{{ molecule_yml.platforms }}" diff --git a/molecule/zabbix_proxy/molecule.yml b/molecule/zabbix_proxy/molecule.yml index ac0d7e33c..8c7b3df48 100644 --- a/molecule/zabbix_proxy/molecule.yml +++ b/molecule/zabbix_proxy/molecule.yml @@ -3,10 +3,11 @@ driver: name: docker platforms: - name: zabbix-proxy-${MY_MOLECULE_VERSION:-v70}-${MY_MOLECULE_DATABASE:-mysql}-${MY_MOLECULE_CONTAINER:-rockylinux8} - image: geerlingguy/docker-${MY_MOLECULE_IMAGE:-rockylinux8}-ansible:latest + dockerfile: Dockerfile.${MY_MOLECULE_OS_FAMILY:-redhat}.j2 + base_image: ${MY_MOLECULE_IMAGE:-rockylinux/rockylinux:8-ubi-init} + image: ${MY_MOLECULE_CONTAINER:-rockylinux8} privileged: true - pre_build_image: true - command: ${MOLECULE_DOCKER_COMMAND:-""} + command: /sbin/init networks: - name: zabbix volumes: From 825d112b16a86c29c7c6143d716f5f7fb96162be Mon Sep 17 00:00:00 2001 From: Troy W Date: Sun, 9 Jun 2024 01:03:01 -0400 Subject: [PATCH 3/3] Fixed Molecule Testing Correctly (#1284) --- .github/workflows/proxy.yml | 6 +++--- molecule/zabbix_proxy/Dockerfile.debian.j2 | 3 --- molecule/zabbix_proxy/Dockerfile.redhat.j2 | 3 --- molecule/zabbix_proxy/molecule.yml | 7 +++---- 4 files changed, 6 insertions(+), 13 deletions(-) delete mode 100644 molecule/zabbix_proxy/Dockerfile.debian.j2 delete mode 100644 molecule/zabbix_proxy/Dockerfile.redhat.j2 diff --git a/.github/workflows/proxy.yml b/.github/workflows/proxy.yml index 8579e2e28..c77294fbc 100644 --- a/.github/workflows/proxy.yml +++ b/.github/workflows/proxy.yml @@ -76,9 +76,9 @@ jobs: - name: Run role tests run: >- - MY_MOLECULE_CONTAINER=${{ matrix.container.name }} - MY_MOLECULE_IMAGE=${{ matrix.container.base_image }} - MY_MOLECULE_OS_FAMILY=${{ matrix.container.os_family }} + MY_MOLECULE_CONTAINER=${{ matrix.container }} + MY_MOLECULE_IMAGE=${{ matrix.container }} MY_MOLECULE_VERSION=${{ matrix.version }} MY_MOLECULE_DATABASE=${{ matrix.database }} + MY_MOLECULE_DOCKER_COMMAND=${{ matrix.command }} molecule test -s ${{ matrix.collection_role }} diff --git a/molecule/zabbix_proxy/Dockerfile.debian.j2 b/molecule/zabbix_proxy/Dockerfile.debian.j2 deleted file mode 100644 index b3d90f2a5..000000000 --- a/molecule/zabbix_proxy/Dockerfile.debian.j2 +++ /dev/null @@ -1,3 +0,0 @@ -FROM {{ item.base_image }} -RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y python3-pip systemd-sysv -CMD ["/sbin/init"] diff --git a/molecule/zabbix_proxy/Dockerfile.redhat.j2 b/molecule/zabbix_proxy/Dockerfile.redhat.j2 deleted file mode 100644 index dd48ee3b7..000000000 --- a/molecule/zabbix_proxy/Dockerfile.redhat.j2 +++ /dev/null @@ -1,3 +0,0 @@ -FROM {{ item.base_image }} -RUN yum install -y python3-pip -CMD ["/sbin/init"] diff --git a/molecule/zabbix_proxy/molecule.yml b/molecule/zabbix_proxy/molecule.yml index 8c7b3df48..ac0d7e33c 100644 --- a/molecule/zabbix_proxy/molecule.yml +++ b/molecule/zabbix_proxy/molecule.yml @@ -3,11 +3,10 @@ driver: name: docker platforms: - name: zabbix-proxy-${MY_MOLECULE_VERSION:-v70}-${MY_MOLECULE_DATABASE:-mysql}-${MY_MOLECULE_CONTAINER:-rockylinux8} - dockerfile: Dockerfile.${MY_MOLECULE_OS_FAMILY:-redhat}.j2 - base_image: ${MY_MOLECULE_IMAGE:-rockylinux/rockylinux:8-ubi-init} - image: ${MY_MOLECULE_CONTAINER:-rockylinux8} + image: geerlingguy/docker-${MY_MOLECULE_IMAGE:-rockylinux8}-ansible:latest privileged: true - command: /sbin/init + pre_build_image: true + command: ${MOLECULE_DOCKER_COMMAND:-""} networks: - name: zabbix volumes: