Skip to content

Commit

Permalink
build RL9.3 container images with systemd
Browse files Browse the repository at this point in the history
  • Loading branch information
sjpb committed Mar 19, 2024
1 parent 23ddc82 commit a5709a6
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 30 deletions.
75 changes: 57 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -18,37 +45,49 @@ 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
- test1c
- test2
- test3
# - test1
# - test1b
# - test1c
# - test2
# - test3
- test4
- test5
- test6
- test7
- test8
- test9
- test10
- test11
- test12
- test13
- test14

# - test5
# - test6
# - test7
# - test8
# - test9
# - test10
# - test11
# - 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/test4/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

0 comments on commit a5709a6

Please sign in to comment.