[3.20] backports/forgejo-runner: new aport #574
6 changed files with 122 additions and 0 deletions
47
backports/forgejo-runner/APKBUILD
Normal file
47
backports/forgejo-runner/APKBUILD
Normal file
|
@ -0,0 +1,47 @@
|
|||
# Contributor: Patrycja Rosa <alpine@ptrcnull.me>
|
||||
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
|
||||
pkgname=forgejo-runner
|
||||
pkgver=3.5.0
|
||||
pkgrel=2
|
||||
pkgdesc="CI/CD job runner for Forgejo"
|
||||
url="https://code.forgejo.org/forgejo/runner"
|
||||
arch="all"
|
||||
license="MIT"
|
||||
makedepends="go"
|
||||
install="$pkgname.pre-install $pkgname.pre-upgrade"
|
||||
subpackages="$pkgname-openrc"
|
||||
source="$pkgname-$pkgver.tar.gz::https://code.forgejo.org/forgejo/runner/archive/v$pkgver.tar.gz
|
||||
|
||||
forgejo-runner.logrotate
|
||||
forgejo-runner.initd
|
||||
forgejo-runner.confd
|
||||
"
|
||||
builddir="$srcdir/runner"
|
||||
options="!check" # tests require running forgejo
|
||||
|
||||
build() {
|
||||
go build \
|
||||
-o forgejo-runner \
|
||||
-ldflags "-X gitea.com/gitea/act_runner/internal/pkg/ver.version=$pkgver"
|
||||
./forgejo-runner generate-config > config.example.yaml
|
||||
}
|
||||
|
||||
check() {
|
||||
go test ./...
|
||||
}
|
||||
|
||||
package() {
|
||||
install -Dm755 forgejo-runner -t "$pkgdir"/usr/bin/
|
||||
install -Dm644 config.example.yaml -t "$pkgdir"/etc/forgejo-runner/
|
||||
|
||||
install -Dm755 "$srcdir"/forgejo-runner.initd "$pkgdir"/etc/init.d/forgejo-runner
|
||||
install -Dm644 "$srcdir"/forgejo-runner.confd "$pkgdir"/etc/conf.d/forgejo-runner
|
||||
install -Dm644 "$srcdir"/forgejo-runner.logrotate "$pkgdir"/etc/logrotate.d/forgejo-runner
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
e78968a5f9b6e797fb759a5c8cbf46a5c2fef2083dabc88599c9017729faface963576c63a948b0add424cb267902e864fb1a1b619202660296976d93e670713 forgejo-runner-3.5.0.tar.gz
|
||||
a3c7238b0c63053325d31e09277edd88690ef5260854517f82d9042d6173fb5d24ebfe36e1d7363673dd8801972638a6e69b6af8ad43debb6057515c73655236 forgejo-runner.logrotate
|
||||
bb0c6fbe90109c77f9ef9cb0d35d20b8033be0e4b7a60839b596aa5528dfa24309ec894d8c04066bf8fb30143e63a5fd8cc6fc89aac364422b583e0f840e2da6 forgejo-runner.initd
|
||||
e11eab27f88f1181112389befa7de3aa0bac7c26841861918707ede53335535425c805e6682e25704e9c8a6aecba3dc13e20900a99df1183762b012b62f26d5f forgejo-runner.confd
|
||||
"
|
17
backports/forgejo-runner/forgejo-runner.confd
Normal file
17
backports/forgejo-runner/forgejo-runner.confd
Normal file
|
@ -0,0 +1,17 @@
|
|||
# Configuration for /etc/init.d/forgejo-runner
|
||||
|
||||
# Path to the config file (--config).
|
||||
#cfgfile="/etc/forgejo-runner/config.yaml"
|
||||
|
||||
# Path to the working directory (--working-directory).
|
||||
#datadir="/var/lib/forgejo-runner"
|
||||
|
||||
# Path to the log file where stdout/stderr will be redirected.
|
||||
# Leave empty/commented out to use syslog instead.
|
||||
#output_log="/var/log/forgejo-runner.log"
|
||||
|
||||
# You may change this to root, e.g. to run jobs in LXC
|
||||
#command_user="forgejo-runner"
|
||||
|
||||
# Comment out to run without process supervisor.
|
||||
supervisor=supervise-daemon
|
38
backports/forgejo-runner/forgejo-runner.initd
Normal file
38
backports/forgejo-runner/forgejo-runner.initd
Normal file
|
@ -0,0 +1,38 @@
|
|||
#!/sbin/openrc-run
|
||||
|
||||
description="Forgejo CI Runner"
|
||||
name="Forgejo Runner"
|
||||
|
||||
: ${cfgfile:="/etc/forgejo-runner/config.yaml"}
|
||||
: ${datadir:="/var/lib/forgejo-runner"}
|
||||
: ${command_user:="forgejo-runner"}
|
||||
|
||||
command="/usr/bin/forgejo-runner"
|
||||
command_args="daemon --config $cfgfile"
|
||||
command_background="yes"
|
||||
directory="$datadir"
|
||||
pidfile="/run/$RC_SVCNAME.pid"
|
||||
|
||||
depend() {
|
||||
need net
|
||||
use dns logger
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
checkpath -d -o "$command_user" /etc/forgejo-runner
|
||||
checkpath -d -o "$command_user" "$datadir"
|
||||
|
||||
if ! [ -e "$cfgfile" ]; then
|
||||
eerror "Config file $cfgfile doesn't exist."
|
||||
eerror "You can generate it with: forgejo-runner generate-config,"
|
||||
eerror "or use the auto-generated one in /etc/forgejo-runner/config.example.yaml"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ "$error_log" ]; then
|
||||
output_log="$error_log"
|
||||
else
|
||||
output_logger="logger -t '${RC_SVCNAME}' -p daemon.info"
|
||||
error_logger="logger -t '${RC_SVCNAME}' -p daemon.error"
|
||||
fi
|
||||
}
|
5
backports/forgejo-runner/forgejo-runner.logrotate
Normal file
5
backports/forgejo-runner/forgejo-runner.logrotate
Normal file
|
@ -0,0 +1,5 @@
|
|||
/var/log/forgejo-runner.log {
|
||||
copytruncate
|
||||
missingok
|
||||
notifempty
|
||||
}
|
14
backports/forgejo-runner/forgejo-runner.pre-install
Normal file
14
backports/forgejo-runner/forgejo-runner.pre-install
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
addgroup -S forgejo-runner 2>/dev/null
|
||||
adduser -S -D -H -h /var/lib/forgejo-runner -s /sbin/nologin -G forgejo-runner -g forgejo-runner forgejo-runner 2>/dev/null
|
||||
|
||||
cat >&2 <<EOF
|
||||
* In order to setup the runner, create a config file
|
||||
* in /etc/forgejo-runner/config.yaml (either from .example.yaml,
|
||||
* or generating your own with 'forgejo-runner generate-config'),
|
||||
* then register it with 'doas -u forgejo-runner forgejo-runner register'
|
||||
* ran in the /var/lib/forgejo-runner directory.
|
||||
EOF
|
||||
|
||||
exit 0
|
1
backports/forgejo-runner/forgejo-runner.pre-upgrade
Symbolic link
1
backports/forgejo-runner/forgejo-runner.pre-upgrade
Symbolic link
|
@ -0,0 +1 @@
|
|||
forgejo-runner.pre-install
|
Loading…
Reference in a new issue