You've already forked Gitea-Action
Inital Commit
This commit is contained in:
2
root/DEBIAN/conffiles
Normal file
2
root/DEBIAN/conffiles
Normal file
@@ -0,0 +1,2 @@
|
||||
/etc/gitea/act_runner.env
|
||||
/etc/gitea/act_runner.yaml
|
||||
9
root/DEBIAN/control
Normal file
9
root/DEBIAN/control
Normal file
@@ -0,0 +1,9 @@
|
||||
Package: gitea-action
|
||||
Version: 0.2.13
|
||||
Architecture:
|
||||
Installed-Size:
|
||||
Priority: optional
|
||||
Section: misc
|
||||
Homepage: http://www.privlab.it
|
||||
Maintainer: PrivLab <hostmaster@privlab.it>
|
||||
Description: Gitea Action Runner
|
||||
32
root/DEBIAN/postinst
Normal file
32
root/DEBIAN/postinst
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/sh
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
if [ -d '/run/systemd/system' ]; then
|
||||
/usr/bin/systemctl --system daemon-reload > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
fi
|
||||
|
||||
case "${1}" in
|
||||
configure)
|
||||
if [ -x '/usr/bin/deb-systemd-helper' ]; then
|
||||
/usr/bin/deb-systemd-helper unmask 'gitea-action.service' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
fi
|
||||
if /usr/bin/deb-systemd-helper --quiet was-enabled 'gitea-action.service'; then
|
||||
/usr/bin/deb-systemd-helper enable 'gitea-action.service' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
else
|
||||
/usr/bin/deb-systemd-helper update-state 'gitea-action.service' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
fi
|
||||
if [ -x '/etc/init.d/traefik-certs-dumper' ]; then
|
||||
/usr/sbin/update-rc.d 'gitea-action' defaults > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
fi
|
||||
/usr/bin/chown --quiet 'gitea':'gitea' '/var/cache/gitea-action'
|
||||
/usr/bin/chown --quiet 'gitea':'gitea' '/var/lib/gitea-action'
|
||||
/usr/bin/chown --quiet --recursive 'gitea' '/etc/gitea'
|
||||
;;
|
||||
esac
|
||||
36
root/DEBIAN/postrm
Normal file
36
root/DEBIAN/postrm
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/sh
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
if [ -d '/run/systemd/system' ]; then
|
||||
/usr/bin/systemctl --system daemon-reload > '/dev/null' || \
|
||||
/usr/bin/true
|
||||
fi
|
||||
|
||||
case "${1}" in
|
||||
remove)
|
||||
if [ -x '/usr/bin/deb-systemd-helper' ]; then
|
||||
/usr/bin/deb-systemd-helper mask 'gitea-action.service' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
fi
|
||||
/usr/bin/rm --force --recursive '/var/cache/gitea-action/'*
|
||||
/usr/bin/rm --force --recursive '/var/cache/gitea-action/'.*
|
||||
;;
|
||||
purge)
|
||||
if [ -x '/usr/bin/deb-systemd-helper' ]; then
|
||||
/usr/bin/deb-systemd-helper purge 'gitea-action.service' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
/usr/bin/deb-systemd-helper unmask 'gitea-action.service' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
fi
|
||||
/usr/bin/getent passwd 'gitea' > '/dev/null' && \
|
||||
/usr/sbin/deluser 'gitea' > '/dev/null' 2>&1
|
||||
/usr/bin/getent group 'gitea' > '/dev/null' && \
|
||||
/usr/sbin/deluser --group 'gitea' > '/dev/null' 2>&1
|
||||
/usr/bin/rm --force --recursive '/var/cache/gitea-action/'*
|
||||
/usr/bin/rm --force --recursive '/var/cache/gitea-action/'.*
|
||||
/usr/bin/rm --force --recursive '/var/lib/gitea-action/'*
|
||||
/usr/bin/rm --force --recursive '/var/lib/gitea-action/'.*
|
||||
;;
|
||||
esac
|
||||
38
root/DEBIAN/preinst
Normal file
38
root/DEBIAN/preinst
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/sh
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
case "${1}" in
|
||||
install)
|
||||
/usr/bin/getent passwd 'gitea' > '/dev/null' 2>&1 || \
|
||||
/usr/sbin/adduser --quiet \
|
||||
--system \
|
||||
--home '/nonexistent' \
|
||||
--shell '/usr/sbin/nologin' \
|
||||
--no-create-home \
|
||||
--group \
|
||||
--disabled-password \
|
||||
--disabled-login \
|
||||
'gitea' > '/dev/null' 2>&1
|
||||
/usr/bin/echo "########################################################################"
|
||||
/usr/bin/echo "# #"
|
||||
/usr/bin/echo "# ! Run this commands as User 'gitea' and add your Gitea-Credentials ! #"
|
||||
/usr/bin/echo "# ! to activate the Gitea Action Runner ! #"
|
||||
/usr/bin/echo "# #"
|
||||
/usr/bin/echo "# /usr/bin/sudo --user='gitea' \ #"
|
||||
/usr/bin/echo "# /usr/bin/act_runner register \ #"
|
||||
/usr/bin/echo "# --config '/etc/gitea/act_runner.yaml' \ #"
|
||||
/usr/bin/echo "# --no-interactive \ #"
|
||||
/usr/bin/echo "# --instance 'https://<URL>/' \ #"
|
||||
/usr/bin/echo "# --labels '<LABEL>:<HOST>' \ #"
|
||||
/usr/bin/echo "# --name '<NAME>' \ #"
|
||||
/usr/bin/echo "# --token '<TOKEN>' #"
|
||||
/usr/bin/echo "# #"
|
||||
/usr/bin/echo "# /bin/chmod '0440' '/etc/gitea/act_runner' #"
|
||||
/usr/bin/echo "# #"
|
||||
/usr/bin/echo "# /bin/chgrp 'root' '/etc/gitea/act_runner' #"
|
||||
/usr/bin/echo "# #"
|
||||
/usr/bin/echo "########################################################################"
|
||||
;;
|
||||
esac
|
||||
19
root/DEBIAN/prerm
Normal file
19
root/DEBIAN/prerm
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/sh
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
case "${1}" in
|
||||
remove)
|
||||
if [ -x '/usr/bin/deb-systemd-invoke' ]; then
|
||||
/usr/bin/deb-systemd-invoke stop 'gitea-action.service' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
/usr/bin/deb-systemd-invoke disable 'gitea-action.service' > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
fi
|
||||
if [ -x '/etc/init.d/gitea-action' ]; then
|
||||
/usr/sbin/update-rc.d 'gitea-action' remove > '/dev/null' 2>&1 || \
|
||||
/usr/bin/true
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
55
root/etc/gitea/act_runner.yaml
Normal file
55
root/etc/gitea/act_runner.yaml
Normal file
@@ -0,0 +1,55 @@
|
||||
log:
|
||||
# The level of logging, can be trace, debug, info, warn, error, fatal
|
||||
level: info
|
||||
|
||||
runner:
|
||||
# Where to store the registration result.
|
||||
file: "/etc/gitea/act_runner"
|
||||
# Execute how many tasks concurrently at the same time.
|
||||
capacity: 1
|
||||
# Extra environment variables to run jobs from a file.
|
||||
# It will be ignored if it's empty or the file doesn't exist.
|
||||
env_file: "/etc/gitea/act_runner.env"
|
||||
# The timeout for a job to be finished.
|
||||
# Please note that the Gitea instance also has a timeout (3h by default) for the job.
|
||||
# So the job could be stopped by the Gitea instance if it's timeout is shorter than this.
|
||||
timeout: 3h
|
||||
# The timeout for the runner to wait for running jobs to finish when shutting down.
|
||||
# Any running jobs that haven't finished after this timeout will be cancelled.
|
||||
shutdown_timeout: 180s
|
||||
# Whether skip verifying the TLS certificate of the Gitea instance.
|
||||
insecure: false
|
||||
# The timeout for fetching the job from the Gitea instance.
|
||||
fetch_timeout: 5s
|
||||
# The interval for fetching the job from the Gitea instance.
|
||||
fetch_interval: 2s
|
||||
# The labels of a runner are used to determine which jobs the runner can run, and how to run them.
|
||||
# Like: "macos-arm64:host" or "ubuntu-latest:docker://gitea/runner-images:ubuntu-latest"
|
||||
# Find more images provided by Gitea at https://gitea.com/gitea/runner-images .
|
||||
# If it's empty when registering, it will ask for inputting labels.
|
||||
# If it's empty when execute `daemon`, will use labels in `.runner` file.
|
||||
labels:
|
||||
- "linux:host"
|
||||
|
||||
cache:
|
||||
# Enable cache server to use actions/cache.
|
||||
enabled: true
|
||||
# The directory to store the cache data.
|
||||
# If it's empty, the cache data will be stored in $HOME/.cache/actcache.
|
||||
dir: "/var/cache/gitea-action"
|
||||
# The host of the cache server.
|
||||
# It's not for the address to listen, but the address to connect from job containers.
|
||||
# So 0.0.0.0 is a bad choice, leave it empty to detect automatically.
|
||||
host: ""
|
||||
# The port of the cache server.
|
||||
# 0 means to use a random available port.
|
||||
port: 8080
|
||||
# The external cache server URL. Valid only when enable is true.
|
||||
# If it's specified, act_runner will use this URL as the ACTIONS_CACHE_URL rather than start a server by itself.
|
||||
# The URL should generally end with "/".
|
||||
external_server: ""
|
||||
|
||||
host:
|
||||
# The parent directory of a job's working directory.
|
||||
# If it's empty, $HOME/.cache/act/ will be used.
|
||||
workdir_parent: "/var/lib/gitea-action"
|
||||
84
root/etc/init.d/gitea-action
Normal file
84
root/etc/init.d/gitea-action
Normal file
@@ -0,0 +1,84 @@
|
||||
#!/usr/bin/sh
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: gitea-action
|
||||
# Required-Start: $local_fs $network $remote_fs
|
||||
# Required-Stop: $local_fs $network $remote_fs
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Gitea Action Runner
|
||||
# Description: Traefik is an open-source reverse proxy and load balancer
|
||||
# designed for microservices and containerized applications.
|
||||
# It automatically discovers services and routes traffic
|
||||
# based on defined rules. Traefik supports HTTP, HTTPS, and
|
||||
# TCP protocols, offers automatic SSL certificate
|
||||
# management, and provides a user-friendly dashboard for
|
||||
# monitoring traffic and service health.
|
||||
### END INIT INFO
|
||||
|
||||
NAME='gitea-action'
|
||||
DESC='Gitea Action Runner'
|
||||
USER='gitea'
|
||||
GROUP='gitea'
|
||||
PIDFOLDER="/run/${NAME}"
|
||||
PIDFILE="${PIDFOLDER}/act_runner.pid"
|
||||
DAEMON='/usr/sbin/act_runner'
|
||||
DAEMON_OPTS="daemon --config '/etc/gitea/act_runner.yaml'"
|
||||
|
||||
set -e
|
||||
|
||||
. '/lib/lsb/init-functions'
|
||||
|
||||
[ -x "${DAEMON}" ]
|
||||
|
||||
case "${1}" in
|
||||
start)
|
||||
/usr/bin/install --directory --group="${GROUP}" ---mode='0755' --owner="${USER}" "${PIDFOLDER}"
|
||||
log_daemon_msg "Starting ${DESC}" "${NAME}"
|
||||
if /usr/sbin/start-stop-daemon --quiet \
|
||||
--start \
|
||||
--oknodo \
|
||||
--make-pidfile \
|
||||
--pidfile "${PIDFILE}" \
|
||||
--user "${USER}" \
|
||||
--group "${GROUP}" \
|
||||
--exec "${DAEMON}" -- "${DAEMON_OPTS}"; then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1
|
||||
/usr/bin/test -f "${PIDFILE}" && \
|
||||
/usr/bin/rm --force "${PIDFILE}"
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
log_daemon_msg "Stopping ${DESC}" "${NAME}"
|
||||
if /usr/sbin/start-stop-daemon --quiet \
|
||||
--stop \
|
||||
--oknodo \
|
||||
--retry 30 \
|
||||
--remove-pidfile \
|
||||
--pidfile "${PIDFILE}" \
|
||||
--user "${USER}" \
|
||||
--group "${GROUP}" \
|
||||
--exec "${DAEMON}"; then
|
||||
/usr/bin/test -f "${PIDFILE}" && \
|
||||
/usr/bin/rm --force "${PIDFILE}"
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1
|
||||
fi
|
||||
;;
|
||||
restart)
|
||||
"${0}" stop
|
||||
"${0}" start
|
||||
;;
|
||||
status)
|
||||
status_of_proc -p "${PIDFILE}" "${DAEMON}" "${NAME}" && \
|
||||
exit 0 || \
|
||||
exit "${?}"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: /etc/init.d/${NAME} {start|stop|restart|status}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
25
root/lib/systemd/system/gitea-action.service
Normal file
25
root/lib/systemd/system/gitea-action.service
Normal file
@@ -0,0 +1,25 @@
|
||||
[Unit]
|
||||
Description=Gitea Action Runner
|
||||
ConditionPathExists=/etc/gitea/act_runner
|
||||
ConditionPathExists=/etc/gitea/act_runner.env
|
||||
ConditionPathExists=/etc/gitea/act_runner.yaml
|
||||
StartLimitBurst=3
|
||||
StartLimitIntervalSec=60
|
||||
Documentation=https://gitea.com/gitea/act_runner
|
||||
After=network.target network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/sbin/act_runner daemon --config /etc/gitea/act_runner.yaml
|
||||
ExecStartPost=/usr/bin/sh -c "umask '022'; /usr/bin/pgrep --newest 'act_runner' > '/run/gitea-action/act_runner.pid'"
|
||||
ExecStop=/usr/bin/rm --force '/run/gitea-action/act_runner.pid'
|
||||
Restart=on-failure
|
||||
Group=gitea
|
||||
User=gitea
|
||||
ReadWriteDirectories=/var/cache/gitea-action
|
||||
RuntimeDirectory=gitea-action
|
||||
RuntimeDirectoryMode=755
|
||||
WorkingDirectory=/var/lib/gitea-action
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
2
root/usr/lib/sysusers.d/gitea-action.conf
Normal file
2
root/usr/lib/sysusers.d/gitea-action.conf
Normal file
@@ -0,0 +1,2 @@
|
||||
g gitea - -
|
||||
u gitea - "gitea" /nonexistent /usr/sbin/nologin
|
||||
Reference in New Issue
Block a user