104 lines
3.5 KiB
Markdown
104 lines
3.5 KiB
Markdown
# Gitea act runner
|
|
|
|
Gitea runner is a runner for Gitea based on the Gitea fork of act.
|
|
|
|
|
|
## Quickstart
|
|
|
|
Actions are disabled by default, so you need to add the following to the configuration file of your Gitea instance to enable it:
|
|
|
|
```ini
|
|
[actions]
|
|
ENABLED=true
|
|
```
|
|
|
|
|
|
### Register
|
|
Before the runner can be started you need to register it on the Gitea server:
|
|
|
|
```bash
|
|
/usr/share/gitea-runner/register.sh
|
|
```
|
|
|
|
And you will be asked to input:
|
|
|
|
1. Gitea instance URL, like `http://192.168.8.8:3000/`. You should use your gitea instance ROOT_URL as the instance argument
|
|
and you should not use `localhost` or `127.0.0.1` as instance IP;
|
|
2. Runner token, you can get it from `http://192.168.8.8:3000/admin/actions/runners`;
|
|
3. Runner name, you can just leave it blank;
|
|
4. Runner labels, you can just leave it blank.
|
|
|
|
The process looks like:
|
|
|
|
```text
|
|
INFO Registering runner, arch=amd64, os=darwin, version=0.1.5.
|
|
WARN Runner in user-mode.
|
|
INFO Enter the Gitea instance URL (for example, https://gitea.com/):
|
|
http://192.168.8.8:3000/
|
|
INFO Enter the runner token:
|
|
fe884e8027dc292970d4e0303fe82b14xxxxxxxx
|
|
INFO Enter the runner name (if set empty, use hostname: server.example.com):
|
|
|
|
INFO Enter the runner labels, leave blank to use the default labels (comma-separated, for example, ubuntu-latest:docker://gitea/runner-images:ubuntu-latest):
|
|
|
|
INFO Registering runner, name=Test.local, instance=http://192.168.8.8:3000/, labels=[ubuntu-latest:docker://gitea/runner-images:ubuntu-latest ubuntu-22.04:docker://gitea/runner-images:ubuntu-22.04 ubuntu-20.04:docker://gitea/runner-images:ubuntu-20.04].
|
|
DEBU Successfully pinged the Gitea instance server
|
|
INFO Runner registered successfully.
|
|
```
|
|
|
|
The script is not on the path to avoid accidentally overwriting a working registration.
|
|
|
|
##### Manual registration
|
|
|
|
You can also register manually with command line arguments.
|
|
|
|
```bash
|
|
cd ~gitea-runner
|
|
sudo -u gitea-runner -H gitea-runner register --instance http://192.168.8.8:3000 --token <my_runner_token> --no-interactive
|
|
```
|
|
|
|
If the registration succeeds, it will run immediately. Next time, you can run the runner directly by enabling the systemd service.
|
|
|
|
|
|
### Run
|
|
|
|
Enable the systemd service:
|
|
```bash
|
|
systemctl enable --now gitea-runner.service
|
|
```
|
|
|
|
You can also manually start the daemon:
|
|
|
|
```bash
|
|
gitea-runner daemon
|
|
```
|
|
|
|
This is mostly useful to debugging, when the systemd service fails to start.
|
|
|
|
|
|
### Configuration
|
|
|
|
The runner can be configured with a configuration file.
|
|
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.
|
|
|
|
> **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 configuration file is a YAML file, which can also generated as a sample configuration file with `./gitea-runner generate-config`.
|
|
|
|
```bash
|
|
gitea-runner generate-config > /etc/gitea-runner/config.yaml
|
|
chmod 0640 /etc/gitea-runner/config.yaml
|
|
```
|
|
|
|
You can specify the configuration file path with `-c`/`--config` argument.
|
|
|
|
```bash
|
|
gitea-runner -c /etc/gitea-runner/config.yaml register # register 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](https://gitea.com/gitea/runner/src/branch/main/internal/pkg/config/config.example.yaml).
|