1
0
forked from ports/contrib

act-runner: initial commit, version 0.2.6

This commit is contained in:
Tim Biermann 2024-02-23 22:32:22 +01:00
parent 11dd15a2f1
commit fd222eef8e
Signed by untrusted user: tb
GPG Key ID: 42F8B4E30B673606
5 changed files with 117 additions and 0 deletions

12
act-runner/.footprint Normal file
View File

@ -0,0 +1,12 @@
drwxr-xr-x root/root etc/
drwxr-xr-x root/root etc/rc.d/
-rwxr-xr-x root/root etc/rc.d/act-runner
drwxr-xr-x root/root usr/
drwxr-xr-x root/root usr/bin/
-rwxr-xr-x root/root usr/bin/act_runner
drwxr-xr-x root/root usr/share/
drwxr-xr-x root/root usr/share/act_runner/
-rw-r--r-- root/root usr/share/act_runner/config.yaml
drwxr-xr-x root/root var/
drwxr-xr-x root/root var/lib/
drwxr-xr-x root/root var/lib/act_runner/

6
act-runner/.signature Normal file
View File

@ -0,0 +1,6 @@
untrusted comment: verify with /etc/ports/contrib.pub
RWSagIOpLGJF3//E53bzmCv5yE0fEyhFypBxFUTMHI/Dh5d9u1ruoZ+RSOfLxxNe6f51pxwQ8+DziBAfz6cbzqTbZv4dI7ZGQA0=
SHA256 (Pkgfile) = d1619c8154b99a5a2ff338cd17ceffafa02a52a2d784c82b935bd86a0d9a4a4d
SHA256 (.footprint) = 168634e10cd7f2cd7850998d4e98ca95740acc02c2112466957705043ca7713e
SHA256 (act-runner-0.2.6.tar.gz) = 8dbc7da07752d7ed8900581963045f3dcbfe02c52cb560acefd88099b8daf136
SHA256 (act-runner.service) = 0aa4b1a3d379916342465ed90fc46fcfc623bc0e81f61563485a9992b67d1ee7

29
act-runner/Pkgfile Normal file
View File

@ -0,0 +1,29 @@
# Description: A runner for Gitea based on act
# URL: https://gitea.com/gitea/act_runner
# Maintainer: Tim Biermann, tbier at posteo dot de
# Depends on: docker
name=act-runner
version=0.2.6
release=2
source=(https://gitea.com/gitea/act_runner/archive/v$version.tar.gz
act-runner.service)
renames=($name-$version.tar.gz SKIP)
build() {
cd act_runner
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
export CGO_LDFLAGS="${LDFLAGS}"
go build \
-buildvcs=false \
-ldflags "-linkmode=external -X main.version=$version"
install -Dm755 act_runner -t $PKG/usr/bin
install -d -m 755 $PKG/{var/lib/act_runner,usr/share/act_runner}
$PKG/usr/bin/act_runner generate-config > $PKG/usr/share/act_runner/config.yaml
install -Dm 755 $SRC/$name.service $PKG/etc/rc.d/$name
}

30
act-runner/README.md Normal file
View File

@ -0,0 +1,30 @@
act_runner README
=================
## Registering a runner
From a root shell:
```
# cd /var/lib/act_runner
# act_runner register
INFO Registering runner, arch=amd64, os=linux, version=dev.
INFO Enter the Gitea instance URL (for example, https://gitea.com/):
https://your.gitea.tld
INFO Enter the runner token:
<redacted>
INFO Enter the runner name (if set empty, use hostname: kukfinanz.de):
default_runner
INFO Enter the runner labels, leave blank to use the default labels (comma-separated, for example, ubuntu-20.04:docker://node:16-bullseye,ubuntu-18.04:docker://node:16-buster,linux_arm:host):
INFO Registering runner, name=default_runner, instance=https://your.gitea.tld, labels=[ubuntu-latest:docker://node:16-bullseye ubuntu-22.04:docker://node:16-bullseye ubuntu-20.04:docker://node:16-bullseye ubuntu-18.04:docker://node:16-buster].
DEBU Successfully pinged the Gitea instance server
INFO Runner registered successfully.
```
This will create a .runner file needed to associate your runner with a gitea server.
## Changing settings
Copy the default config from `/usr/share/act_runner` to `/var/lib/act_runner`
and make any changes you need.

40
act-runner/act-runner.service Executable file
View File

@ -0,0 +1,40 @@
#!/bin/sh
#
# /etc/rc.d/gitea: start/stop gitea daemon
#
SSD=/sbin/start-stop-daemon
PROG=/usr/bin/act_runner
HOME=/var/lib/act_runner
OPTS="daemon --config config.yaml"
case $1 in
start)
if [[ $(/etc/rc.d/docker status) =~ "is not" ]]; then
echo "[ERR] This service depends on docker running!"
exit 1
fi
$SSD --start -b -d $HOME --exec $PROG -- $OPTS
;;
stop)
$SSD --stop -u $USER --retry 10 --exec $PROG
;;
restart)
$0 stop
$0 start
;;
status)
$SSD --status --exec $PROG
case $? in
0) echo "$PROG is running with pid $(pidof $PROG)" ;;
1) echo "$PROG is not running but the pid file $PID exists" ;;
3) echo "$PROG is not running" ;;
4) echo "Unable to determine the program status" ;;
esac
;;
*)
echo "usage: $0 [start|stop|restart|status]"
;;
esac
# End of file