This commit is contained in:
2026-03-17 03:22:54 +01:00
parent 6ddeea9491
commit e907064d6e
5 changed files with 33 additions and 18 deletions

View File

@@ -77,7 +77,7 @@ container:
# If it's empty, act_runner will find an available docker host automatically. # If it's empty, act_runner will find an available docker host automatically.
# If it's "-", act_runner will find an available docker host automatically, but the docker host won't be mounted to the job containers and service containers. # If it's "-", act_runner will find an available docker host automatically, but the docker host won't be mounted to the job containers and service containers.
# If it's not empty or "-", the specified docker host will be used. An error will be returned if it doesn't work. # If it's not empty or "-", the specified docker host will be used. An error will be returned if it doesn't work.
docker_host: "" docker_host: unix:///run/gitea-runner/podman/podman.sock
# Pull docker image(s) even if already present # Pull docker image(s) even if already present
force_pull: false force_pull: false

View File

@@ -14,18 +14,8 @@ fi
mkdir -p "$RUNNER_DIR" mkdir -p "$RUNNER_DIR"
chown gitea-runner:gitea-runner "$RUNNER_DIR" chown gitea-runner:gitea-runner "$RUNNER_DIR"
mkdir -p "$RUNNER_DIR" # Ensure Podman API socket is running
chown gitea-runner:gitea-runner "$RUNNER_DIR" systemctl enable --now gitea-runner-podman.service
# Enable rootless podman socket (once per user, idempotent)
RUNNER_HOME=$(getent passwd gitea-runner | cut -d: -f6)
SOCKET_WANTS="${RUNNER_HOME}/.config/systemd/user/sockets.target.wants"
PODMAN_SOCKET="/usr/lib/systemd/user/podman.socket"
if [ -f "$PODMAN_SOCKET" ] && [ ! -L "${SOCKET_WANTS}/podman.socket" ]; then
mkdir -p "$SOCKET_WANTS"
ln -s "$PODMAN_SOCKET" "${SOCKET_WANTS}/podman.socket"
chown -R gitea-runner:gitea-runner "${RUNNER_HOME}/.config"
fi
cd "$RUNNER_DIR" cd "$RUNNER_DIR"
sudo -u gitea-runner gitea-act-runner register -c "$CONFIG" sudo -u gitea-runner gitea-act-runner register -c "$CONFIG"

View File

@@ -1,6 +1,6 @@
Name: gitea-act_runner Name: gitea-act_runner
Version: 0.3.0 Version: 0.3.0
Release: 1%{?dist} Release: 2%{?dist}
Summary: Gitea act runner service. Summary: Gitea act runner service.
License: MIT License: MIT
Group: System Environment/Base Group: System Environment/Base
@@ -12,9 +12,11 @@ Source10: gitea-act_runner@.service
Source11: config.yaml Source11: config.yaml
Source12: gitea-act-runner-setup Source12: gitea-act-runner-setup
Source13: gitea-act-runner.sysusers Source13: gitea-act-runner.sysusers
Source14: gitea-runner-podman.service
BuildRequires: systemd-rpm-macros BuildRequires: systemd-rpm-macros
Requires: shadow-utils Requires: shadow-utils
Requires: podman
%{?systemd_requires} %{?systemd_requires}
ExclusiveArch: x86_64 aarch64 ExclusiveArch: x86_64 aarch64
@@ -37,6 +39,7 @@ install -m 755 %{SOURCE1} %{buildroot}%{_bindir}/gitea-act-runner
%endif %endif
install -p -D -m 644 %{SOURCE10} %{buildroot}%{_unitdir}/gitea-act_runner@.service install -p -D -m 644 %{SOURCE10} %{buildroot}%{_unitdir}/gitea-act_runner@.service
install -p -D -m 644 %{SOURCE14} %{buildroot}%{_unitdir}/gitea-runner-podman.service
install -p -D -m 644 %{SOURCE13} %{buildroot}%{_sysusersdir}/gitea-act-runner.conf install -p -D -m 644 %{SOURCE13} %{buildroot}%{_sysusersdir}/gitea-act-runner.conf
install -d -m 750 %{buildroot}%{_sysconfdir}/gitea/runners install -d -m 750 %{buildroot}%{_sysconfdir}/gitea/runners
@@ -61,12 +64,15 @@ if ! grep -q "gitea-runner" /etc/subuid; then
fi fi
%systemd_post gitea-act_runner@.service %systemd_post gitea-act_runner@.service
%systemd_post gitea-runner-podman.service
%preun %preun
%systemd_preun gitea-act_runner@.service %systemd_preun gitea-act_runner@.service
%systemd_preun gitea-runner-podman.service
%postun %postun
%systemd_postun gitea-act_runner@.service %systemd_postun gitea-act_runner@.service
%systemd_postun gitea-runner-podman.service
%clean %clean
%{__rm} -rf %{buildroot} %{__rm} -rf %{buildroot}
@@ -77,9 +83,14 @@ fi
%{_bindir}/gitea-act-runner %{_bindir}/gitea-act-runner
%{_bindir}/gitea-act-runner-setup %{_bindir}/gitea-act-runner-setup
%{_unitdir}/gitea-act_runner@.service %{_unitdir}/gitea-act_runner@.service
%{_unitdir}/gitea-runner-podman.service
%{_sysusersdir}/gitea-act-runner.conf %{_sysusersdir}/gitea-act-runner.conf
%defattr(-,gitea-runner,gitea-runner,750) %defattr(-,gitea-runner,gitea-runner,750)
%dir %{_sysconfdir}/gitea %dir %{_sysconfdir}/gitea
%dir %{_sysconfdir}/gitea/runners %dir %{_sysconfdir}/gitea/runners
%config(noreplace) %{_sysconfdir}/gitea/runners/runner1.yaml %config(noreplace) %{_sysconfdir}/gitea/runners/runner1.yaml
%changelog
* Mon Mar 17 2025 Zoran Pericic <zpericic@netst.org> - 0.3.0-2
- Add gitea-runner-podman.service for rootless Podman API socket

View File

@@ -1,7 +1,7 @@
[Unit] [Unit]
Description=Act runner is a runner for Gitea Description=Act runner is a runner for Gitea
After=network.target After=network.target
ConditionPathExists=/var/lib/gitea/runners/%I/.runner ConditionPathExists=/var/lib/gitea/runners/%i/.runner
StartLimitIntervalSec=60 StartLimitIntervalSec=60
StartLimitBurst=3 StartLimitBurst=3
@@ -11,10 +11,10 @@ User=gitea-runner
StateDirectory=gitea/runners/%i StateDirectory=gitea/runners/%i
StateDirectoryMode=0750 StateDirectoryMode=0750
WorkingDirectory=/var/lib/gitea/runners/%I WorkingDirectory=/var/lib/gitea/runners/%i
Environment=HOME=/var/lib/gitea/runners/%I Environment=HOME=/var/lib/gitea/runners/%i
ExecStart=/usr/bin/gitea-act-runner daemon -c /etc/gitea/runners/%I.yaml ExecStart=/usr/bin/gitea-act-runner daemon -c /etc/gitea/runners/%i.yaml
Restart=on-failure Restart=on-failure
RestartSec=5s RestartSec=5s

View File

@@ -0,0 +1,14 @@
[Unit]
Description=Podman API socket for Gitea Act Runner
After=network.target
[Service]
Type=exec
User=gitea-runner
RuntimeDirectory=gitea-runner/podman
ExecStart=/usr/bin/podman system service --time=0 unix:///run/gitea-runner/podman/podman.sock
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.target