diff options
Diffstat (limited to 'user/gitlab-runner')
-rw-r--r-- | user/gitlab-runner/APKBUILD | 86 | ||||
-rw-r--r-- | user/gitlab-runner/disable-crap.patch | 22 | ||||
-rw-r--r-- | user/gitlab-runner/gccgo.patch | 68 | ||||
-rw-r--r-- | user/gitlab-runner/gitlab-runner.confd | 17 | ||||
-rw-r--r-- | user/gitlab-runner/gitlab-runner.initd | 46 | ||||
-rw-r--r-- | user/gitlab-runner/gitlab-runner.pre-install | 7 | ||||
-rw-r--r-- | user/gitlab-runner/tests.patch | 28 |
7 files changed, 274 insertions, 0 deletions
diff --git a/user/gitlab-runner/APKBUILD b/user/gitlab-runner/APKBUILD new file mode 100644 index 000000000..c5b01bd3b --- /dev/null +++ b/user/gitlab-runner/APKBUILD @@ -0,0 +1,86 @@ +# Contributor: Max Rees <maxcrees@me.com> +# Maintainer: Zach van Rijn <me@zv.io> +pkgname=gitlab-runner +pkgver=15.0.0 +pkgrel=0 +_testver=91956efe +_branch="${pkgver%.*}" +_branch="${pkgver%%.*}-${_branch#*.}-stable" +pkgdesc="GitLab runner for CI/CD jobs" +url="https://docs.gitlab.com/runner/" +# golang.org packages do not support ppc32 +arch="all !ppc" +pkgusers="gitlab-runner" +pkggroups="gitlab-runner" +options="!check" # Tests require network (git cloning) +license="MIT" +depends="" +makedepends="gcc-go" +subpackages="$pkgname-openrc" +install="$pkgname.pre-install" +source="https://gitlab.com/gitlab-org/gitlab-runner/-/archive/v$pkgver/gitlab-runner-v$pkgver.tar.gz + https://dev.sick.bike/dist/gitlab-test-$_testver.tar.gz + $pkgname.confd + $pkgname.initd + disable-crap.patch + gccgo.patch + tests.patch + " +builddir="$srcdir/$pkgname-v$pkgver" + +unpack() { + default_unpack + mv gitlab-test "$builddir"/tmp +} + +_make() { + make "$@" VERSION="$pkgver" REVISION="v$pkgver" BRANCH="$_branch" +} + +build() { + export GO111MODULE=on + export GOCACHE="$builddir"/tmp/go-build + export GOMODCACHE="$builddir"/go-mod + export GOFLAGS="-buildvcs=false -p=$JOBS -v -mod=readonly -modcacherw" + go build -o gitlab-runner . +} + +check() { + # Even with network access and a clean chroot, there are some + # tests that fail: + # + # gitlab.com/gitlab-org/gitlab-runner/commands/helpers : + # TestCacheArchiverAddingUntrackedFiles + # TestCacheArchiverAddingUntrackedUnicodeFiles + + # gitlab.com/gitlab-org/gitlab-runner/executors/shell : + # TestBuildWithGitStrategyFetchWithLFS + # TestBuildWithGitStrategyCloneWithLFS + # TestBuildWithSubmoduleLFSPullsLFSObject + # + # gitlab.com/gitlab-org/gitlab-runner/network (error: use of + # undefined type ‘RegisterRunnerParameters’) + _make test +} + +package() { + install -Dm755 gitlab-runner \ + "$pkgdir"/usr/bin/gitlab-runner + install -dm750 -g gitlab-runner \ + "$pkgdir"/etc/gitlab-runner + install -dm750 -o gitlab-runner -g gitlab-runner \ + "$pkgdir"/var/lib/gitlab-runner + + install -Dm644 "$srcdir"/$pkgname.confd \ + "$pkgdir"/etc/conf.d/$pkgname + install -Dm755 "$srcdir"/$pkgname.initd \ + "$pkgdir"/etc/init.d/$pkgname +} + +sha512sums="8ba54e690fc45c1e22d174b649fbe3cf78707fd5a146c738c73cba045e6ac00499ddedd7a5f905c0c7e4e804a533d3fc718f8f7ac3c9ec5581de4dd9b3599c80 gitlab-runner-v15.0.0.tar.gz +7bccab81aa1cb88c6a0f83a6d3dfc509e6f9ecb4d0168a5b30cc4e8fdd823294b95fe3633e09757905466f83bb3bf73b1d28fac475dff2dc3164604db4b5b995 gitlab-test-91956efe.tar.gz +f8a0c7e77cd563d7e5b4fb2319181ceab8de44c555cefa4803e985ad3ac6a9fea7bca469d80b28974edcfb65f2095d019bfdf0abd8a3221464276a8d89debc0d gitlab-runner.confd +7f785a65b46919f6a6695e25fdc414ee3204eb9aa1a3735e7884575434af94b20a48f2fe7a1fb787473de23a7bd2d56bc1e9c1fc6b522c6f0c05c47b3d37ab1c gitlab-runner.initd +020a388f63758ecbcdd19ce3a290d2fd044e852174b6b7e1c79dc39d8d83ac161be5b63df8a9c60da315895e5385e9ac02bd3a46e02d45b96b8f939c90c444cd disable-crap.patch +6bb477d2f40e651cb59f18ea18cfb051dd06cdfa3f976c6e17b72ee35733e9520a6323cec1f6b34d85fa46050b97bd20d4bb0f08a44f2cbfd4eb6914cfd5d604 gccgo.patch +9b64665ec4c7f0edb7151b146666ea22283ac109193ff354510da018f14f1442c99707c753e5185caed2eb034600aa93ef5c95d960443339db89696acef96c3c tests.patch" diff --git a/user/gitlab-runner/disable-crap.patch b/user/gitlab-runner/disable-crap.patch new file mode 100644 index 000000000..aab6a98b1 --- /dev/null +++ b/user/gitlab-runner/disable-crap.patch @@ -0,0 +1,22 @@ +--- gitlab-runner-v12.1.0/main.go 2019-07-19 12:13:32.000000000 +0000 ++++ gitlab-runner-v12.1.0/main.go 2020-03-04 22:28:31.741878923 +0000 +@@ -12,19 +12,11 @@ import ( + cli_helpers "gitlab.com/gitlab-org/gitlab-runner/helpers/cli" + "gitlab.com/gitlab-org/gitlab-runner/log" + +- _ "gitlab.com/gitlab-org/gitlab-runner/cache/azure" +- _ "gitlab.com/gitlab-org/gitlab-runner/cache/gcs" +- _ "gitlab.com/gitlab-org/gitlab-runner/cache/s3" + _ "gitlab.com/gitlab-org/gitlab-runner/commands" + _ "gitlab.com/gitlab-org/gitlab-runner/commands/helpers" + _ "gitlab.com/gitlab-org/gitlab-runner/executors/custom" +- _ "gitlab.com/gitlab-org/gitlab-runner/executors/docker" +- _ "gitlab.com/gitlab-org/gitlab-runner/executors/docker/machine" +- _ "gitlab.com/gitlab-org/gitlab-runner/executors/kubernetes" +- _ "gitlab.com/gitlab-org/gitlab-runner/executors/parallels" + _ "gitlab.com/gitlab-org/gitlab-runner/executors/shell" + _ "gitlab.com/gitlab-org/gitlab-runner/executors/ssh" +- _ "gitlab.com/gitlab-org/gitlab-runner/executors/virtualbox" + _ "gitlab.com/gitlab-org/gitlab-runner/helpers/secrets/resolvers/vault" + _ "gitlab.com/gitlab-org/gitlab-runner/shells" + ) diff --git a/user/gitlab-runner/gccgo.patch b/user/gitlab-runner/gccgo.patch new file mode 100644 index 000000000..c8704280c --- /dev/null +++ b/user/gitlab-runner/gccgo.patch @@ -0,0 +1,68 @@ +* does not support -X ldflag: https://github.com/golang/go/issues/25183 +* does not support -cover testflag +* needs CGO to be enabled to build syscall module +* wants -gccgoflags, not -ldflags +* don't test stuff we've disabled + +--- gitlab-runner-v12.1.0/Makefile 2019-07-19 12:13:32.000000000 +0000 ++++ gitlab-runner-v12.1.0/Makefile 2020-04-26 23:58:20.823352305 +0000 +@@ -4,7 +4,6 @@ export VERSION := $(shell ./ci/version) + REVISION := $(shell git rev-parse --short=8 HEAD || echo unknown) + BRANCH := $(shell git show-ref | grep "$(REVISION)" | grep -v HEAD | awk '{print $$2}' | sed 's|refs/remotes/origin/||' | sed 's|refs/heads/||' | sort | head -n 1) + BUILT := $(shell date -u +%Y-%m-%dT%H:%M:%S%z) +-export TESTFLAGS ?= -cover + + LATEST_STABLE_TAG := $(shell git -c versionsort.prereleaseSuffix="-rc" -c versionsort.prereleaseSuffix="-RC" tag -l "v*.*.*" | sort -rV | awk '!/rc/' | head -n 1) + export IS_LATEST := +@@ -36,14 +35,11 @@ export PATH := $(GOPATH_BIN):$(PATH) + BUILD_DIR := $(CURDIR) + TARGET_DIR := $(BUILD_DIR)/out + + export MAIN_PACKAGE ?= gitlab.com/gitlab-org/gitlab-runner + +-GO_LDFLAGS ?= -X $(COMMON_PACKAGE_NAMESPACE).NAME=$(PACKAGE_NAME) -X $(COMMON_PACKAGE_NAMESPACE).VERSION=$(VERSION) \ +- -X $(COMMON_PACKAGE_NAMESPACE).REVISION=$(REVISION) -X $(COMMON_PACKAGE_NAMESPACE).BUILT=$(BUILT) \ +- -X $(COMMON_PACKAGE_NAMESPACE).BRANCH=$(BRANCH) \ +- -w ++GO_LDFLAGS ?= -w + GO_FILES ?= $(shell find . -name '*.go') +-export CGO_ENABLED ?= 0 ++export CGO_ENABLED ?= 1 + + + # Development Tools +@@ -137,7 +133,7 @@ build_current: helper-docker build_simpl + simple-test: TEST_PKG ?= $(shell go list ./...) + simple-test: + # use env -i to clear parent environment variables for go test +- ./scripts/go_test_no_env $(TEST_PKG) $(TESTFLAGS) -ldflags "$(GO_LDFLAGS)" ++ ./scripts/go_test_no_env $(TEST_PKG) $(TESTFLAGS) -gccgoflags "$(GO_LDFLAGS)" + + git1.8-test: export TEST_PKG = gitlab.com/gitlab-org/gitlab-runner/executors/shell gitlab.com/gitlab-org/gitlab-runner/shells + git1.8-test: +--- gitlab-runner-v13.0.0/Makefile.build.mk.old 2020-05-20 03:10:39.000000000 -0500 ++++ gitlab-runner-v13.0.0/Makefile.build.mk 2024-05-30 22:18:11.590776424 -0500 +@@ -1,6 +1,5 @@ + runner-bin: $(GOX) + # Building $(NAME) in version $(VERSION) for $(BUILD_PLATFORMS) +- $(GOX) $(BUILD_PLATFORMS) \ +- -ldflags "$(GO_LDFLAGS)" \ +- -output="out/binaries/$(NAME)-{{.OS}}-{{.Arch}}" \ ++ go build -v \ ++ -gccgoflags "$(GO_LDFLAGS)" \ + $(PKG) +--- gitlab-runner-v12.1.0/common/version.go 2019-07-19 12:13:32.000000000 +0000 ++++ gitlab-runner-v12.1.0/common/version.go 2020-04-27 00:57:04.923408027 +0000 +@@ -9,9 +9,9 @@ import ( + ) + + var NAME = "gitlab-runner" +-var VERSION = "development version" +-var REVISION = "HEAD" +-var BRANCH = "HEAD" ++var VERSION = "15.0.0" ++var REVISION = "v15.0.0" ++var BRANCH = "15-0-stable" + var BUILT = "unknown" + + var AppVersion AppVersionInfo diff --git a/user/gitlab-runner/gitlab-runner.confd b/user/gitlab-runner/gitlab-runner.confd new file mode 100644 index 000000000..05a3ac1bb --- /dev/null +++ b/user/gitlab-runner/gitlab-runner.confd @@ -0,0 +1,17 @@ +#export CONFIG_FILE="/etc/gitlab-runner/config.toml" +#command_args="--working-directory /var/lib/gitlab-runner" +#logfile="/var/log/gitlab-runner.log" + +# Time to wait (in seconds) when gracefully stopping before forcefully +# stopping. +#timeout="300" + +# Time to wait (in seconds) when forcefully stopping the server before +# giving up. The runner can be a little slower than the OpenRC default +# of 5 seconds to stop when jobs are running. +#retry="60" + +# Run user service (default): +#command_user="gitlab-runner:gitlab-runner" +# Run system service: +#command_user="root:root" diff --git a/user/gitlab-runner/gitlab-runner.initd b/user/gitlab-runner/gitlab-runner.initd new file mode 100644 index 000000000..a5f65dacb --- /dev/null +++ b/user/gitlab-runner/gitlab-runner.initd @@ -0,0 +1,46 @@ +#!/sbin/openrc-run + +: "${CONFIG_FILE:=/etc/gitlab-runner/config.toml}" +: "${command_args:=--working-directory /var/lib/gitlab-runner}" +: "${logfile:=/var/log/gitlab-runner.log}" +: "${timeout:=300}" +: "${retry:=60}" +: "${command_user:=gitlab-runner:gitlab-runner}" +export CONFIG_FILE + +command="/usr/bin/gitlab-runner" +command_args="run --service ${RC_SVCNAME} ${command_args}" +command_background="true" +start_stop_daemon_args="--stdout ${logfile} --stderr ${logfile}" +pidfile="/run/${RC_SVCNAME}.pid" + +extra_started_commands="reload gracefulstop" +description_reload="Reload configuration" +description_gracefulstop="Finish current jobs, then stop" + +start_pre() { + checkpath -f -m 640 -o "${command_user}" "${logfile}" +} + +reload() { + ebegin "Reloading ${RC_SVCNAME} configuration" + start-stop-daemon --quiet --signal HUP --pidfile "${pidfile}" + eend $? +} + +gracefulstop() { + ebegin "Gracefully stopping ${RC_SVCNAME}" + mark_service_stopping "${RC_SERVICE}" + start-stop-daemon --quiet --progress --stop --pidfile "${pidfile}" \ + --signal QUIT --retry "${timeout}" + if eend $?; then + mark_service_stopped "${RC_SVCNAME}" + else + eerror "${RC_SVCNAME} timed out, forcefully stopping" + if stop; then + mark_service_stopped "${RC_SVCNAME}" + else + return 1 + fi + fi +} diff --git a/user/gitlab-runner/gitlab-runner.pre-install b/user/gitlab-runner/gitlab-runner.pre-install new file mode 100644 index 000000000..9ef046f29 --- /dev/null +++ b/user/gitlab-runner/gitlab-runner.pre-install @@ -0,0 +1,7 @@ +#!/bin/sh + +groupadd -r gitlab-runner 2>/dev/null +useradd -c gitlab-runner -s /sbin/nologin -g gitlab-runner \ + -d /var/lib/gitlab-runner -r gitlab-runner 2>/dev/null + +exit 0 diff --git a/user/gitlab-runner/tests.patch b/user/gitlab-runner/tests.patch new file mode 100644 index 000000000..0762b6b13 --- /dev/null +++ b/user/gitlab-runner/tests.patch @@ -0,0 +1,28 @@ +--- gitlab-runner-v12.1.0/shells/bash_test.go 2019-07-19 12:13:32.000000000 +0000 ++++ gitlab-runner-v12.1.0/shells/bash_test.go 2020-04-27 00:07:06.763360621 +0000 +@@ -16,12 +16,12 @@ func TestBash_CommandShellEscapes(t *tes + writer := &BashWriter{useNewEscape: false} + writer.Command("foo", "x&(y)") + +- assert.Equal(t, `$'foo' "x&(y)"`+"\n", writer.String()) ++ assert.Equal(t, `'foo' "x&(y)"`+"\n", writer.String()) + } + + func TestBash_IfCmdShellEscapesLegacy(t *testing.T) { + writer := &BashWriter{useNewEscape: false} + writer.IfCmd("foo", "x&(y)") + +- assert.Equal(t, `if $'foo' "x&(y)" >/dev/null 2>&1; then`+"\n", writer.String()) ++ assert.Equal(t, `if 'foo' "x&(y)" >/dev/null 2>/dev/null; then`+"\n", writer.String()) + } +--- gitlab-runner-v12.1.0/common/build_test.go 2019-07-19 12:13:32.000000000 +0000 ++++ gitlab-runner-v12.1.0/common/build_test.go 2020-04-27 00:23:35.173376249 +0000 +@@ -1255,7 +1255,7 @@ func TestWaitForTerminal(t *testing.T) { + }, + jobTimeout: 3600, + waitForTerminalTimeout: time.Hour, +- expectedErr: "terminal disconnected by system signal: interrupt", ++ expectedErr: "terminal disconnected by system signal: Interrupt", + }, + { + name: "Terminal Disconnect", |