From cd6b8380be95633578e1f60d8c578d24cc04df77 Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Sat, 26 Sep 2020 01:30:29 +0200 Subject: [PATCH] dev-util/drone-runner-docker: Initial add Package-Manager: Portage-3.0.4, Repoman-3.0.1 --- dev-util/drone-runner-docker/ChangeLog | 7 +++ dev-util/drone-runner-docker/Manifest | 6 +++ .../drone-runner-docker-1.5.2.ebuild | 43 +++++++++++++++++++ dev-util/drone-runner-docker/files/app.ini | 19 ++++++++ .../files/drone-runner-docker.service | 21 +++++++++ .../files/drone-runner-docker.sh | 29 +++++++++++++ dev-util/drone-runner-docker/metadata.xml | 8 ++++ 7 files changed, 133 insertions(+) create mode 100644 dev-util/drone-runner-docker/ChangeLog create mode 100644 dev-util/drone-runner-docker/Manifest create mode 100644 dev-util/drone-runner-docker/drone-runner-docker-1.5.2.ebuild create mode 100644 dev-util/drone-runner-docker/files/app.ini create mode 100644 dev-util/drone-runner-docker/files/drone-runner-docker.service create mode 100755 dev-util/drone-runner-docker/files/drone-runner-docker.sh create mode 100644 dev-util/drone-runner-docker/metadata.xml diff --git a/dev-util/drone-runner-docker/ChangeLog b/dev-util/drone-runner-docker/ChangeLog new file mode 100644 index 0000000..a30dd94 --- /dev/null +++ b/dev-util/drone-runner-docker/ChangeLog @@ -0,0 +1,7 @@ +*drone-runner-docker-1.5.2 (25 Sep 2020) + + 25 Sep 2020; Manuel Friedli + +drone-runner-docker-1.5.2.ebuild, +files/app.ini, + +files/drone-runner-docker.service, +files/drone-runner-docker.sh, + +metadata.xml: + dev-util/drone-runner-docker: Initial add diff --git a/dev-util/drone-runner-docker/Manifest b/dev-util/drone-runner-docker/Manifest new file mode 100644 index 0000000..1645d68 --- /dev/null +++ b/dev-util/drone-runner-docker/Manifest @@ -0,0 +1,6 @@ +AUX app.ini 921 BLAKE2B 99a23edacd0be7c6717b941630d5b538a86542de835255bd609c15a39f72ff9c2e7fd6df2f65f480e922154e9acdc3ead8d1e861bba889ba30ad6debd46c32e5 SHA512 334a2458c745e1f52e82f0d62bdcb52dd673104154335acd23aca94c2f99893b6ee4432fc1ca15672a98293f27ed8948f3553c2f51d9caec594f7d85aea38094 +AUX drone-runner-docker.service 432 BLAKE2B 8be4bb0d2efd765803fcc45fdd6c2d7d97fb7683df829d0081043da2ba63310536a8a532a622853eecd581d48d4ba9f31bb3237a0c2b251b932652ecebdaf5d0 SHA512 da061aa51fe04907a5ffb2747b3e467709f07d8515335a8bd1c53ed29cbf8b8b8090be23d81f96ec233f888f73dea18cad6d3f8a9b15575e0e94fbb928b8c104 +AUX drone-runner-docker.sh 612 BLAKE2B becd739d917e1c924deeb297749034639591e02f5f3f11a60241b74d8edfd927f098ca17a5ccedc5d470b8279715eab9e92ae6d21d78b6d81f059089cb89d8be SHA512 ed2c6ce725467ca038eed6a66974a76bc61931aea89eed33ee4a1752cc30000d08671c52f84be1c582f3beb2ebbddf9240f975cfdb1a543abe527465ea5ff6a0 +EBUILD drone-runner-docker-1.5.2.ebuild 922 BLAKE2B 9c2fa3bc7956ad881f90c5c2503b9075fc9409e32099825c01c9da64e9d4559cf646fe597470e7527843ce308b9a24c88356e7d7ccb9dedf3f25da6dd96aff1f SHA512 8355b65eca92a74f34ed81878b3d1627ea9a80334f8c83eb17cba1527cb76adfe47c599afcf97de9a12650af679fe2109ab71c594541d174d35b01428399a0a4 +MISC ChangeLog 275 BLAKE2B 67c14a948b0436c7de1433b30b641ae060a0ef8bf57275226168f69ee593473c12c278b568c68b1669a22a939977951b74989ab448b6f134727fbf17f3d36d61 SHA512 aa0cdb4e143b77415602bc854c7c4ec3c7005dce01fa7ac3919670288c0e398cf266a69883995808ad04819e5acea7354d3fc514fc705a46483f40e750bba96e +MISC metadata.xml 248 BLAKE2B cb50cad2c614a99daa2e236f9e0d0fab1ab20a898c0b0f0c28a1387820ab1f2b9dd4d396a3b38f732b493824f96a29ee5894e80e09dbd08dff62c1aaba3feaa0 SHA512 29f9b96b0a77546cce6a8bffd82fae2fd0939d32a7a05ffd0d91f9250a019a3ddaa599b93988c82daabb9c4c4b284dd947e2c47f6ca7727b8539cffa91bcb8c2 diff --git a/dev-util/drone-runner-docker/drone-runner-docker-1.5.2.ebuild b/dev-util/drone-runner-docker/drone-runner-docker-1.5.2.ebuild new file mode 100644 index 0000000..b6f5a5a --- /dev/null +++ b/dev-util/drone-runner-docker/drone-runner-docker-1.5.2.ebuild @@ -0,0 +1,43 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="7" + +inherit systemd + +DESCRIPTION="Drone CI - Docker Runner" +HOMEPAGE="https://drone.io/" +#SRC_URI="" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64" + +RESTRICT="mirror" +DEPEND="" +RDEPEND="acct-user/drone-runner-docker + app-emulation/docker +" + +S="${WORKDIR}" + +src_prepare() { + sed -e "s//${PV}/g" "${FILESDIR}/drone-runner-docker.sh" > "${T}/drone-runner-docker.sh" + + eapply_user +} + +src_install() { + exeinto /usr/bin + doexe "${T}/drone-runner-docker.sh" + + systemd_dounit "${FILESDIR}/${PN}.service" + + insinto "/etc/drone-runner-docker" + doins "${FILESDIR}/app.ini" + + fowners drone-runner-docker:drone-runner-docker /etc/drone-runner-docker + fperms 0700 /etc/drone-runner-docker + fowners drone-runner-docker:drone-runner-docker /etc/drone-runner-docker/app.ini + fperms 0600 /etc/drone-runner-docker/app.ini +} diff --git a/dev-util/drone-runner-docker/files/app.ini b/dev-util/drone-runner-docker/files/app.ini new file mode 100644 index 0000000..a633a06 --- /dev/null +++ b/dev-util/drone-runner-docker/files/app.ini @@ -0,0 +1,19 @@ +# Drone docker runner configuration file. See +# https://docs.drone.io/runner/docker/configuration/reference/ for a complete +# list of configuration options. + +# provides the hostname (and optional port) of your Drone server. The runner connects to the server at the host address to receive pipelines for execution. +DRONE_RPC_HOST="drone.example.com" + +# provides the protocol used to connect to your Drone server. The value must be either http or https. +DRONE_RPC_PROTO="https" + +# provides the shared secret used to authenticate with your Drone server. This must match the secret defined in your Drone server configuration. +DRONE_RPC_SECRET="your-secret-goes-here" + +# Required string value configures ports to publish for docker: space-separated +# list of : tuples. +DOCKER_PUBLISH="3000:3000" + +# Optional string value of extra args passed verbatim to the docker command. +DOCKER_DRONE_EXTRA_ARGS="" diff --git a/dev-util/drone-runner-docker/files/drone-runner-docker.service b/dev-util/drone-runner-docker/files/drone-runner-docker.service new file mode 100644 index 0000000..ed97e4b --- /dev/null +++ b/dev-util/drone-runner-docker/files/drone-runner-docker.service @@ -0,0 +1,21 @@ +[Unit] +Description=drone.io docker runner +Documentation=https://docs.drone.io/ + +After=network.target +Requires=network.target + +[Service] +User=drone-runner-docker +Group=drone-runner-docker + +Environment="RUNNER_CONFIG_FILE=/etc/drone-runner-docker/app.ini" + +ExecStart=drone-runner-docker.sh +ExecStop=docker container stop drone-runner +ExecStop=docker container rm drone-runner + +Restart=on-failure + +[Install] +WantedBy=multi-user.target diff --git a/dev-util/drone-runner-docker/files/drone-runner-docker.sh b/dev-util/drone-runner-docker/files/drone-runner-docker.sh new file mode 100755 index 0000000..d7ee129 --- /dev/null +++ b/dev-util/drone-runner-docker/files/drone-runner-docker.sh @@ -0,0 +1,29 @@ +#!/bin/sh +# $RUNNER_CONFIG_FILE contains path to the config file + +if [[ -z "${RUNNER_CONFIG_FILE}" ]] ; then + echo "RUNNER_CONFIG_FILE not set!" + exit 1 +fi + +. "${RUNNER_CONFIG_FILE}" + +docker_args="" + +for var in "${!DRONE_@}" ; do + docker_args="${docker_args} --env=${var}=${!var}" +done + +for p in ${DOCKER_PUBLISH} ; do + docker_args="${docker_args} --publish=${p}" +done + +docker_args="${docker_args} ${DOCKER_DRONE_EXTRA_ARGS}" + +docker run \ + --volume=/run/docker.sock:/var/run/docker.sock \ + ${docker_args} \ + --restart=always \ + --detach=false \ + --name=drone-runner \ + drone/drone-runner-docker: diff --git a/dev-util/drone-runner-docker/metadata.xml b/dev-util/drone-runner-docker/metadata.xml new file mode 100644 index 0000000..67a771c --- /dev/null +++ b/dev-util/drone-runner-docker/metadata.xml @@ -0,0 +1,8 @@ + + + + + manuel@fritteli.ch + Manuel Friedli + + -- 2.45.2