Release 1.0.0 (#9)
Rename from act-runner to gitea-runner. The upstream projects changed name from act_runner to runner. Reviewed-on: http://git.demus.dk/demus/gitea-runner-rpm/pulls/9 Co-authored-by: Daniel Demus <daniel@demus.dk> Co-committed-by: Daniel Demus <daniel@demus.dk>
This commit was merged in pull request #9.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
name: Build and provide rpm of the Gitea act_runner
|
name: Build and provide rpm of the Gitea runner
|
||||||
run-name: Build act_runner from ${{ gitea.repository }} on COPR
|
run-name: Build gitea-runner from ${{ gitea.repository }} on COPR
|
||||||
on: [release]
|
on: [release]
|
||||||
jobs:
|
jobs:
|
||||||
coprbuild:
|
coprbuild:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
name: Build and provide rpm of Gitea act_runner
|
name: Build and provide rpm of Gitea runner
|
||||||
run-name: Rpmbuild act_runner at ${{ gitea.repository }} by ${{ github.actor }}
|
run-name: Rpmbuild gitea-runner at ${{ gitea.repository }} by ${{ github.actor }}
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
name: Build and provide rpm of the Gitea act_runner
|
name: Build and provide rpm of the Gitea runner
|
||||||
run-name: Rpmbuild act_runner by @${{ github.actor }}
|
run-name: Rpmbuild gitea-runner by @${{ github.actor }}
|
||||||
on: [release]
|
on: [release]
|
||||||
jobs:
|
jobs:
|
||||||
rpmbuild:
|
rpmbuild:
|
||||||
|
|||||||
@@ -27,3 +27,4 @@ go.work
|
|||||||
RPMS/
|
RPMS/
|
||||||
|
|
||||||
BUILD/
|
BUILD/
|
||||||
|
SRPMS/
|
||||||
|
|||||||
+14
-16
@@ -1,6 +1,6 @@
|
|||||||
# Gitea act runner
|
# Gitea act runner
|
||||||
|
|
||||||
Act runner is a runner for Gitea based on Gitea fork of act.
|
Gitea runner is a runner for Gitea based on the Gitea fork of act.
|
||||||
|
|
||||||
|
|
||||||
## Quickstart
|
## Quickstart
|
||||||
@@ -17,7 +17,7 @@ ENABLED=true
|
|||||||
Before the runner can be started you need to register it on the Gitea server:
|
Before the runner can be started you need to register it on the Gitea server:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
/usr/share/gitea-act-runner/act_runner-register.sh
|
/usr/share/gitea-runner/register.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
And you will be asked to input:
|
And you will be asked to input:
|
||||||
@@ -53,24 +53,24 @@ The script is not on the path to avoid accidentally overwriting a working regist
|
|||||||
You can also register manually with command line arguments.
|
You can also register manually with command line arguments.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd ~act-runner
|
cd ~gitea-runner
|
||||||
sudo -u act-runner -H act_runner register --instance http://192.168.8.8:3000 --token <my_runner_token> --no-interactive
|
sudo -u gitea-runner -H gitea-runner register --instance http://192.168.8.8:3000 --token <my_runner_token> --no-interactive
|
||||||
```
|
```
|
||||||
|
|
||||||
If the registry succeeds, it will run immediately. Next time, you can run the runner directly by enabling the systemd service.
|
If the registration succeeds, it will run immediately. Next time, you can run the runner directly by enabling the systemd service.
|
||||||
|
|
||||||
|
|
||||||
### Run
|
### Run
|
||||||
|
|
||||||
Enable the systemd service:
|
Enable the systemd service:
|
||||||
```bash
|
```bash
|
||||||
systemctl enable --now gitea-act-runner.service
|
systemctl enable --now gitea-runner.service
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also manually start the daemon:
|
You can also manually start the daemon:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
act_runner daemon
|
gitea-runner daemon
|
||||||
```
|
```
|
||||||
|
|
||||||
This is mostly useful to debugging, when the systemd service fails to start.
|
This is mostly useful to debugging, when the systemd service fails to start.
|
||||||
@@ -79,7 +79,7 @@ This is mostly useful to debugging, when the systemd service fails to start.
|
|||||||
### Configuration
|
### Configuration
|
||||||
|
|
||||||
The runner can be configured with a configuration file.
|
The runner can be configured with a configuration file.
|
||||||
The systemd service file expects the file to be `/etc/gitea-act-runner/config.yaml`.
|
The systemd service file expects the file to be `/etc/gitea-runner/config.yaml`.
|
||||||
The config file installed by the package has removed the example `envs:` and `labels:` values.
|
The config file installed by the package has removed the example `envs:` and `labels:` values.
|
||||||
|
|
||||||
> **NB**: The value of `labels:` in the config file, if they are specified, override any labels configured during registration on the next startup.
|
> **NB**: The value of `labels:` in the config file, if they are specified, override any labels configured during registration on the next startup.
|
||||||
@@ -89,17 +89,15 @@ The log level is set to debug, to assist first setup and should be changed to `i
|
|||||||
The configuration file is a YAML file, which can also generated as a sample configuration file with `./act_runner generate-config`.
|
The configuration file is a YAML file, which can also generated as a sample configuration file with `./act_runner generate-config`.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
act_runner generate-config > /etc/gitea-act-runner/config.yaml
|
gitea-runner generate-config > /etc/gitea-runner/config.yaml
|
||||||
chmod 0640 /etc/gitea-act-runner/config.yaml
|
chmod 0640 /etc/gitea-runner/config.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
You can specify the configuration file path with `-c`/`--config` argument.
|
You can specify the configuration file path with `-c`/`--config` argument.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
act_runner -c /etc/gitea-act-runner/config.yaml register # register with config file
|
gitea-runner -c /etc/gitea-runner/config.yaml register # register with config file
|
||||||
act_runner -c /etc/gitea-act-runner/config.yaml daemon # run with config file
|
gitea-runner -c /etc/gitea-runner/config.yaml daemon # run with config file
|
||||||
```
|
```
|
||||||
|
|
||||||
You can read the latest version of the configuration file online at [config.example.yaml](internal/pkg/config/config.example.yaml).
|
You can read the latest version of the configuration file online at [config.example.yaml](https://gitea.com/gitea/runner/src/branch/main/internal/pkg/config/config.example.yaml).
|
||||||
|
|
||||||
https://gitea.com/gitea/runner
|
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ to enable gitea actions in a non-root docker environment.
|
|||||||
You have to start and register the docker instance with Gitea:
|
You have to start and register the docker instance with Gitea:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
systemctl -M act-runner-rootless@ --user enable --now dockerd-rootless-user
|
systemctl -M gitea-runner-rootless@ --user enable --now dockerd-rootless-user
|
||||||
/usr/share/gitea-act-runner/rootless-act_runner-register.sh
|
/usr/share/gitea-runner/register-rootless.sh
|
||||||
systemctl -M act-runner-rootless@ --user enable --now gitea-act-runner-rootless
|
systemctl -M gitea-runner-rootless@ --user enable --now gitea-runner-rootless
|
||||||
```
|
```
|
||||||
|
|
||||||
You will be asked to input:
|
You will be asked to input:
|
||||||
@@ -25,23 +25,23 @@ Apart from registering the docker instance, the script also produces a default c
|
|||||||
### Configuration
|
### Configuration
|
||||||
|
|
||||||
The runner can be configured with a configuration file.
|
The runner can be configured with a configuration file.
|
||||||
The systemd user service file expects the file to be `/home/gitea-act-runner/act_runner/config.yaml`.
|
The systemd user service file expects the file to be `/home/gitea-runner/runner/config.yaml`.
|
||||||
The registration script generates a default config file with the `envs:` and `labels:` values removed in the above-mentioned directory.
|
The registration script generates a default config file with the `envs:` and `labels:` values removed in the above-mentioned directory.
|
||||||
|
|
||||||
> **NB**: The value of `labels:` in the config file, if they are specified, override any labels configured during registration on the next startup.
|
> **NB**: The value of `labels:` in the config file, if they are specified, override any labels configured during registration on the next startup.
|
||||||
|
|
||||||
The log level is set to debug, to assist first setup and should be changed to `info` during normal operation.
|
The log level is set to debug, to assist first setup and should be changed to `info` during normal operation.
|
||||||
|
|
||||||
The configuration file is a YAML file, which can also generated as a sample configuration file with `./act_runner generate-config`.
|
The configuration file is a YAML file, which can also generated as a sample configuration file with `gitea-runner generate-config`.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd ~act-runner-rootless/act_runner
|
cd ~gitea-runner-rootless/runner
|
||||||
act_runner generate-config > config.yaml
|
gitea-runner generate-config > config.yaml
|
||||||
chown act-runner-rootless:act-runner-rootless config.yaml
|
chown gitea-runner-rootless:gitea-runner-rootless config.yaml
|
||||||
chmod 0640 config.yaml
|
chmod 0640 config.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
> **NB**: The generated config file has the default values of `labels:`, which override any labels configured during registration on the next startup. There are also some default `envs:` values, that result in environment variables in all runs.
|
> **NB**: The generated config file has the default values of `labels:`, which override any labels configured during registration on the next startup. There are also some default `envs:` values, that result in environment variables in all runs.
|
||||||
|
|
||||||
## Uninstallation
|
## Uninstallation
|
||||||
If you uninstall the package, you need to manually remove the registration in the Gitea UI and remove the /home/gitea-act-runner directory, if required.
|
If you uninstall the package, you need to manually remove the registration in the Gitea UI and remove the /home/gitea-runner-rootless directory, if required.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# gitea-act-runner-rpm
|
# gitea-runner-rpm
|
||||||
|
|
||||||
Spec file to copr build the gitea act_runner binary
|
Spec file to copr build the gitea-runner binary
|
||||||
from https://gitea.com/gitea/act_runner.git
|
from https://gitea.com/gitea/runner.git
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
sudo -u act-runner act_runner register -c "$(rpm --eval '%{_sysconfdir}')/gitea-act-runner/config.yaml"
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
#Type Name ID GECOS Home directory Shell
|
|
||||||
m act-runner docker
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
#Type Name ID GECOS Home directory Shell
|
|
||||||
u! act-runner - "act_runner user" /var/lib/act-runner -
|
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Gitea Actions runner using docker
|
Description=Gitea Actions runner using rootless docker
|
||||||
Documentation=https://gitea.com/gitea/act_runner
|
Documentation=https://gitea.com/gitea/runner
|
||||||
After=dockerd-rootless-user.service gitea.service
|
After=dockerd-rootless-user.service gitea.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Environment=XDG_RUNTIME_DIR=/run/user/%U
|
Environment=XDG_RUNTIME_DIR=/run/user/%U
|
||||||
Environment=DOCKER_HOST=unix:///run/user/%U/docker.sock
|
Environment=DOCKER_HOST=unix:///run/user/%U/docker.sock
|
||||||
ExecStart=/usr/bin/act_runner daemon -c %h/act_runner/config.yaml
|
ExecStart=/usr/bin/gitea-runner daemon -c %h/runner/config.yaml
|
||||||
ExecReload=/bin/kill -s HUP $MAINPID
|
ExecReload=/bin/kill -s HUP $MAINPID
|
||||||
Type=exec
|
Type=exec
|
||||||
WorkingDirectory=%h/act_runner
|
WorkingDirectory=%h/gitea-runner
|
||||||
TimeoutStartSec=30
|
TimeoutStartSec=30
|
||||||
TimeoutStopSec=120
|
TimeoutStopSec=120
|
||||||
Restart=always
|
Restart=always
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#Type Name ID GECOS Home directory Shell
|
||||||
|
m gitea-runner docker
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#Type Name ID GECOS Home directory Shell
|
||||||
|
u! gitea-runner - "Gitea action runner user" /var/lib/gitea-runner -
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Gitea Actions runner using docker
|
Description=Gitea Actions runner using docker
|
||||||
Documentation=https://gitea.com/gitea/act_runner
|
Documentation=https://gitea.com/gitea/runner
|
||||||
After=docker.service gitea.service
|
After=docker.service gitea.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
User=act-runner
|
User=act-runner
|
||||||
ExecStart=/usr/bin/act_runner daemon -c /etc/gitea-act-runner/config.yaml
|
ExecStart=/usr/bin/gitea-runner daemon -c /etc/gitea-runner/config.yaml
|
||||||
ExecReload=/bin/kill -s HUP $MAINPID
|
ExecReload=/bin/kill -s HUP $MAINPID
|
||||||
WorkingDirectory=~
|
WorkingDirectory=~
|
||||||
Environment=DOCKER_HOST=unix:///run/docker.sock
|
Environment=DOCKER_HOST=unix:///run/docker.sock
|
||||||
@@ -1,47 +1,49 @@
|
|||||||
%global dockerd dockerd
|
%global dockerd dockerd
|
||||||
%global rootless rootless
|
%global rootless rootless
|
||||||
%global shim docker-group-shim
|
%global shim docker-group-shim
|
||||||
%global dockerd_rootless %{dockerd}-%{rootless}
|
%global rootless_dockerd %{dockerd}-%{rootless}
|
||||||
%global dockerd_rootless_service %{dockerd}-%{rootless}-user.service
|
%global rootless_dockerd_service %{dockerd}-%{rootless}-user.service
|
||||||
%global runner_bin act_runner
|
|
||||||
%global runner_user act-runner
|
|
||||||
%global runner_user_rootless %{runner_user}-%{rootless}
|
|
||||||
%global debug_package %{nil}
|
%global debug_package %{nil}
|
||||||
|
|
||||||
%global golicenses LICENSE
|
%global golicenses LICENSE
|
||||||
%global godocs examples README.md
|
%global godocs examples README.md
|
||||||
%global goipath gitea.com/gitea/act_runner
|
%global goipath gitea.com/gitea/runner
|
||||||
|
|
||||||
%global common_description %{expand:
|
%global common_description %{expand:
|
||||||
A runner for Gitea based on nectos/act.
|
A runner for Gitea based on nectos/act.
|
||||||
}
|
}
|
||||||
|
|
||||||
%global major 0
|
%global major 1
|
||||||
%global minor 6
|
%global minor 0
|
||||||
%global revision 1
|
%global revision 0
|
||||||
|
|
||||||
|
Name: gitea-runner
|
||||||
|
%global rootless_user %{name}-%{rootless}
|
||||||
|
%global obsolete_user act-runner-%{rootless}
|
||||||
|
|
||||||
Name: gitea-act-runner
|
|
||||||
Version: %{major}.%{minor}.%{revision}
|
Version: %{major}.%{minor}.%{revision}
|
||||||
Release: %autorelease
|
Release: %autorelease
|
||||||
Summary: A runner for Gitea based on act.
|
Summary: A runner for Gitea
|
||||||
|
|
||||||
%global act_runner_service %{name}.service
|
%global runner_service %{name}.service
|
||||||
%global act_runner_rootless_service %{name}-%{rootless}.service
|
%global rootless_runner_service %{name}-%{rootless}.service
|
||||||
|
|
||||||
License: MIT
|
License: MIT
|
||||||
URL: https://gitea.com/gitea/runner
|
URL: https://gitea.com/gitea/runner
|
||||||
Source0: https://gitea.com/gitea/runner/archive/v%{version}.tar.gz
|
Source0: https://gitea.com/gitea/runner/archive/v%{version}.tar.gz
|
||||||
Source1: %{act_runner_service}
|
Source1: %{runner_service}
|
||||||
Source2: %{act_runner_rootless_service}
|
Source2: %{rootless_runner_service}
|
||||||
Source3: %{dockerd_rootless_service}
|
Source3: %{rootless_dockerd_service}
|
||||||
Source4: README-%{dockerd}.md
|
Source4: README-%{dockerd}.md
|
||||||
Source5: README-%{rootless}-%{dockerd}.md
|
Source5: README-%{rootless}-%{dockerd}.md
|
||||||
Source6: rootless-act_runner-register.sh
|
Source6: register-rootless.sh
|
||||||
Source7: %{name}-sysusers.conf
|
Source7: %{name}-sysusers.conf
|
||||||
Source8: act_runner-register.sh
|
Source8: register.sh
|
||||||
Source9: %{name}-sysusers-%{dockerd}.conf
|
Source9: %{name}-sysusers-%{dockerd}.conf
|
||||||
|
|
||||||
BuildRequires: go >= 1.26 go-rpm-macros git-core sed systemd-rpm-macros
|
BuildRequires: go >= 1.26 go-rpm-macros git-core sed systemd-rpm-macros
|
||||||
|
Conflicts: gitea-act-runner
|
||||||
|
Obsoletes: gitea-act-runner < 1.0.0
|
||||||
|
|
||||||
%gometa -L -f
|
%gometa -L -f
|
||||||
|
|
||||||
@@ -53,7 +55,8 @@ BuildRequires: go >= 1.26 go-rpm-macros git-core sed systemd-rpm-macros
|
|||||||
Summary: Enable running gitea actions in docker containers
|
Summary: Enable running gitea actions in docker containers
|
||||||
Requires: %{name}
|
Requires: %{name}
|
||||||
Requires: ( moby-engine or docker-ce )
|
Requires: ( moby-engine or docker-ce )
|
||||||
Conflicts: %{name}-%{dockerd_rootless}
|
Conflicts: %{name}-%{rootless_dockerd} gitea-act-runner-%{rootless_dockerd}
|
||||||
|
Obsoletes: gitea-act-runner-%{dockerd} < 1.0.0
|
||||||
%{?%systemd_requires}
|
%{?%systemd_requires}
|
||||||
|
|
||||||
%description %{dockerd}
|
%description %{dockerd}
|
||||||
@@ -61,20 +64,25 @@ Conflicts: %{name}-%{dockerd_rootless}
|
|||||||
Run gitea actions in docker containers
|
Run gitea actions in docker containers
|
||||||
|
|
||||||
%pre %{dockerd}
|
%pre %{dockerd}
|
||||||
|
# Check if we are replacing the gitea-act-runner package
|
||||||
|
if [ $1 -eq 1 ]; then
|
||||||
|
getent group act-runner >/dev/null || groupmod -n %{name} act-runner || :
|
||||||
|
getent passwd act-runner >/dev/null || usermod -l %{name} -m -d %{_sharedstatedir}/%{name} act-runner || :
|
||||||
|
fi
|
||||||
%sysusers_create_package %{name} %{SOURCE7}
|
%sysusers_create_package %{name} %{SOURCE7}
|
||||||
%sysusers_create_package %{name} %{SOURCE9}
|
%sysusers_create_package %{name} %{SOURCE9}
|
||||||
|
|
||||||
%post %{dockerd}
|
%post %{dockerd}
|
||||||
%systemd_post %{act_runner_service}
|
%systemd_post %{runner_service}
|
||||||
if [ $1 -eq 1 ] || [ ! -d %{_sharedstatedir}/%{runner_user}/act_runner ]; then
|
if [ $1 -eq 1 ] || [ ! -d %{_sharedstatedir}/%{name}/runner ]; then
|
||||||
echo ' INFO Please read README-%{dockerd}.md to finish the installation'
|
echo ' INFO Please read README-%{dockerd}.md to finish the installation'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
%preun %{dockerd}
|
%preun %{dockerd}
|
||||||
%systemd_preun %{act_runner_service}
|
%systemd_preun %{runner_service}
|
||||||
|
|
||||||
%postun %{dockerd}
|
%postun %{dockerd}
|
||||||
%systemd_postun %{act_runner_service}
|
%systemd_postun %{runner_service}
|
||||||
|
|
||||||
# #############################################################
|
# #############################################################
|
||||||
|
|
||||||
@@ -95,38 +103,49 @@ using the act-runner with the non-rootless docker-ce.
|
|||||||
|
|
||||||
# #############################################################
|
# #############################################################
|
||||||
# act_runner with rootless dockerd package
|
# act_runner with rootless dockerd package
|
||||||
%package %{dockerd_rootless}
|
%package %{rootless_dockerd}
|
||||||
Summary: Enable running gitea actions in non-root docker containers
|
Summary: Enable running gitea actions in non-root docker containers
|
||||||
|
|
||||||
Requires: %{name} iptables sed shadow-utils
|
Requires: %{name} iptables sed shadow-utils
|
||||||
Requires: ( moby-engine-rootless-extras or docker-ce-rootless-extras )
|
Requires: ( moby-engine-rootless-extras or docker-ce-rootless-extras )
|
||||||
Conflicts: %{name}-%{dockerd}
|
Conflicts: %{name}-%{dockerd} gitea-act-runner-%{dockerd}
|
||||||
|
Obsoletes: gitea-act-runner-%{rootless_dockerd} < 1.0.0
|
||||||
%{?%systemd_requires}
|
%{?%systemd_requires}
|
||||||
|
|
||||||
%description %{dockerd_rootless}
|
%description %{rootless_dockerd}
|
||||||
%{common_description}
|
%{common_description}
|
||||||
Run gitea actions in non-root docker containers
|
Run gitea actions in non-root docker containers
|
||||||
|
|
||||||
%pre %{dockerd_rootless}
|
%pre %{rootless_dockerd}
|
||||||
# sysusers.d doesn't handle either home directory creation or subuid/subgid configuration
|
# sysusers.d doesn't handle either home directory creation or subuid/subgid configuration
|
||||||
if [ $1 -eq 1 ]; then
|
if [ $1 -eq 1 ]; then
|
||||||
getent group '%{runner_user_rootless}' >/dev/null || groupadd -r '%{runner_user_rootless}' || :
|
# Modify the existing user and group if we are upgrade obsoleting the package with the old naming
|
||||||
getent passwd '%{runner_user_rootless}' >/dev/null || \
|
if getent passwd %{obsolete_user} >/dev/null; then
|
||||||
CREATE_MAIL_SPOOL=false useradd -r -m -F -g '%{runner_user_rootless}' -s '/sbin/nologin' -c 'Rootless act_runner docker user' '%{runner_user_rootless}' || :
|
loginctl disable-linger %{obsolete_user} &
|
||||||
|
systemctl --user -M %{obsolete_user}@ disable --now --no-warn %{rootless_dockerd_service} gitea-act-runner-rootless.service &
|
||||||
|
loginctl terminate-user %{obsolete_user} &
|
||||||
|
wait
|
||||||
|
getent group %{obsolete_user} >/dev/null && groupmod -n %{rootless_user} %{obsolete_user} || :
|
||||||
|
getent passwd %{obsolete_user} >/dev/null && usermod -l %{rootless_user} -m -d /home/%{rootless_user} %{obsolete_user} || :
|
||||||
|
%{__mv} /home/%{rootless_user}/act_runner /home/%{rootless_user}/runner >/dev/null
|
||||||
|
fi
|
||||||
|
getent group '%{rootless_user}' >/dev/null || groupadd -r '%{rootless_user}' || :
|
||||||
|
getent passwd '%{rootless_user}' >/dev/null || \
|
||||||
|
CREATE_MAIL_SPOOL=false useradd -r -m -F -g '%{rootless_user}' -s '/sbin/nologin' -c 'Rootless act_runner docker user' '%{rootless_user}' || :
|
||||||
fi
|
fi
|
||||||
|
|
||||||
%post %{dockerd_rootless}
|
%post %{rootless_dockerd}
|
||||||
%systemd_user_post %{act_runner_rootless_service} %{dockerd_rootless_service}
|
%systemd_user_post %{rootless_runner_service} %{rootless_dockerd_service}
|
||||||
loginctl enable-linger %{runner_user_rootless}
|
loginctl enable-linger %{rootless_user}
|
||||||
|
|
||||||
%preun %{dockerd_rootless}
|
%preun %{rootless_dockerd}
|
||||||
if [ $1 -eq 0 ]; then
|
if [ $1 -eq 0 ]; then
|
||||||
loginctl disable-linger %{runner_user_rootless}
|
loginctl disable-linger %{rootless_user}
|
||||||
fi
|
fi
|
||||||
%systemd_user_preun %{dockerd_rootless_service} %{act_runner_rootless_service}
|
%systemd_user_preun %{rootless_dockerd_service} %{rootless_runner_service}
|
||||||
|
|
||||||
%postun %{dockerd_rootless}
|
%postun %{rootless_dockerd}
|
||||||
%systemd_user_postun %{dockerd_rootless_service} %{act_runner_rootless_service}
|
%systemd_user_postun %{rootless_dockerd_service} %{rootless_runner_service}
|
||||||
|
|
||||||
# #############################################################
|
# #############################################################
|
||||||
|
|
||||||
@@ -136,7 +155,7 @@ fi
|
|||||||
%{__cp} %{SOURCE4} %{SOURCE5} .
|
%{__cp} %{SOURCE4} %{SOURCE5} .
|
||||||
|
|
||||||
%build
|
%build
|
||||||
go build %{gobuild_baseflags} -o bin/%{runner_bin} %{goipath}
|
go build %{gobuild_baseflags} -o bin/%{name} %{goipath}
|
||||||
|
|
||||||
%install
|
%install
|
||||||
# The binary
|
# The binary
|
||||||
@@ -147,25 +166,25 @@ install -m 0755 -vp bin/* %{buildroot}%{_bindir}
|
|||||||
install -m 0755 -vd %{buildroot}%{_unitdir}
|
install -m 0755 -vd %{buildroot}%{_unitdir}
|
||||||
install -m 0755 -vd %{buildroot}%{_sysconfdir}/%{name}
|
install -m 0755 -vd %{buildroot}%{_sysconfdir}/%{name}
|
||||||
install -m 0700 -vd %{buildroot}%{_sharedstatedir}/%{name}
|
install -m 0700 -vd %{buildroot}%{_sharedstatedir}/%{name}
|
||||||
install -D -m 0644 -vp %{SOURCE1} %{buildroot}%{_unitdir}/%{act_runner_service}
|
install -D -m 0644 -vp %{SOURCE1} %{buildroot}%{_unitdir}/%{runner_service}
|
||||||
install -D -m 0644 %{SOURCE7} %{buildroot}%{_sysusersdir}/%{name}.conf
|
install -D -m 0644 %{SOURCE7} %{buildroot}%{_sysusersdir}/%{name}.conf
|
||||||
install -D -m 0644 %{SOURCE9} %{buildroot}%{_sysusersdir}/%{name}-%{dockerd}.conf
|
install -D -m 0644 %{SOURCE9} %{buildroot}%{_sysusersdir}/%{name}-%{dockerd}.conf
|
||||||
bin/%{runner_bin} generate-config | \
|
bin/%{name} generate-config | \
|
||||||
sed -e '/^ A_TEST_ENV/d' -e '/^ - "ubuntu-/d' -e 's:file\: .runner:file\: %{_sharedstatedir}/%{name}/.runner:' -e 's/level: info/level: debug/' \
|
sed -e '/^ A_TEST_ENV/d' -e '/^ - "ubuntu-/d' -e 's:file\: .runner:file\: %{_sharedstatedir}/%{name}/.runner:' -e 's/level: info/level: debug/' \
|
||||||
> %{buildroot}%{_sysconfdir}/%{name}/config.yaml
|
> %{buildroot}%{_sysconfdir}/%{name}/config.yaml
|
||||||
install -D -m 0755 -vp %{SOURCE8} %{buildroot}%{_datadir}/%{name}/act_runner-register.sh
|
install -D -m 0755 -vp %{SOURCE8} %{buildroot}%{_datadir}/%{name}/register.sh
|
||||||
|
|
||||||
# dockerd-rootless
|
# dockerd-rootless
|
||||||
install -m 0755 -vd %{buildroot}%{_userunitdir}
|
install -m 0755 -vd %{buildroot}%{_userunitdir}
|
||||||
install -m 0755 -vd %{buildroot}%{_datadir}/%{name}
|
install -m 0755 -vd %{buildroot}%{_datadir}/%{name}
|
||||||
install -D -m 0644 -vp %{SOURCE2} %{buildroot}%{_userunitdir}/%{act_runner_rootless_service}
|
install -D -m 0644 -vp %{SOURCE2} %{buildroot}%{_userunitdir}/%{rootless_runner_service}
|
||||||
install -D -m 0644 -vp %{SOURCE3} %{buildroot}%{_userunitdir}/%{dockerd_rootless_service}
|
install -D -m 0644 -vp %{SOURCE3} %{buildroot}%{_userunitdir}/%{rootless_dockerd_service}
|
||||||
install -D -m 0755 -vp %{SOURCE6} %{buildroot}%{_datadir}/%{name}/rootless-act_runner-register.sh
|
install -D -m 0755 -vp %{SOURCE6} %{buildroot}%{_datadir}/%{name}/register-rootless.sh
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%license LICENSE
|
%license LICENSE
|
||||||
%doc README.md
|
%doc README.md
|
||||||
%{_bindir}/%{runner_bin}
|
%{_bindir}/%{name}
|
||||||
%dir %{_datadir}/%{name}
|
%dir %{_datadir}/%{name}
|
||||||
|
|
||||||
%files %{dockerd}
|
%files %{dockerd}
|
||||||
@@ -173,19 +192,19 @@ install -D -m 0755 -vp %{SOURCE6} %{buildroot}%{_datadir}/%{name}/rootless-act_r
|
|||||||
%doc README-%{dockerd}.md
|
%doc README-%{dockerd}.md
|
||||||
%dir %{_sysconfdir}/%{name}
|
%dir %{_sysconfdir}/%{name}
|
||||||
%config(noreplace) %{_sysconfdir}/%{name}/config.yaml
|
%config(noreplace) %{_sysconfdir}/%{name}/config.yaml
|
||||||
%attr(0700, %{runner_user}, %{runner_user}) %dir %{_sharedstatedir}/%{name}
|
%attr(0700, %{name}, %{name}) %dir %{_sharedstatedir}/%{name}
|
||||||
%ghost %config(noreplace) %{_sharedstatedir}/%{name}/.runner
|
%ghost %config(noreplace) %{_sharedstatedir}/%{name}/.runner
|
||||||
%{_unitdir}/%{act_runner_service}
|
%{_unitdir}/%{runner_service}
|
||||||
%{_sysusersdir}/%{name}.conf
|
%{_sysusersdir}/%{name}.conf
|
||||||
%{_sysusersdir}/%{name}-%{dockerd}.conf
|
%{_sysusersdir}/%{name}-%{dockerd}.conf
|
||||||
%{_datadir}/%{name}/act_runner-register.sh
|
%{_datadir}/%{name}/register.sh
|
||||||
|
|
||||||
%files %{dockerd_rootless}
|
%files %{rootless_dockerd}
|
||||||
%license LICENSE
|
%license LICENSE
|
||||||
%doc README-%{rootless}-%{dockerd}.md
|
%doc README-%{rootless}-%{dockerd}.md
|
||||||
%{_userunitdir}/%{act_runner_rootless_service}
|
%{_userunitdir}/%{rootless_runner_service}
|
||||||
%{_userunitdir}/%{dockerd_rootless_service}
|
%{_userunitdir}/%{rootless_dockerd_service}
|
||||||
%{_datadir}/%{name}/rootless-act_runner-register.sh
|
%{_datadir}/%{name}/register-rootless.sh
|
||||||
|
|
||||||
%files %{shim}
|
%files %{shim}
|
||||||
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
mkdir -p -m 0750 ~act-runner-rootless/act_runner
|
mkdir -p -m 0750 ~gitea-runner-rootless/runner
|
||||||
cd ~act-runner-rootless/act_runner
|
cd ~gitea-runner-rootless/runner
|
||||||
act_runner register
|
act_runner register
|
||||||
act_runner generate-config | \
|
act_runner generate-config | \
|
||||||
sed -e '/^ A_TEST_ENV/d' -e '/^ - "ubuntu-/d' -e "s:file\: .runner:file\: ${PWD}/.runner:" -e 's/level: info/level: debug/' \
|
sed -e '/^ A_TEST_ENV/d' -e '/^ - "ubuntu-/d' -e "s:file\: .runner:file\: ${PWD}/.runner:" -e 's/level: info/level: debug/' \
|
||||||
> config.yaml
|
> config.yaml
|
||||||
chmod 0640 config.yaml
|
chmod 0640 config.yaml
|
||||||
chown -R act-runner-rootless:act-runner-rootless ~act-runner-rootless/act_runner
|
chown -R gitea-runner-rootless:gitea-runner-rootless ~gitea-runner-rootless/runner
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
sudo -u gitea-runner gitea-runner register -c "$(rpm --eval '%{_sysconfdir}')/gitea-runner/config.yaml"
|
||||||
Reference in New Issue
Block a user