|
|
|
@@ -2,7 +2,7 @@
|
|
|
|
|
%global rootless rootless
|
|
|
|
|
%global dockerd_rootless %{dockerd}-%{rootless}
|
|
|
|
|
%global dockerd_rootless_service %{dockerd}-%{rootless}-user.service
|
|
|
|
|
%global act_runner_bin act_runner
|
|
|
|
|
%global runner_bin act_runner
|
|
|
|
|
%global runner_user act-runner
|
|
|
|
|
%global runner_user_rootless %{runner_user}-%{rootless}
|
|
|
|
|
%global debug_package %{nil}
|
|
|
|
@@ -36,12 +36,10 @@ Source4: README-%{dockerd}.md
|
|
|
|
|
Source5: README-%{rootless}-%{dockerd}.md
|
|
|
|
|
Source6: rootless-act_runner-register.sh
|
|
|
|
|
Source7: %{name}-sysusers.conf
|
|
|
|
|
Source8: %{name}-tmpfiles.conf
|
|
|
|
|
Source9: act_runner-register.sh
|
|
|
|
|
Source8: act_runner-register.sh
|
|
|
|
|
Source9: %{name}-sysusers-%{dockerd}.conf
|
|
|
|
|
|
|
|
|
|
BuildRequires: go >= 1.26
|
|
|
|
|
BuildRequires: go-rpm-macros
|
|
|
|
|
BuildRequires: git-core
|
|
|
|
|
BuildRequires: go >= 1.26 go-rpm-macros git-core sed systemd-rpm-macros
|
|
|
|
|
|
|
|
|
|
%gometa -L -f
|
|
|
|
|
|
|
|
|
@@ -51,9 +49,9 @@ BuildRequires: git-core
|
|
|
|
|
# act_runner with dockerd package
|
|
|
|
|
%package %{dockerd}
|
|
|
|
|
Summary: Enable running gitea actions in docker containers
|
|
|
|
|
Requires: %{name} docker-ce
|
|
|
|
|
Requires: %{name}
|
|
|
|
|
Requires: ( moby-engine or docker-ce )
|
|
|
|
|
Conflicts: %{name}-%{dockerd_rootless}
|
|
|
|
|
BuildRequires: systemd-rpm-macros
|
|
|
|
|
%{?%systemd_requires}
|
|
|
|
|
|
|
|
|
|
%description %{dockerd}
|
|
|
|
@@ -62,7 +60,7 @@ Run gitea actions in docker containers
|
|
|
|
|
|
|
|
|
|
%pre %{dockerd}
|
|
|
|
|
%sysusers_create_package %{name} %{SOURCE7}
|
|
|
|
|
%tmpfiles_create_package %{name} %{SOURCE8}
|
|
|
|
|
%sysusers_create_package %{name} %{SOURCE9}
|
|
|
|
|
|
|
|
|
|
%post %{dockerd}
|
|
|
|
|
%systemd_post %{act_runner_service}
|
|
|
|
@@ -84,9 +82,9 @@ fi
|
|
|
|
|
%package %{dockerd_rootless}
|
|
|
|
|
Summary: Enable running gitea actions in non-root docker containers
|
|
|
|
|
|
|
|
|
|
Requires: %{name} docker-ce slirp4netns fuse-overlayfs iptables docker-ce-rootless-extras shadow-utils
|
|
|
|
|
Requires: %{name} iptables
|
|
|
|
|
Requires: ( docker-ce-rootless-extras or moby-rootless-extras ) shadow-utils
|
|
|
|
|
Conflicts: %{name}-%{dockerd}
|
|
|
|
|
BuildRequires: systemd-rpm-macros
|
|
|
|
|
%{?%systemd_requires}
|
|
|
|
|
|
|
|
|
|
%description %{dockerd_rootless}
|
|
|
|
@@ -94,30 +92,25 @@ BuildRequires: systemd-rpm-macros
|
|
|
|
|
Run gitea actions in non-root docker containers
|
|
|
|
|
|
|
|
|
|
%pre %{dockerd_rootless}
|
|
|
|
|
# sysusers.d doesn't handle either home directory creation or subuid/subgid configuration
|
|
|
|
|
if [ $1 -eq 1 ]; then
|
|
|
|
|
getent group '%{runner_user_rootless}' >/dev/null || groupadd -r '%{runner_user_rootless}' || :
|
|
|
|
|
getent passwd '%{runner_user_rootless}' >/dev/null || \
|
|
|
|
|
CREATE_MAIL_SPOOL=false useradd -r -m -F -g '%{runner_user_rootless}' -d '/home/%{runner_user_rootless}' -s '/sbin/nologin' -c 'Rootless act_runner docker user' '%{runner_user_rootless}' || :
|
|
|
|
|
CREATE_MAIL_SPOOL=false useradd -r -m -F -g '%{runner_user_rootless}' -s '/sbin/nologin' -c 'Rootless act_runner docker user' '%{runner_user_rootless}' || :
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
%post %{dockerd_rootless}
|
|
|
|
|
%systemd_user_post %{act_runner_rootless_service} %{dockerd_rootless_service}
|
|
|
|
|
if [ $1 -eq 1 ] || [ ! -d /home/%{runner_user_rootless}/act_runner ]; then
|
|
|
|
|
echo ' INFO Please read README-%{rootless}-%{dockerd}.md to finish the installation'
|
|
|
|
|
fi
|
|
|
|
|
loginctl enable-linger %{runner_user_rootless}
|
|
|
|
|
|
|
|
|
|
%preun %{dockerd_rootless}
|
|
|
|
|
%systemd_user_preun %{dockerd_rootless_service} %{act_runner_rootless_service}
|
|
|
|
|
if [ $1 -eq 0 ]; then
|
|
|
|
|
loginctl disable-linger %{runner_user_rootless}
|
|
|
|
|
fi
|
|
|
|
|
%systemd_user_preun %{dockerd_rootless_service} %{act_runner_rootless_service}
|
|
|
|
|
|
|
|
|
|
%postun %{dockerd_rootless}
|
|
|
|
|
%systemd_user_postun %{dockerd_rootless_service} %{act_runner_rootless_service}
|
|
|
|
|
if [ $1 -eq 0 ]; then
|
|
|
|
|
CREATE_MAIL_SPOOL=false userdel -rf %{runner_user_rootless}
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# #############################################################
|
|
|
|
|
|
|
|
|
@@ -127,7 +120,7 @@ fi
|
|
|
|
|
%{__cp} %{SOURCE4} %{SOURCE5} .
|
|
|
|
|
|
|
|
|
|
%build
|
|
|
|
|
go build %{gobuild_baseflags} -o bin/%{act_runner_bin} %{goipath}
|
|
|
|
|
go build %{gobuild_baseflags} -o bin/%{runner_bin} %{goipath}
|
|
|
|
|
|
|
|
|
|
%install
|
|
|
|
|
# The binary
|
|
|
|
@@ -138,10 +131,10 @@ install -m 0755 -vp bin/* %{buildroot}%{_bindir}
|
|
|
|
|
install -m 0755 -vd %{buildroot}%{_unitdir}
|
|
|
|
|
install -m 0755 -vd %{buildroot}%{_sysconfdir}/%{name}
|
|
|
|
|
install -D -m 0644 -vp %{SOURCE1} %{buildroot}%{_unitdir}/%{act_runner_service}
|
|
|
|
|
install -D %{SOURCE7} %{buildroot}%{_sysusersdir}/%{name}.conf
|
|
|
|
|
install -D %{SOURCE8} %{buildroot}%{_tmpfilesdir}/%{name}.conf
|
|
|
|
|
install -D -m 0644 %{SOURCE7} %{buildroot}%{_sysusersdir}/%{name}.conf
|
|
|
|
|
install -D -m 0644 %{SOURCE9} %{buildroot}%{_sysusersdir}/%{name}-%{dockerd}.conf
|
|
|
|
|
bin/act_runner generate-config > %{buildroot}%{_sysconfdir}/%{name}/config.yaml
|
|
|
|
|
install -D -m 0755 -vp %{SOURCE9} %{buildroot}%{_datadir}/%{name}/act_runner-register.sh
|
|
|
|
|
install -D -m 0755 -vp %{SOURCE8} %{buildroot}%{_datadir}/%{name}/act_runner-register.sh
|
|
|
|
|
|
|
|
|
|
# dockerd-rootless
|
|
|
|
|
install -m 0755 -vd %{buildroot}%{_userunitdir}
|
|
|
|
@@ -153,23 +146,25 @@ install -D -m 0755 -vp %{SOURCE6} %{buildroot}%{_datadir}/%{name}/rootless-act_r
|
|
|
|
|
%files
|
|
|
|
|
%license LICENSE
|
|
|
|
|
%doc README.md
|
|
|
|
|
%{_bindir}/*
|
|
|
|
|
%{_bindir}/%{runner_bin}
|
|
|
|
|
%dir %{_datadir}/%{name}
|
|
|
|
|
|
|
|
|
|
%files %{dockerd}
|
|
|
|
|
%license LICENSE
|
|
|
|
|
%doc README-%{dockerd}.md
|
|
|
|
|
%dir %{_sysconfdir}/%{name}
|
|
|
|
|
%config %{_sysconfdir}/%{name}/config.yaml
|
|
|
|
|
%config(noreplace) %{_sysconfdir}/%{name}/config.yaml
|
|
|
|
|
%{_unitdir}/*
|
|
|
|
|
%{_sysusersdir}/%{name}.conf
|
|
|
|
|
%{_sysusersdir}/%{name}-%{dockerd}.conf
|
|
|
|
|
%{_tmpfilesdir}/%{name}.conf
|
|
|
|
|
%{_datadir}/%{name}/act_runner-register.sh
|
|
|
|
|
|
|
|
|
|
%files %{dockerd_rootless}
|
|
|
|
|
%license LICENSE
|
|
|
|
|
%doc README-%{rootless}-%{dockerd}.md
|
|
|
|
|
%{_userunitdir}/*
|
|
|
|
|
%{_userunitdir}/%{act_runner_rootless_service}
|
|
|
|
|
%{_userunitdir}/%{dockerd_rootless_service}
|
|
|
|
|
%{_datadir}/%{name}/rootless-act_runner-register.sh
|
|
|
|
|
|
|
|
|
|
%changelog
|
|
|
|
|