Skip to content

Commit

Permalink
Build RL9.3 container images with systemd in CI (#166)
Browse files Browse the repository at this point in the history
* build RL9.3 container images with systemd

* remove old workaround message
  • Loading branch information
sjpb authored Mar 20, 2024
1 parent 7f547d0 commit 4ca4811
Show file tree
Hide file tree
Showing 19 changed files with 108 additions and 75 deletions.
54 changes: 42 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,43 @@ 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:
# Failed to parse bus message: Invalid argument
# when doing `systemctl show slurmd` by switching to an older ubuntu
# release (18.04 from 20.04). We can remove this when we are running a
# systemd version new enough to cope with the extra capabilities that are
# in newer kernel versions.
# 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
Expand All @@ -42,13 +61,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:
Expand Down
19 changes: 10 additions & 9 deletions molecule/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
2 changes: 2 additions & 0 deletions molecule/images/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM rockylinux:9.3
RUN dnf install -y systemd && dnf clean all
6 changes: 3 additions & 3 deletions molecule/test1/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions molecule/test10/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions molecule/test11/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions molecule/test12/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions molecule/test13/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions molecule/test14/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions molecule/test1b/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions molecule/test1c/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions molecule/test2/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Loading

0 comments on commit 4ca4811

Please sign in to comment.