yams/packaging/systemd/fedora-lane.Dockerfile
trvon e0b0b575e2
ci(packaging): validate the systemd user unit in every lane
The package validation now exercises the per-user service:

- service: the user unit and user preset are installed, the unit is
  enabled for all users (systemctl --global), no system unit remains,
  and the unit does not hide the user's home or /tmp.
- user: a normal user with lingering gets a user manager; the unit is
  enabled and active without a manual start and `systemd-analyze --user
  verify` is clean; the socket is in $XDG_RUNTIME_DIR and owned by the
  user; through a login shell with no YAMS_* variables the CLI reports
  status, adds from $HOME and /tmp, searches, stores in
  ~/.local/share/yams and logs to ~/.local/state/yams, and the only
  daemon is the unit's MainPID; `yams daemon stop`, CLI auto-start and
  `yams daemon restart` go through systemd; `yams daemon install --user`
  enables the packaged unit without writing an override; a second user
  cannot reach the first one's daemon.
- onnx: after `yams init` the restarted user daemon logs "Using bundled
  ONNX Runtime" and `yams plugin health` lists the onnx plugin.
- persist: with lingering the user's daemon is back after a reboot with
  the data intact.
- upgrade from 0.20.3: the old system unit is stopped, removed and
  leaves no enablement links, /var/lib/yams is left alone, the user unit
  is enabled for all users and the user's daemon and CLI work.
- remove: running user daemons are stopped, global enablement is gone,
  no daemon process is left, user corpora survive (deb: also purge).
- minimal: bare base images still install with declared dependencies
  only; the account checks are gone with the yams account.

The Fedora lane image replaces the systemd-user PAM stack, which cannot
run in a container (unix_chkpwd, pam_selinux, pam_loginuid), with a
minimal one that still runs pam_systemd, so user@.service starts.

Signed-off-by: trvon <me@trevon.dev>
2026-10-02 08:30:55 -06:00

29 lines
899 B
Docker

# Fedora systemd-in-Docker substrate for scripts/local-ci/package-validate.sh.
ARG BASE_IMAGE=fedora:42
FROM ${BASE_IMAGE}
ENV container=docker
RUN set -eux; \
dnf install -y \
systemd \
systemd-pam \
procps-ng \
iproute \
shadow-utils \
util-linux \
binutils \
findutils \
ca-certificates && \
dnf clean all
# Test-substrate only: Fedora's systemd-user PAM stack (pam_unix via
# unix_chkpwd, pam_selinux, pam_loginuid) cannot run inside this container, so
# user@.service never starts. The package validation needs a user manager to
# exercise the yams systemd user unit; give it a minimal stack that still runs
# pam_systemd (which sets XDG_RUNTIME_DIR).
RUN printf '%s\n' 'account required pam_permit.so' 'session required pam_permit.so' \
'session optional pam_systemd.so' > /etc/pam.d/systemd-user
STOPSIGNAL SIGRTMIN+3
CMD ["/usr/sbin/init"]