diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ab02fc..2ab7596 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,33 @@ name: CI - master jobs: + build: + name: Build Rocky9 container image + # Upstream rockylinux:9.3 images don't contain systemd, which means /sbin/init fails. + # A workaround of using "/bin/bash -c 'dnf -y install systemd && /sbin/init'" + # as the container command is flaky. + # This job builds an image using the upstream rockylinux:9.3 image which ensures + # that the image used for the molecule workflow is always updated. + runs-on: ubuntu-22.04 + defaults: + run: + working-directory: molecule/images + steps: + - name: Check out the codebase. + uses: actions/checkout@v4 + + - name: Build image + run: podman build -t rocky93systemd:latest . + + - name: Save image + run: podman save --output rocky93systemd.docker rocky93systemd:latest + + - name: Upload rocky9 image + uses: actions/upload-artifact@v4 + with: + name: rocky93systemd + path: molecule/images/rocky93systemd.docker + molecule: name: Molecule # Workaround: systemd/kernel compatibility issue: @@ -18,13 +45,14 @@ jobs: # See: # - https://bugzilla.redhat.com/show_bug.cgi?id=190144 # - https://github.com/systemd/systemd/pull/16424 - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 + needs: build strategy: fail-fast: false matrix: image: - 'rockylinux:8.9' - - 'rockylinux:9.3' + - 'localhost/rocky93systemd' scenario: - test1 - test1b @@ -42,13 +70,24 @@ jobs: - test12 - test13 - test14 - exclude: [] steps: - name: Check out the codebase. uses: actions/checkout@v4 + - name: Download rocky9 container image + uses: actions/download-artifact@v4 + with: + name: rocky93systemd + path: molecule/images/rocky93systemd.docker + if: matrix.image == 'localhost/rocky93systemd' + + - name: Load rocky9 container image + run: podman load --input rocky93systemd.docker/rocky93systemd.docker + working-directory: molecule/images + if: matrix.image == 'localhost/rocky93systemd' + - name: Set up Python 3. uses: actions/setup-python@v4 with: diff --git a/molecule/README.md b/molecule/README.md index 9fed9a6..16126cb 100644 --- a/molecule/README.md +++ b/molecule/README.md @@ -39,17 +39,18 @@ Local installation on a RockyLinux 8.x machine looks like: pip install -r molecule/requirements.txt ansible-galaxy collection install containers.podman:>=1.10.1 -Then to run tests, e.g.:: +Build a RockyLinux 9.3 image with systemd included: - cd ansible-role-openhpc/ - MOLECULE_IMAGE=rockylinux:8.9 molecule test --all - -During development you may want to: + cd ansible-role-openhpc/molecule/images + podman build -t rocky93systemd:latest . -- See some debugging information by prepending: +Run tests, e.g.: - MOLECULE_NO_LOG="false" ... + cd ansible-role-openhpc/ + MOLECULE_NO_LOG="false" MOLECULE_IMAGE=rockylinux:8.9 molecule test --all -- Prevent destroying insstances using: +where the image may be `rockylinux:8.9` or `localhost/rocky93systemd`. - molecule test --destroy never +Other useful options during development: +- Prevent destroying instances by using `molecule test --destroy never` +- Run only a single test using e.g. `molecule test --scenario test5` diff --git a/molecule/images/Dockerfile b/molecule/images/Dockerfile new file mode 100644 index 0000000..ba6f78b --- /dev/null +++ b/molecule/images/Dockerfile @@ -0,0 +1,2 @@ +FROM rockylinux:9.3 +RUN dnf install -y systemd && dnf clean all diff --git a/molecule/test1/molecule.yml b/molecule/test1/molecule.yml index 838d009..29d30ca 100644 --- a/molecule/test1/molecule.yml +++ b/molecule/test1/molecule.yml @@ -7,7 +7,7 @@ platforms: pre_build_image: true groups: - testohpc_login - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -19,7 +19,7 @@ platforms: pre_build_image: true groups: - testohpc_compute - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -31,7 +31,7 @@ platforms: pre_build_image: true groups: - testohpc_compute - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp diff --git a/molecule/test10/molecule.yml b/molecule/test10/molecule.yml index 40f305c..9601f63 100644 --- a/molecule/test10/molecule.yml +++ b/molecule/test10/molecule.yml @@ -8,7 +8,7 @@ platforms: groups: - testohpc_login - initial - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -21,7 +21,7 @@ platforms: groups: - testohpc_compute - initial - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -34,7 +34,7 @@ platforms: groups: - testohpc_compute - initial - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -46,7 +46,7 @@ platforms: pre_build_image: true groups: # NB this is NOT in the "testohpc_compute" so that it isn't added to slurm.conf initially - new - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp diff --git a/molecule/test11/molecule.yml b/molecule/test11/molecule.yml index e6abf9b..de2f7a6 100644 --- a/molecule/test11/molecule.yml +++ b/molecule/test11/molecule.yml @@ -7,7 +7,7 @@ platforms: pre_build_image: true groups: - testohpc_login - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -21,7 +21,7 @@ platforms: - testohpc_compute - testohpc_compute_orig - testohpc_compute_new - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -34,7 +34,7 @@ platforms: groups: - testohpc_compute - testohpc_compute_orig - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp diff --git a/molecule/test12/molecule.yml b/molecule/test12/molecule.yml index 838d009..29d30ca 100644 --- a/molecule/test12/molecule.yml +++ b/molecule/test12/molecule.yml @@ -7,7 +7,7 @@ platforms: pre_build_image: true groups: - testohpc_login - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -19,7 +19,7 @@ platforms: pre_build_image: true groups: - testohpc_compute - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -31,7 +31,7 @@ platforms: pre_build_image: true groups: - testohpc_compute - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp diff --git a/molecule/test13/molecule.yml b/molecule/test13/molecule.yml index 3faf9e5..a64acf2 100644 --- a/molecule/test13/molecule.yml +++ b/molecule/test13/molecule.yml @@ -7,7 +7,7 @@ platforms: pre_build_image: true groups: - testohpc_control - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -20,7 +20,7 @@ platforms: pre_build_image: true groups: - testohpc_login - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -33,7 +33,7 @@ platforms: pre_build_image: true groups: - testohpc_login - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -46,7 +46,7 @@ platforms: pre_build_image: true groups: - testohpc_compute - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -58,7 +58,7 @@ platforms: pre_build_image: true groups: - testohpc_compute - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp diff --git a/molecule/test14/molecule.yml b/molecule/test14/molecule.yml index 838d009..29d30ca 100644 --- a/molecule/test14/molecule.yml +++ b/molecule/test14/molecule.yml @@ -7,7 +7,7 @@ platforms: pre_build_image: true groups: - testohpc_login - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -19,7 +19,7 @@ platforms: pre_build_image: true groups: - testohpc_compute - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -31,7 +31,7 @@ platforms: pre_build_image: true groups: - testohpc_compute - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp diff --git a/molecule/test1b/molecule.yml b/molecule/test1b/molecule.yml index d1cbb4a..369a533 100644 --- a/molecule/test1b/molecule.yml +++ b/molecule/test1b/molecule.yml @@ -9,7 +9,7 @@ platforms: pre_build_image: true groups: - testohpc_login - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -21,7 +21,7 @@ platforms: pre_build_image: true groups: - testohpc_compute - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp diff --git a/molecule/test1c/molecule.yml b/molecule/test1c/molecule.yml index 1e992a3..f6759fc 100644 --- a/molecule/test1c/molecule.yml +++ b/molecule/test1c/molecule.yml @@ -7,7 +7,7 @@ platforms: pre_build_image: true groups: - testohpc_login - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -19,7 +19,7 @@ platforms: pre_build_image: true groups: - testohpc_compute - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -31,7 +31,7 @@ platforms: pre_build_image: true groups: - testohpc_compute - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp diff --git a/molecule/test2/molecule.yml b/molecule/test2/molecule.yml index f0d8820..cef6d49 100644 --- a/molecule/test2/molecule.yml +++ b/molecule/test2/molecule.yml @@ -7,7 +7,7 @@ platforms: pre_build_image: true groups: - testohpc_login - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -20,7 +20,7 @@ platforms: groups: - testohpc_compute - testohpc_part1 - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -33,7 +33,7 @@ platforms: groups: - testohpc_compute - testohpc_part1 - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -46,7 +46,7 @@ platforms: groups: - testohpc_compute - testohpc_part2 - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -59,7 +59,7 @@ platforms: groups: - testohpc_compute - testohpc_part2 - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp diff --git a/molecule/test3/molecule.yml b/molecule/test3/molecule.yml index 42d1037..1e2868c 100644 --- a/molecule/test3/molecule.yml +++ b/molecule/test3/molecule.yml @@ -7,7 +7,7 @@ platforms: pre_build_image: true groups: - testohpc_login - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -20,7 +20,7 @@ platforms: groups: - testohpc_compute - testohpc_grp1 - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -33,7 +33,7 @@ platforms: groups: - testohpc_compute - testohpc_grp1 - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -46,7 +46,7 @@ platforms: groups: - testohpc_compute - testohpc_grp2 - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -59,7 +59,7 @@ platforms: groups: - testohpc_compute - testohpc_grp2 - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp diff --git a/molecule/test4/molecule.yml b/molecule/test4/molecule.yml index 838d009..29d30ca 100644 --- a/molecule/test4/molecule.yml +++ b/molecule/test4/molecule.yml @@ -7,7 +7,7 @@ platforms: pre_build_image: true groups: - testohpc_login - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -19,7 +19,7 @@ platforms: pre_build_image: true groups: - testohpc_compute - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -31,7 +31,7 @@ platforms: pre_build_image: true groups: - testohpc_compute - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp diff --git a/molecule/test5/molecule.yml b/molecule/test5/molecule.yml index 838d009..29d30ca 100644 --- a/molecule/test5/molecule.yml +++ b/molecule/test5/molecule.yml @@ -7,7 +7,7 @@ platforms: pre_build_image: true groups: - testohpc_login - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -19,7 +19,7 @@ platforms: pre_build_image: true groups: - testohpc_compute - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -31,7 +31,7 @@ platforms: pre_build_image: true groups: - testohpc_compute - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp diff --git a/molecule/test6/molecule.yml b/molecule/test6/molecule.yml index d80f580..b7c0c50 100644 --- a/molecule/test6/molecule.yml +++ b/molecule/test6/molecule.yml @@ -7,7 +7,7 @@ platforms: pre_build_image: true groups: - testohpc_login - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp diff --git a/molecule/test7/molecule.yml b/molecule/test7/molecule.yml index 2539406..5b6d4c6 100644 --- a/molecule/test7/molecule.yml +++ b/molecule/test7/molecule.yml @@ -7,7 +7,7 @@ platforms: pre_build_image: true groups: - testohpc_compute - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp diff --git a/molecule/test8/molecule.yml b/molecule/test8/molecule.yml index 3faf9e5..a64acf2 100644 --- a/molecule/test8/molecule.yml +++ b/molecule/test8/molecule.yml @@ -7,7 +7,7 @@ platforms: pre_build_image: true groups: - testohpc_control - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -20,7 +20,7 @@ platforms: pre_build_image: true groups: - testohpc_login - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -33,7 +33,7 @@ platforms: pre_build_image: true groups: - testohpc_login - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -46,7 +46,7 @@ platforms: pre_build_image: true groups: - testohpc_compute - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -58,7 +58,7 @@ platforms: pre_build_image: true groups: - testohpc_compute - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp diff --git a/molecule/test9/molecule.yml b/molecule/test9/molecule.yml index 77f04bd..15742c0 100644 --- a/molecule/test9/molecule.yml +++ b/molecule/test9/molecule.yml @@ -7,7 +7,7 @@ platforms: pre_build_image: true groups: - testohpc_control - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -20,7 +20,7 @@ platforms: pre_build_image: true groups: - testohpc_login - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -33,7 +33,7 @@ platforms: pre_build_image: true groups: - testohpc_login - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -46,7 +46,7 @@ platforms: pre_build_image: true groups: - testohpc_compute - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp @@ -58,7 +58,7 @@ platforms: pre_build_image: true groups: - testohpc_compute - command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image + command: /sbin/init tmpfs: - /run - /tmp