Skip to content

Commit a5709a6

Browse files
committed
build RL9.3 container images with systemd
1 parent 23ddc82 commit a5709a6

File tree

4 files changed

+72
-30
lines changed

4 files changed

+72
-30
lines changed

.github/workflows/ci.yml

+57-18
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,33 @@ name: CI
77
- master
88

99
jobs:
10+
build:
11+
name: Build Rocky9 container image
12+
# Upstream rockylinux:9.3 images don't contain systemd, which means /sbin/init fails.
13+
# A workaround of using "/bin/bash -c 'dnf -y install systemd && /sbin/init'"
14+
# as the container command is flaky.
15+
# This job builds an image using the upstream rockylinux:9.3 image which ensures
16+
# that the image used for the molecule workflow is always updated.
17+
runs-on: ubuntu-22.04
18+
defaults:
19+
run:
20+
working-directory: molecule/images
21+
steps:
22+
- name: Check out the codebase.
23+
uses: actions/checkout@v4
24+
25+
- name: Build image
26+
run: podman build -t rocky93systemd:latest .
27+
28+
- name: Save image
29+
run: podman save --output rocky93systemd.docker rocky93systemd:latest
30+
31+
- name: Upload rocky9 image
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: rocky93systemd
35+
path: molecule/images/rocky93systemd.docker
36+
1037
molecule:
1138
name: Molecule
1239
# Workaround: systemd/kernel compatibility issue:
@@ -18,37 +45,49 @@ jobs:
1845
# See:
1946
# - https://bugzilla.redhat.com/show_bug.cgi?id=190144
2047
# - https://github.com/systemd/systemd/pull/16424
21-
runs-on: ubuntu-20.04
48+
runs-on: ubuntu-22.04
49+
needs: build
2250
strategy:
2351
fail-fast: false
2452
matrix:
2553
image:
2654
- 'rockylinux:8.9'
27-
- 'rockylinux:9.3'
55+
- 'localhost/rocky93systemd'
2856
scenario:
29-
- test1
30-
- test1b
31-
- test1c
32-
- test2
33-
- test3
57+
# - test1
58+
# - test1b
59+
# - test1c
60+
# - test2
61+
# - test3
3462
- test4
35-
- test5
36-
- test6
37-
- test7
38-
- test8
39-
- test9
40-
- test10
41-
- test11
42-
- test12
43-
- test13
44-
- test14
45-
63+
# - test5
64+
# - test6
65+
# - test7
66+
# - test8
67+
# - test9
68+
# - test10
69+
# - test11
70+
# - test12
71+
# - test13
72+
# - test14
4673
exclude: []
4774

4875
steps:
4976
- name: Check out the codebase.
5077
uses: actions/checkout@v4
5178

79+
- name: Download rocky9 container image
80+
uses: actions/download-artifact@v4
81+
with:
82+
name: rocky93systemd
83+
path: molecule/images/rocky93systemd.docker
84+
if: matrix.image == 'localhost/rocky93systemd'
85+
86+
- name: Load rocky9 container image
87+
run: podman load --input rocky93systemd.docker/rocky93systemd.docker
88+
working-directory: molecule/images
89+
if: matrix.image == 'localhost/rocky93systemd'
90+
5291
- name: Set up Python 3.
5392
uses: actions/setup-python@v4
5493
with:

molecule/README.md

+10-9
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,18 @@ Local installation on a RockyLinux 8.x machine looks like:
3939
pip install -r molecule/requirements.txt
4040
ansible-galaxy collection install containers.podman:>=1.10.1
4141

42-
Then to run tests, e.g.::
42+
Build a RockyLinux 9.3 image with systemd included:
4343

44-
cd ansible-role-openhpc/
45-
MOLECULE_IMAGE=rockylinux:8.9 molecule test --all
46-
47-
During development you may want to:
44+
cd ansible-role-openhpc/molecule/images
45+
podman build -t rocky93systemd:latest .
4846

49-
- See some debugging information by prepending:
47+
Run tests, e.g.:
5048

51-
MOLECULE_NO_LOG="false" ...
49+
cd ansible-role-openhpc/
50+
MOLECULE_NO_LOG="false" MOLECULE_IMAGE=rockylinux:8.9 molecule test --all
5251

53-
- Prevent destroying insstances using:
52+
where the image may be `rockylinux:8.9` or `localhost/rocky93systemd`.
5453

55-
molecule test --destroy never
54+
Other useful options during development:
55+
- Prevent destroying instances by using `molecule test --destroy never`
56+
- Run only a single test using e.g. `molecule test --scenario test5`

molecule/images/Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM rockylinux:9.3
2+
RUN dnf install -y systemd && dnf clean all

molecule/test4/molecule.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ platforms:
77
pre_build_image: true
88
groups:
99
- testohpc_login
10-
command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image
10+
command: /sbin/init
1111
tmpfs:
1212
- /run
1313
- /tmp
@@ -19,7 +19,7 @@ platforms:
1919
pre_build_image: true
2020
groups:
2121
- testohpc_compute
22-
command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image
22+
command: /sbin/init
2323
tmpfs:
2424
- /run
2525
- /tmp
@@ -31,7 +31,7 @@ platforms:
3131
pre_build_image: true
3232
groups:
3333
- testohpc_compute
34-
command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image
34+
command: /sbin/init
3535
tmpfs:
3636
- /run
3737
- /tmp

0 commit comments

Comments
 (0)