package/gitlab-runner: new package

We rely on config.toml to be created manually during first boot as
setup stage. Even with an empty config.toml file, the gitlab-runner
needs gitlab registration token to register to a gitlab server.

Use the 14.5.1 release since 14.5.2 and 14.6.0 triggers a build error [1]
due a patch for GO < 1.17.
(helpers/patches/issue_28732/syscall.go:11:2: undefined: syscall.Issue28732Fix)

Tested:
https://gitlab.com/kubu93/buildroot/-/pipelines/442604876

[1] https://gitlab.com/gitlab-org/gitlab-runner/-/issues/28766

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Signed-off-by: Romain Naour <romain.naour@smile.fr>
Cc: Jérémy Rosen <jeremy.rosen@smile.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Marcin Niestroj 2022-01-06 13:34:49 +01:00 committed by Thomas Petazzoni
parent ff506cdeb7
commit eb671037fb
7 changed files with 152 additions and 0 deletions

View File

@ -1828,6 +1828,7 @@ F: configs/orangepi_zero_plus_defconfig
F: package/argparse/
F: package/dt-utils/
F: package/easydbus/
F: package/gitlab-runner/
F: package/lua-flu/
F: package/lua-stdlib/
F: package/luaossl/
@ -2524,6 +2525,7 @@ F: package/enlightenment/
F: package/flare-engine/
F: package/flare-game/
F: package/gcc/
F: package/gitlab-runner/
F: package/glibc/
F: package/irrlicht/
F: package/liblinear/

View File

@ -2142,6 +2142,7 @@ menu "Miscellaneous"
source "package/collectl/Config.in"
source "package/domoticz/Config.in"
source "package/empty/Config.in"
source "package/gitlab-runner/Config.in"
source "package/gnuradio/Config.in"
source "package/googlefontdirectory/Config.in"
source "package/gqrx/Config.in"

View File

@ -0,0 +1,31 @@
config BR2_PACKAGE_GITLAB_RUNNER
bool "gitlab-runner"
depends on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
depends on BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS
depends on BR2_TOOLCHAIN_HAS_THREADS
depends on BR2_USE_MMU # git
depends on BR2_USE_WCHAR # tar
select BR2_PACKAGE_BASH # runtime, shells/bash.go probably want to support bashism.
select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS # bash
select BR2_PACKAGE_CA_CERTIFICATES # runtime
select BR2_PACKAGE_GIT # runtime
select BR2_PACKAGE_LIBCURL # runtime
select BR2_PACKAGE_LIBCURL_CURL # runtime
select BR2_PACKAGE_LIBCURL_OPENSSL # runtime, for ca-certificates.
select BR2_PACKAGE_OPENSSL # runtime
select BR2_PACKAGE_LIBOPENSSL # runtime
select BR2_PACKAGE_LIBOPENSSL_BIN # runtime
select BR2_PACKAGE_TAR # runtime
help
GitLab Runner is the open source project that is used to run
your jobs and send the results back to GitLab. It is used in
conjunction with GitLab CI/CD, the open-source continuous
integration service included with GitLab that coordinates the
jobs.
https://docs.gitlab.com/runner/
comment "gitlab-runner needs a toolchain w/ threads"
depends on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
depends on BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS
depends on !BR2_TOOLCHAIN_HAS_THREADS

View File

@ -0,0 +1,64 @@
#!/bin/sh
DAEMON="gitlab-runner"
PIDFILE="/var/run/$DAEMON.pid"
GITLAB_RUNNER_ARGS="run"
# shellcheck source=/dev/null
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
start() {
printf 'Starting %s: ' "$DAEMON"
# shellcheck disable=SC2086 # we need the word splitting
start-stop-daemon -S -q -m -b -p "$PIDFILE" -c "$DAEMON:$DAEMON" -x "/usr/bin/$DAEMON" \
-- $GITLAB_RUNNER_ARGS
status=$?
if [ "$status" -eq 0 ]; then
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
stop() {
printf 'Stopping %s: ' "$DAEMON"
start-stop-daemon -K -q -p "$PIDFILE" -u "$DAEMON"
status=$?
if [ "$status" -eq 0 ]; then
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
restart() {
stop
sleep 1
start
}
reload() {
printf 'Reloading %s: ' "$DAEMON"
start-stop-daemon -K -s HUP -q -p "$PIDFILE" -u "$DAEMON"
status=$?
if [ "$status" -eq 0 ]; then
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
case "$1" in
start|stop|restart)
"$1";;
reload)
# Restart, since there is no true "reload" feature.
restart;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
esac

View File

@ -0,0 +1,3 @@
# Locally computed
sha256 63a7963f750ec45a7cb34a660b7247a0aa6def98706b7bd80efc95053e66822d gitlab-runner-14.5.1.tar.gz
sha256 0ae968b7ddd25da0209c3c6594aac1ac74ddf90385940b02b420463e2e0734de LICENSE

View File

@ -0,0 +1,33 @@
################################################################################
#
# gitlab-runner
#
################################################################################
GITLAB_RUNNER_VERSION = 14.5.1
GITLAB_RUNNER_SITE = https://gitlab.com/gitlab-org/gitlab-runner/-/archive/v$(GITLAB_RUNNER_VERSION)
GITLAB_RUNNER_LICENSE = MIT
GITLAB_RUNNER_LICENSE_FILES = LICENSE
GITLAB_RUNNER_LDFLAGS = \
-X gitlab.com/gitlab-org/gitlab-runner/common.VERSION=$(GITLAB_RUNNER_VERSION)
# Don't run gitlab runner as root.
define GITLAB_RUNNER_USERS
gitlab-runner -1 gitlab-runner -1 * /var/run/dbus /bin/false - Gitlab Runner
endef
define GITLAB_RUNNER_INSTALL_INIT_SYSV
$(INSTALL) -m 0755 -D package/gitlab-runner/S95gitlab-runner \
$(TARGET_DIR)/etc/init.d/S95gitlab-runner
endef
define GITLAB_RUNNER_INSTALL_INIT_SYSTEMD
mkdir -p $(TARGET_DIR)/var/lib/gitlab-runner
$(INSTALL) -D -m 0644 package/gitlab-runner/gitlab-runner.service \
$(TARGET_DIR)/usr/lib/systemd/system/gitlab-runner.service
endef
GITLAB_RUNNER_POST_INSTALL_TARGET_HOOKS += GITLAB_RUNNER_INSTALL_CONFIG
$(eval $(golang-package))

View File

@ -0,0 +1,18 @@
[Unit]
Description=GitLab Runner
After=network.target
ConditionFileIsExecutable=/usr/bin/gitlab-runner
[Service]
Environment="DAEMON_ARGS=run --working-directory /var/lib/gitlab-runner --config /etc/gitlab-runner/config.toml --service gitlab-runner --syslog --user gitlab-runner"
EnvironmentFile=-/etc/default/%p
StartLimitInterval=5
StartLimitBurst=10
ExecStart=/usr/bin/gitlab-runner $DAEMON_ARGS
ExecReload=/bin/kill -HUP $MAINPID
Restart=always
RestartSec=120
[Install]
WantedBy=multi-user.target