Skip to content

Commit 1ec7759

Browse files
committed
ci(release): bring Fedora RPM canary to parity
The RPM canary needs to exercise the install.sh user-service path, but a GitHub Actions job container does not boot with systemd as PID 1. The Fedora RPM canary needs to exercise the install.sh user-service path, but a GitHub Actions job container does not boot with systemd as PID 1. This means the Fedora RPM canary was incomplete as compared to the others. With this change, we run Fedora as a nested privileged systemd container instead, wait for systemd to become reachable, then start the root user manager so systemctl --user works for the RPM gateway unit, achieving parity with the other canary tests. Signed-off-by: Kris Hicks <khicks@nvidia.com>
1 parent 79aa355 commit 1ec7759

1 file changed

Lines changed: 81 additions & 8 deletions

File tree

.github/workflows/release-canary.yml

Lines changed: 81 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,94 @@ jobs:
5757
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
5858
runs-on: linux-amd64-cpu8
5959
timeout-minutes: 20
60-
container:
61-
image: fedora:latest
62-
options: --privileged
60+
env:
61+
FEDORA_CANARY_CONTAINER: openshell-fedora-canary-${{ github.run_id }}-${{ github.run_attempt }}
62+
INSTALL_SH_REF: ${{ github.event.workflow_run.head_sha || github.sha }}
6363
steps:
64-
- name: Ensure Podman
64+
- name: Start Fedora systemd container and root user manager
65+
run: |
66+
set -euo pipefail
67+
68+
docker run --detach \
69+
--name "${FEDORA_CANARY_CONTAINER}" \
70+
--privileged \
71+
--cgroupns=host \
72+
--tmpfs /run \
73+
--tmpfs /tmp \
74+
--volume /sys/fs/cgroup:/sys/fs/cgroup:rw \
75+
fedora:latest \
76+
bash -lc 'dnf install -y curl dbus-daemon podman systemd && exec /usr/sbin/init'
77+
78+
for _ in $(seq 1 120); do
79+
if docker exec "${FEDORA_CANARY_CONTAINER}" systemctl list-units --no-pager >/dev/null 2>&1; then
80+
break
81+
fi
82+
if [ "$(docker inspect -f '{{.State.Running}}' "${FEDORA_CANARY_CONTAINER}")" != "true" ]; then
83+
echo "::error::Fedora systemd container exited before systemd became reachable"
84+
docker logs "${FEDORA_CANARY_CONTAINER}" >&2 || true
85+
exit 1
86+
fi
87+
sleep 1
88+
done
89+
90+
if ! docker exec "${FEDORA_CANARY_CONTAINER}" systemctl list-units --no-pager >/dev/null 2>&1; then
91+
echo "::error::Fedora systemd container did not become reachable within 120s"
92+
docker logs "${FEDORA_CANARY_CONTAINER}" >&2 || true
93+
exit 1
94+
fi
95+
96+
docker exec --interactive "${FEDORA_CANARY_CONTAINER}" env \
97+
HOME=/root \
98+
XDG_RUNTIME_DIR=/run/user/0 \
99+
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/0/bus \
100+
bash -s <<'EOF'
101+
set -euo pipefail
102+
# install.sh manages the RPM gateway as a systemd user unit. This
103+
# container is booted with systemd as PID 1, but it still has no
104+
# login session. Start root's user manager explicitly so the
105+
# installer can test service restart and gateway registration
106+
# instead of its "restart later" fallback.
107+
mkdir -p "${XDG_RUNTIME_DIR}"
108+
chmod 700 "${XDG_RUNTIME_DIR}"
109+
systemctl start user-runtime-dir@0.service || true
110+
systemctl start user@0.service
111+
112+
for _ in $(seq 1 30); do
113+
if systemctl --user daemon-reload; then
114+
break
115+
fi
116+
sleep 1
117+
done
118+
if ! systemctl --user daemon-reload; then
119+
systemctl status user@0.service --no-pager >&2 || true
120+
journalctl -u user@0.service --no-pager -n 80 >&2 || true
121+
systemctl --user status --no-pager >&2 || true
122+
exit 1
123+
fi
124+
EOF
125+
126+
- name: Install and check status
65127
run: |
66-
dnf install -y curl podman
128+
set -euo pipefail
129+
130+
docker exec --interactive "${FEDORA_CANARY_CONTAINER}" env \
131+
HOME=/root \
132+
XDG_RUNTIME_DIR=/run/user/0 \
133+
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/0/bus \
134+
INSTALL_SH_REF="${INSTALL_SH_REF}" \
135+
bash -s <<'EOF'
136+
set -euo pipefail
67137
mkdir -p "${HOME}/.config/openshell"
68138
printf 'OPENSHELL_DRIVERS=podman\n' > "${HOME}/.config/openshell/gateway.env"
69139
podman info
140+
curl -LsSf "https://raw.githubusercontent.com/NVIDIA/OpenShell/${INSTALL_SH_REF}/install.sh" | sh
141+
openshell status
142+
EOF
70143
71-
- name: Install and check status
144+
- name: Stop Fedora systemd container
145+
if: always()
72146
run: |
73-
curl -LsSf https://raw.githubusercontent.com/NVIDIA/OpenShell/${{ github.event.workflow_run.head_sha || github.sha }}/install.sh | sh
74-
openshell status
147+
docker rm -f "${FEDORA_CANARY_CONTAINER}" >/dev/null 2>&1 || true
75148
76149
ubuntu-snap:
77150
name: Ubuntu Snap

0 commit comments

Comments
 (0)