Skip to content

Commit 59ee7cc

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

File tree

19 files changed

+108
-66
lines changed

19 files changed

+108
-66
lines changed

.github/workflows/ci.yml

+42-3
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,13 +45,14 @@ 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:
2957
- test1
3058
- test1b
@@ -42,13 +70,24 @@ jobs:
4270
- test12
4371
- test13
4472
- test14
45-
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/test1/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

molecule/test10/molecule.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ platforms:
88
groups:
99
- testohpc_login
1010
- initial
11-
command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image
11+
command: /sbin/init
1212
tmpfs:
1313
- /run
1414
- /tmp
@@ -21,7 +21,7 @@ platforms:
2121
groups:
2222
- testohpc_compute
2323
- initial
24-
command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image
24+
command: /sbin/init
2525
tmpfs:
2626
- /run
2727
- /tmp
@@ -34,7 +34,7 @@ platforms:
3434
groups:
3535
- testohpc_compute
3636
- initial
37-
command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image
37+
command: /sbin/init
3838
tmpfs:
3939
- /run
4040
- /tmp
@@ -46,7 +46,7 @@ platforms:
4646
pre_build_image: true
4747
groups: # NB this is NOT in the "testohpc_compute" so that it isn't added to slurm.conf initially
4848
- new
49-
command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image
49+
command: /sbin/init
5050
tmpfs:
5151
- /run
5252
- /tmp

molecule/test11/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
@@ -21,7 +21,7 @@ platforms:
2121
- testohpc_compute
2222
- testohpc_compute_orig
2323
- testohpc_compute_new
24-
command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image
24+
command: /sbin/init
2525
tmpfs:
2626
- /run
2727
- /tmp
@@ -34,7 +34,7 @@ platforms:
3434
groups:
3535
- testohpc_compute
3636
- testohpc_compute_orig
37-
command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image
37+
command: /sbin/init
3838
tmpfs:
3939
- /run
4040
- /tmp

molecule/test12/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

molecule/test13/molecule.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ platforms:
77
pre_build_image: true
88
groups:
99
- testohpc_control
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
@@ -20,7 +20,7 @@ platforms:
2020
pre_build_image: true
2121
groups:
2222
- testohpc_login
23-
command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image
23+
command: /sbin/init
2424
tmpfs:
2525
- /run
2626
- /tmp
@@ -33,7 +33,7 @@ platforms:
3333
pre_build_image: true
3434
groups:
3535
- testohpc_login
36-
command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image
36+
command: /sbin/init
3737
tmpfs:
3838
- /run
3939
- /tmp
@@ -46,7 +46,7 @@ platforms:
4646
pre_build_image: true
4747
groups:
4848
- testohpc_compute
49-
command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image
49+
command: /sbin/init
5050
tmpfs:
5151
- /run
5252
- /tmp
@@ -58,7 +58,7 @@ platforms:
5858
pre_build_image: true
5959
groups:
6060
- testohpc_compute
61-
command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image
61+
command: /sbin/init
6262
tmpfs:
6363
- /run
6464
- /tmp

molecule/test14/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

molecule/test1b/molecule.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ platforms:
99
pre_build_image: true
1010
groups:
1111
- testohpc_login
12-
command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image
12+
command: /sbin/init
1313
tmpfs:
1414
- /run
1515
- /tmp
@@ -21,7 +21,7 @@ platforms:
2121
pre_build_image: true
2222
groups:
2323
- testohpc_compute
24-
command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image
24+
command: /sbin/init
2525
tmpfs:
2626
- /run
2727
- /tmp

molecule/test1c/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

molecule/test2/molecule.yml

+5-5
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
@@ -20,7 +20,7 @@ platforms:
2020
groups:
2121
- testohpc_compute
2222
- testohpc_part1
23-
command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image
23+
command: /sbin/init
2424
tmpfs:
2525
- /run
2626
- /tmp
@@ -33,7 +33,7 @@ platforms:
3333
groups:
3434
- testohpc_compute
3535
- testohpc_part1
36-
command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image
36+
command: /sbin/init
3737
tmpfs:
3838
- /run
3939
- /tmp
@@ -46,7 +46,7 @@ platforms:
4646
groups:
4747
- testohpc_compute
4848
- testohpc_part2
49-
command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image
49+
command: /sbin/init
5050
tmpfs:
5151
- /run
5252
- /tmp
@@ -59,7 +59,7 @@ platforms:
5959
groups:
6060
- testohpc_compute
6161
- testohpc_part2
62-
command: "/bin/bash -c 'dnf -y install systemd && /sbin/init'" # not in RL9 image
62+
command: /sbin/init
6363
tmpfs:
6464
- /run
6565
- /tmp

0 commit comments

Comments
 (0)