diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 79cbc6e2..80598740 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -269,12 +269,43 @@ jobs: run: python3 scripts/smoke-service-unit.py target/x86_64-unknown-linux-musl/release/strata-next - name: Native installer with actual isolated systemd user service run: | - uid=$(id -u) - sudo systemctl start "user@$uid.service" - export XDG_RUNTIME_DIR="/run/user/$uid" - export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus" - python3 scripts/smoke-service-unit.py target/x86_64-unknown-linux-musl/release/strata-next --lifecycle - python3 scripts/smoke-native-switch.py target/x86_64-unknown-linux-musl/release/strata-next + image="leleka-systemd-smoke:${GITHUB_RUN_ID}" + container="leleka-systemd-smoke-${GITHUB_RUN_ID}" + cleanup() { + docker rm --force "$container" >/dev/null 2>&1 || true + docker image rm "$image" >/dev/null 2>&1 || true + } + trap cleanup EXIT + docker build --file deploy/Dockerfile.systemd-smoke --tag "$image" . + docker run --detach --privileged --cgroupns=private --name "$container" \ + --tmpfs /run --tmpfs /run/lock \ + --stop-signal SIGRTMIN+3 "$image" + for attempt in $(seq 1 30); do + if docker exec "$container" systemctl show-environment >/dev/null 2>&1; then break; fi + test "$attempt" -lt 30 || { docker logs "$container"; exit 1; } + sleep 1 + done + uid=1000 + docker exec "$container" systemctl start "user@$uid.service" + for attempt in $(seq 1 30); do + if docker exec "$container" test -S "/run/user/$uid/bus"; then break; fi + test "$attempt" -lt 30 || { docker logs "$container"; exit 1; } + sleep 1 + done + docker cp target/x86_64-unknown-linux-musl/release/strata-next "$container:/tmp/strata-next" + docker cp scripts/smoke-service-unit.py "$container:/tmp/smoke-service-unit.py" + docker cp scripts/smoke-native-switch.py "$container:/tmp/smoke-native-switch.py" + docker cp scripts/smoke-worker-cancel.py "$container:/tmp/smoke-worker-cancel.py" + docker exec --user "$uid" \ + --env HOME=/home/leleka \ + --env XDG_RUNTIME_DIR="/run/user/$uid" \ + --env DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$uid/bus" \ + "$container" python3 /tmp/smoke-service-unit.py /tmp/strata-next --lifecycle + docker exec --user "$uid" \ + --env HOME=/home/leleka \ + --env XDG_RUNTIME_DIR="/run/user/$uid" \ + --env DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$uid/bus" \ + "$container" python3 /tmp/smoke-native-switch.py /tmp/strata-next - name: Native deployment configuration without worker launch run: python3 scripts/smoke-config-check.py target/x86_64-unknown-linux-musl/release/strata-next - name: Native deployment readiness deadline without GPU diff --git a/deploy/Dockerfile.static-cli b/deploy/Dockerfile.static-cli index 68182dd7..d36d96b1 100644 --- a/deploy/Dockerfile.static-cli +++ b/deploy/Dockerfile.static-cli @@ -19,5 +19,5 @@ RUN cargo build --manifest-path control-plane/Cargo.toml --locked --release \ FROM scratch ARG RUST_TARGET=x86_64-unknown-linux-musl -COPY --from=build /src/control-plane/target/${RUST_TARGET}/release/strata-next /strata-next +COPY --from=build /src/target/${RUST_TARGET}/release/strata-next /strata-next ENTRYPOINT ["/strata-next"] diff --git a/deploy/Dockerfile.systemd-smoke b/deploy/Dockerfile.systemd-smoke new file mode 100644 index 00000000..4f3d4925 --- /dev/null +++ b/deploy/Dockerfile.systemd-smoke @@ -0,0 +1,12 @@ +FROM debian:bookworm-slim + +ENV container=docker + +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install --yes --no-install-recommends \ + dbus-user-session python3 systemd systemd-sysv util-linux \ + && useradd --create-home --uid 1000 --shell /bin/sh leleka \ + && rm -rf /var/lib/apt/lists/* + +STOPSIGNAL SIGRTMIN+3 +CMD ["/sbin/init"]