Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/gitlab-runner/files/, dev-util/gitlab-runner/
Date: Sun, 27 Mar 2022 22:15:07
Message-Id: 1648419283.1245d3fb758b18e5799e502e97cad3282a9f7bb6.williamh@gentoo
1 commit: 1245d3fb758b18e5799e502e97cad3282a9f7bb6
2 Author: William Hubbs <williamh <AT> gentoo <DOT> org>
3 AuthorDate: Sun Mar 27 22:13:38 2022 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Sun Mar 27 22:14:43 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1245d3fb
7
8 dev-util/gitlab-runner: initial import
9
10 Signed-off-by: William Hubbs <williamh <AT> gentoo.org>
11
12 dev-util/gitlab-runner/Manifest | 2 +
13 dev-util/gitlab-runner/files/gitlab-runner.confd | 19 +++++++
14 dev-util/gitlab-runner/files/gitlab-runner.initd | 35 +++++++++++++
15 dev-util/gitlab-runner/files/gitlab-runner.service | 18 +++++++
16 dev-util/gitlab-runner/files/gitlab-runner.tmpfile | 1 +
17 dev-util/gitlab-runner/gitlab-runner-14.9.1.ebuild | 60 ++++++++++++++++++++++
18 dev-util/gitlab-runner/metadata.xml | 12 +++++
19 7 files changed, 147 insertions(+)
20
21 diff --git a/dev-util/gitlab-runner/Manifest b/dev-util/gitlab-runner/Manifest
22 new file mode 100644
23 index 000000000000..a6b0f0003131
24 --- /dev/null
25 +++ b/dev-util/gitlab-runner/Manifest
26 @@ -0,0 +1,2 @@
27 +DIST gitlab-runner-14.9.1-deps.tar.xz 142907928 BLAKE2B fb61c7b03d3dd63196bb4de0042a3c65035a3fc132435d7844635bb968a6bfe43e05fca053bfa96ba22cc9fd601d533857bffdf8bd734e90e86fefce8091da34 SHA512 d077cc1220ad33196655e578937c910c7b368eef57bb96d385eac0957e5f8902bb3720b1614f3179753929f25589a8d1d543bcb61d4cf5972bf4ada96a4056d8
28 +DIST gitlab-runner-14.9.1.tar.gz 1259997 BLAKE2B a4694198630fb2cc47ad4e9fe36b366ae695d8a4618e755b9ff12b608d5d8266614cc649b0e63bca125919ebe8dd40859fc7804cd8bb40ed391a54d6ae65a325 SHA512 ec804f3a4982414d52a4f3b5ff1560c5342a3650f1bb3edefa211a3810b17e202263abc67bfcd4423fe88b5acd501da1d23f3980a078800ab25932625ff75bc5
29
30 diff --git a/dev-util/gitlab-runner/files/gitlab-runner.confd b/dev-util/gitlab-runner/files/gitlab-runner.confd
31 new file mode 100644
32 index 000000000000..513b2f9cef18
33 --- /dev/null
34 +++ b/dev-util/gitlab-runner/files/gitlab-runner.confd
35 @@ -0,0 +1,19 @@
36 +# config file for /etc/init.d/gitlab-runner
37 +# The convention is that the defaults are shown here, commented out.
38 +# Do not override these unless you know exactly what you are doing.
39 +
40 +# runner_config="/etc/gitlab-runner/config.toml"
41 +# runner_datadir="/var/lib/gitlab-runner"
42 +# runner_service="${RC_SVCNAME}"
43 +# runner_user="gitlab-runner"
44 +
45 +# Additional options
46 +# run /usr/bin/gitlab-runner -h to see available options
47 +# --config, --user, --service and --working-directory are set by the
48 +# above variables, so do not add them here.
49 +# RUNNER_OPTS=""
50 +
51 +# Logging
52 +# runner_logdir="/var/log/gitlab-runner"
53 +# output_log="${runner_logdir}/gitlab-runner.log"
54 +# error_log="${runner_logdir}/error.log"
55
56 diff --git a/dev-util/gitlab-runner/files/gitlab-runner.initd b/dev-util/gitlab-runner/files/gitlab-runner.initd
57 new file mode 100644
58 index 000000000000..8ae45b510fd0
59 --- /dev/null
60 +++ b/dev-util/gitlab-runner/files/gitlab-runner.initd
61 @@ -0,0 +1,35 @@
62 +#!/sbin/openrc-run
63 +# Copyright 1999-2018 Gentoo Authors
64 +# Distributed under the terms of the GNU General Public License v2
65 +
66 +command="/usr/bin/gitlab-runner"
67 +command_args="run
68 + --config ${runner_config:-/etc/gitlab-runner/config.toml}
69 + --service ${runner_service:-${RC_SVCNAME}}
70 + --user ${runner_user:-gitlab-runner}
71 + --working-directory ${runner_datadir:-/var/lib/gitlab-runner}
72 + ${RUNNER_OPTS}"
73 +command_background=true
74 +extra_started_commands="reload"
75 +name="${name:-GitLab Runner}"
76 +pidfile="/run/${RC_SVCNAME}.pid"
77 +output_log="${output_log:-${runner_logdir}/gitlab-runner.log"
78 +error_log="${error_log:-${runner_logdir}/gitlab-runner.err"
79 +retry="QUIT/60/TERM/60"
80 +required_files="${runner_config}"
81 +
82 +depend() {
83 + need localmount
84 + after net.lo loopback
85 +}
86 +
87 +start_pre() {
88 + checkpath -d -m 0700 -o "${runner_user}" "${runner_datadir}"
89 + checkpath -d -m 0750 -o "${runner_user}" "${runner_logdir}"
90 +}
91 +
92 +reload() {
93 + ebegin "Reloading ${name} configuration"
94 + start-stop-daemon --signal HUP --pidfile "${pidfile}"
95 + eend $? "Failed to reload ${name}"
96 +}
97
98 diff --git a/dev-util/gitlab-runner/files/gitlab-runner.service b/dev-util/gitlab-runner/files/gitlab-runner.service
99 new file mode 100644
100 index 000000000000..047de5cc7363
101 --- /dev/null
102 +++ b/dev-util/gitlab-runner/files/gitlab-runner.service
103 @@ -0,0 +1,18 @@
104 +[Unit]
105 +Description=GitLab Runner service
106 +After=syslog.target network.target
107 +ConditionFileIsExecutable=/usr/bin/gitlab-runner
108 +
109 +[Service]
110 +StartLimitInterval=5
111 +StartLimitBurst=10
112 +ExecStart=/usr/bin/gitlab-runner run -c /etc/gitlab-runner/config.toml -u gitlab-runner -d /var/lib/gitlab-runner --syslog
113 +Restart=always
114 +RestartSec=120
115 +StandardOutput=syslog
116 +StandardError=syslog
117 +SyslogIdentifier=gitlab-runner
118 +ExecReload=/bin/kill -HUP $MAINPID
119 +
120 +[Install]
121 +WantedBy=multi-user.target
122
123 diff --git a/dev-util/gitlab-runner/files/gitlab-runner.tmpfile b/dev-util/gitlab-runner/files/gitlab-runner.tmpfile
124 new file mode 100644
125 index 000000000000..40453089f869
126 --- /dev/null
127 +++ b/dev-util/gitlab-runner/files/gitlab-runner.tmpfile
128 @@ -0,0 +1 @@
129 +d /run/gitlab-runner 0755 gitlab-runner gitlab-runner
130
131 diff --git a/dev-util/gitlab-runner/gitlab-runner-14.9.1.ebuild b/dev-util/gitlab-runner/gitlab-runner-14.9.1.ebuild
132 new file mode 100644
133 index 000000000000..22780481d840
134 --- /dev/null
135 +++ b/dev-util/gitlab-runner/gitlab-runner-14.9.1.ebuild
136 @@ -0,0 +1,60 @@
137 +# Copyright 1999-2022 Gentoo Authors
138 +# Distributed under the terms of the GNU General Public License v2
139 +
140 +EAPI=8
141 +inherit go-module systemd tmpfiles
142 +GIT_COMMIT=bd40e3da
143 +
144 +DESCRIPTION="The official GitLab Runner, written in Go"
145 +HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-runner"
146 +SRC_URI="https://gitlab.com/gitlab-org/gitlab-runner/-/archive/v${PV}/${PN}-v${PV}.tar.gz -> ${P}.tar.gz"
147 +SRC_URI+=" https://dev.gentoo.org/~williamh/dist/${P}-deps.tar.xz"
148 +
149 +LICENSE="MIT"
150 +SLOT="0"
151 +KEYWORDS="~amd64"
152 +
153 +COMMON_DEPEND="acct-group/gitlab-runner
154 + acct-user/gitlab-runner"
155 +DEPEND="${COMMON_DEPEND}"
156 +RDEPEND="${COMMON_DEPEND}"
157 +BDEPEND="dev-go/gox"
158 +
159 +DOCS=( docs CHANGELOG.md README.md config.toml.example )
160 +
161 +S="${WORKDIR}/${PN}-v${PV}"
162 +
163 +src_compile() {
164 + emake \
165 + BUILT="$(date -u '+%Y-%m-%dT%H:%M:%S%:z')" \
166 + GOX="${EPREFIX}/usr/bin/gox" \
167 + REVISION=${GIT_COMMIT} \
168 + VERSION=${PV} \
169 + runner-bin-host
170 +}
171 +
172 +src_test() {
173 + ego test
174 +}
175 +
176 +src_install() {
177 + dobin out/binaries/gitlab-runner
178 + einstalldocs
179 +
180 + newconfd "${FILESDIR}/${PN}.confd" "${PN}"
181 + newinitd "${FILESDIR}/${PN}.initd" "${PN}"
182 + systemd_dounit "${FILESDIR}/${PN}.service"
183 + newtmpfiles "${FILESDIR}"/${PN}.tmpfile ${PN}.conf
184 + keepdir /{etc,var/log}/${PN}
185 + fowners gitlab-runner:gitlab-runner /{etc,var/log}/${PN}
186 + fperms 0700 /{etc,var/log}/gitlab-runner
187 +}
188 +
189 +pkg_postinst() {
190 + tmpfiles_process gitlab-runner.conf
191 + [[ -f ${EROOT}/etc/gitlab-runner/config.toml ]] && return
192 + elog
193 + elog "To use the runner, you need to register it with this command:"
194 + elog "# gitlab-runner register"
195 + elog "This will also create the configuration file in /etc/gitlab-runner/config.toml"
196 +}
197
198 diff --git a/dev-util/gitlab-runner/metadata.xml b/dev-util/gitlab-runner/metadata.xml
199 new file mode 100644
200 index 000000000000..3ec5d0dffffd
201 --- /dev/null
202 +++ b/dev-util/gitlab-runner/metadata.xml
203 @@ -0,0 +1,12 @@
204 +<?xml version="1.0" encoding="UTF-8"?>
205 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
206 +<pkgmetadata>
207 + <maintainer type="person">
208 + <email>williamh@g.o</email>
209 + <name>William Hubbs</name>
210 + </maintainer>
211 + <maintainer type="project">
212 + <email>infra@g.o</email>
213 + <name>Gentoo Infrastructure Project</name>
214 + </maintainer>
215 +</pkgmetadata>