From 86739ddf2ff3a5e283fc2b22a5a4be47d2daab33 Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Fri, 25 Sep 2020 23:17:11 +0200 Subject: [PATCH 1/2] dev-util/drone: Add ebuild for drone 1.9.1; targeted at systemd. Package-Manager: Portage-3.0.4, Repoman-3.0.1 --- dev-util/drone/ChangeLog | 6 +++++ dev-util/drone/Manifest | 6 ++++- dev-util/drone/drone-1.9.1.ebuild | 43 ++++++++++++++++++++++++++++++ dev-util/drone/files/app.ini | 34 +++++++++++++++++++++++ dev-util/drone/files/drone.service | 32 ++++++++++++++++++++++ dev-util/drone/files/drone.sh | 29 ++++++++++++++++++++ 6 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 dev-util/drone/drone-1.9.1.ebuild create mode 100644 dev-util/drone/files/app.ini create mode 100644 dev-util/drone/files/drone.service create mode 100755 dev-util/drone/files/drone.sh diff --git a/dev-util/drone/ChangeLog b/dev-util/drone/ChangeLog index da53d5c..e92a68c 100644 --- a/dev-util/drone/ChangeLog +++ b/dev-util/drone/ChangeLog @@ -1,3 +1,9 @@ +*drone-1.9.1 (25 Sep 2020) + + 25 Sep 2020; Manuel Friedli +drone-1.9.1.ebuild, + +files/app.ini, +files/drone.service, +files/drone.sh: + dev-util/drone: Add ebuild for drone 1.9.1; targeted at systemd. + *drone-1.5.1 (01 Oct 2019) 01 Oct 2019; +drone-1.5.1.ebuild, diff --git a/dev-util/drone/Manifest b/dev-util/drone/Manifest index 6f3fd27..9577af1 100644 --- a/dev-util/drone/Manifest +++ b/dev-util/drone/Manifest @@ -1,8 +1,12 @@ +AUX app.ini 1447 BLAKE2B 24e525c2863dd72bbca507ba18fa2d5df67923ca3d2ecb20023d8ecac6fecf0abc9008353b8b659c912d35bb6248413229449512b2fcf7a5fa969f5cde872130 SHA512 b1856df8a8c1501be8196e7a0f0f821617dfe0f20ab1c436438d5874984772af57dd4d3a6e58df684ade9d73462670287409b56e47d8148a7fdb454a95d82ef7 AUX drone-1.2.3.confd 1272 BLAKE2B 9722097b271e1b688559d2fbcd0e91decc03deaf868e91c62fe26c88b4f72806fc0fd628f4b47750ff707904bd88c5223ae58f0360a1c563ffe7bb11e08446fc SHA512 3960d26f6fa41eb3c6e9ccc719ac6c6ff7508f72c82507b2b2d5a6e7b88ce894933ee24ea73f2bc3c1a4460d12db78877805369def378f7d1d499c498a7a4f50 AUX drone-1.2.3.initd 1893 BLAKE2B 341983efd9f7e40f702d78782f9d0bc29ca4e919057dde742a4d49291fea61af82b0e474232f83b361894925608919674c7620447743e7b1c4b4bca70db52997 SHA512 887984ae903f2b162cb43b8fb5b5019f742a1891208a3f3f54ef6681a32aa279bcf4b9c758dc7652abbfd245bc2af38c0c199ff90b4a88c6bc00d55942592df2 AUX drone-1.5.1.confd 1272 BLAKE2B 9722097b271e1b688559d2fbcd0e91decc03deaf868e91c62fe26c88b4f72806fc0fd628f4b47750ff707904bd88c5223ae58f0360a1c563ffe7bb11e08446fc SHA512 3960d26f6fa41eb3c6e9ccc719ac6c6ff7508f72c82507b2b2d5a6e7b88ce894933ee24ea73f2bc3c1a4460d12db78877805369def378f7d1d499c498a7a4f50 AUX drone-1.5.1.initd 1851 BLAKE2B b7b865575537f2c867140451301e7eccf9a49b28025d4e64c22a1d3c121db0438702a5541782355722523cd21dbcb02d464a1d85c0bb48c32b10343be8095977 SHA512 203ddc0bbc7538d1ece8c1db61808b41f86bef338aad49ffaa9d385a85f5c1c5c48cae3a9be0c5b48ddea1ff30e96ec0dca25de66b2359ec0d246eb7f274a8b1 +AUX drone.service 651 BLAKE2B 8c2a44a0a19190e53bc5c3b3a15d827af42b7e4f19931e9553552c6e4be91fe35c61836e51627b2c03effbcd0f2eecc585c341ea7f12be309f6b98a041ac4764 SHA512 15a3a5b0f02cf6da5b83c2417d8718e3bc388a22c46924d08c6df70d945344384b4dcaf87fc0655e6f6ebbf9a3b20790722579e29a9ef7ff515c5857ef5b3cdb +AUX drone.sh 737 BLAKE2B a643236b49b0ce9cc3c575d401ac9a52b194571d5b41e89408fb404f0c3ffbafdcd1a252a912993ab133c8d83adb1d6f4ba6e1ac196ac54689d239ec355c417f SHA512 05203f328c9f5fa262caf28f6629409075783a333cabb0ffacc9ee23d00ac8fe47d117dbd3bd02626491265fa131bd34b9d0641fd509031941cd13edc1235679 EBUILD drone-1.2.3.ebuild 523 BLAKE2B 20ec727b9488eab0e2c9c7eabc6845ec9705ad3bdfb70803cefc52a4e85ca87f81d9089272c60e3ace8860eb5260e6348aae9f8b719c478e69dca8207d8323bc SHA512 b3ba803d16f6cc8acffcd19c96c993f502551ff0388bf0e5dc6b8c87f7a9389e3da5390de0ec326db617aea96344a46fcb7095bac17280185b61cce06bc6905f EBUILD drone-1.5.1.ebuild 523 BLAKE2B 20ec727b9488eab0e2c9c7eabc6845ec9705ad3bdfb70803cefc52a4e85ca87f81d9089272c60e3ace8860eb5260e6348aae9f8b719c478e69dca8207d8323bc SHA512 b3ba803d16f6cc8acffcd19c96c993f502551ff0388bf0e5dc6b8c87f7a9389e3da5390de0ec326db617aea96344a46fcb7095bac17280185b61cce06bc6905f -MISC ChangeLog 801 BLAKE2B ded57c32d329ef697498e87e1409dd1af7fae906b1bd63821c39054edc9fc8f13eac015e680177f515a4ae976dd637b54f38952d166194233ff06b9fdc9a9a82 SHA512 deaaf36e118f94bb544e0ad92dd137a59d3656ac90dc7499ec5df98d5ccd6e52c3dd974ea8f622a9624197d075e3c726e04ccbb7075241da9c97d43bfaabdf3e +EBUILD drone-1.9.1.ebuild 782 BLAKE2B 325868991758b8156e0a16065533e5c8801a86d5d34ab5c87509a99e680d1a3c9cd9b43ec848e1ffdc110fcf5cfc200f03069df9b99d90fd8ca974e912695780 SHA512 1055794d14135666050bc887e137c942c7481df3fb3424e34504daf097bf571a261e9f7592d05a06346ab651a5d62c4ad90b9d0777c4ab16f4c127d30208bb62 +MISC ChangeLog 1025 BLAKE2B a0e98c24a5800a70d1bc8b8bda2b9d6f955045737d21e4010a3b7ef648a485007b59b5e30ff74bacc670b1f4395dcfcd785fd41be6a72e67304f64ab0f4eab04 SHA512 f6d2b772920da26b74ff4ed7304fd42263ae46c9096202bfa135ba8e2d3e7cc50a5c3a765bf30238ec84fb41dfc393036cc3aad6776a76617d9a49352a074678 MISC metadata.xml 248 BLAKE2B cb50cad2c614a99daa2e236f9e0d0fab1ab20a898c0b0f0c28a1387820ab1f2b9dd4d396a3b38f732b493824f96a29ee5894e80e09dbd08dff62c1aaba3feaa0 SHA512 29f9b96b0a77546cce6a8bffd82fae2fd0939d32a7a05ffd0d91f9250a019a3ddaa599b93988c82daabb9c4c4b284dd947e2c47f6ca7727b8539cffa91bcb8c2 diff --git a/dev-util/drone/drone-1.9.1.ebuild b/dev-util/drone/drone-1.9.1.ebuild new file mode 100644 index 0000000..63cecd3 --- /dev/null +++ b/dev-util/drone/drone-1.9.1.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 - Automate Software Testing and Delivery" +HOMEPAGE="https://drone.io/" +#SRC_URI="" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64" +IUSE="sqlite mysql" + +RESTRICT="mirror" +DEPEND="" +RDEPEND="acct-user/drone + app-emulation/docker + sqlite? ( dev-db/sqlite:3 ) + mysql? ( dev-db/mysql ) +" + +S="${WORKDIR}" + +src_prepare() { + sed -e "s//${PV}/g" "${FILESDIR}/drone.sh" > "${T}/drone.sh" + + eapply_user +} + +src_install() { + exeinto /usr/bin + doexe "${T}/drone.sh" + + systemd_dounit "${FILESDIR}/${PN}.service" + + insinto "/etc/drone" + doins "${FILESDIR}/app.ini" + fowners drone:drone /etc/drone/app.ini + fperms 0600 /etc/drone/app.ini +} diff --git a/dev-util/drone/files/app.ini b/dev-util/drone/files/app.ini new file mode 100644 index 0000000..767be69 --- /dev/null +++ b/dev-util/drone/files/app.ini @@ -0,0 +1,34 @@ +# Drone configuration file. See https://docs.drone.io/server/reference/ for a +# complete list of configuration options. + +# Required string value provides your Gitea oauth Client ID. +DRONE_GITEA_CLIENT_ID="your-id-goes-here" + +# Required string value provides your Gitea oauth Client Secret. +DRONE_GITEA_CLIENT_SECRET="your-secret-goes-here" + +# Required string value provides your Gitea server address. For example +# https://gitea.company.com +DRONE_GITEA_SERVER="https://gitea-server.example.com/" + +# Required string value provides the shared secret generated in the previous +# step. This is used to authenticate the rpc connection between the server and +# runners. The server and runner must be provided the same secret value. +DRONE_RPC_SECRET="your-rpc-secret-goes-here" + +# Required string value provides your external hostname or IP address. If using +# an IP address you may include the port. For example drone.company.com. +DRONE_SERVER_HOST="drone-ci.example.com" + +# Required string value provides your external protocol scheme. This value +# should be set to http or https. This field defaults to https if you configure +# ssl or acme. +DRONE_SERVER_PROTO="https" + +# Optional boolean value configures Drone to authenticate when cloning public +# repositories. +# DRONE_GIT_ALWAYS_AUTH=true + +# Required string value configures ports to publish for docker: space-separated +# list of : tuples +DOCKER_PUBLISH="8080:80 8443:443" diff --git a/dev-util/drone/files/drone.service b/dev-util/drone/files/drone.service new file mode 100644 index 0000000..b656826 --- /dev/null +++ b/dev-util/drone/files/drone.service @@ -0,0 +1,32 @@ +[Unit] +Description=drone.io build server +Documentation=https://docs.drone.io/ + +AssertPathIsDirectory=/var/lib/drone +AssertPathIsReadWrite=/var/lib/drone + +After=network.target +Requires=network.target +After=mysqld.target +After=postgresql-9.3.service +After=postgresql-9.4.service +After=postgresql-9.5.service +After=postgresql-9.6.service +After=postgresql-10.service +After=postgresql-11.service +After=postgresql-12.service + +[Service] +User=drone +Group=drone + +Environment="DRONE_CONFIG_FILE=/etc/drone/app.ini" + +ExecStart=drone.sh +ExecStop=docker container stop drone +ExecStop=docker container rm drone + +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/dev-util/drone/files/drone.sh b/dev-util/drone/files/drone.sh new file mode 100755 index 0000000..00d027f --- /dev/null +++ b/dev-util/drone/files/drone.sh @@ -0,0 +1,29 @@ +#!/bin/sh +# $DRONE_CONFIG_FILE contains path to the config file + +if [[ -z "${DRONE_CONFIG_FILE}" ]] ; then + echo "DRONE_CONFIG_FILE not set!" + exit 1 +fi + +. "${DRONE_CONFIG_FILE}" + +publishes="" + +for p in ${DOCKER_PUBLISH} ; do + publishes="${publishes} --publish=${p}" +done + +docker run \ + --volume=/var/lib/drone:/data \ + --env=DRONE_GITEA_SERVER=${DRONE_GITEA_SERVER} \ + --env=DRONE_GITEA_CLIENT_ID=${DRONE_GITEA_CLIENT_ID} \ + --env=DRONE_GITEA_CLIENT_SECRET=${DRONE_GITEA_CLIENT_SECRET} \ + --env=DRONE_RPC_SECRET=${DRONE_RPC_SECRET} \ + --env=DRONE_SERVER_HOST=${DRONE_SERVER_HOST} \ + --env=DRONE_SERVER_PROTO=${DRONE_SERVER_PROTO} \ + ${publishes} \ + --restart=always \ + --detach=true \ + --name=drone \ + drone/drone: From ba2959aeada10465992e7f1eab7e6c947fe9b471 Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Fri, 25 Sep 2020 23:46:10 +0200 Subject: [PATCH 2/2] dev-util/drone: Handle all variables in config file generically. Package-Manager: Portage-3.0.4, Repoman-3.0.1 --- dev-util/drone/ChangeLog | 4 ++++ dev-util/drone/Manifest | 6 +++--- dev-util/drone/drone-1.9.1.ebuild | 3 +++ dev-util/drone/files/drone.sh | 16 +++++++--------- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/dev-util/drone/ChangeLog b/dev-util/drone/ChangeLog index e92a68c..c0855a0 100644 --- a/dev-util/drone/ChangeLog +++ b/dev-util/drone/ChangeLog @@ -1,3 +1,7 @@ + 25 Sep 2020; Manuel Friedli drone-1.9.1.ebuild, + files/drone.sh: + dev-util/drone: Handle all variables in config file generically. + *drone-1.9.1 (25 Sep 2020) 25 Sep 2020; Manuel Friedli +drone-1.9.1.ebuild, diff --git a/dev-util/drone/Manifest b/dev-util/drone/Manifest index 9577af1..19a69ae 100644 --- a/dev-util/drone/Manifest +++ b/dev-util/drone/Manifest @@ -4,9 +4,9 @@ AUX drone-1.2.3.initd 1893 BLAKE2B 341983efd9f7e40f702d78782f9d0bc29ca4e919057dd AUX drone-1.5.1.confd 1272 BLAKE2B 9722097b271e1b688559d2fbcd0e91decc03deaf868e91c62fe26c88b4f72806fc0fd628f4b47750ff707904bd88c5223ae58f0360a1c563ffe7bb11e08446fc SHA512 3960d26f6fa41eb3c6e9ccc719ac6c6ff7508f72c82507b2b2d5a6e7b88ce894933ee24ea73f2bc3c1a4460d12db78877805369def378f7d1d499c498a7a4f50 AUX drone-1.5.1.initd 1851 BLAKE2B b7b865575537f2c867140451301e7eccf9a49b28025d4e64c22a1d3c121db0438702a5541782355722523cd21dbcb02d464a1d85c0bb48c32b10343be8095977 SHA512 203ddc0bbc7538d1ece8c1db61808b41f86bef338aad49ffaa9d385a85f5c1c5c48cae3a9be0c5b48ddea1ff30e96ec0dca25de66b2359ec0d246eb7f274a8b1 AUX drone.service 651 BLAKE2B 8c2a44a0a19190e53bc5c3b3a15d827af42b7e4f19931e9553552c6e4be91fe35c61836e51627b2c03effbcd0f2eecc585c341ea7f12be309f6b98a041ac4764 SHA512 15a3a5b0f02cf6da5b83c2417d8718e3bc388a22c46924d08c6df70d945344384b4dcaf87fc0655e6f6ebbf9a3b20790722579e29a9ef7ff515c5857ef5b3cdb -AUX drone.sh 737 BLAKE2B a643236b49b0ce9cc3c575d401ac9a52b194571d5b41e89408fb404f0c3ffbafdcd1a252a912993ab133c8d83adb1d6f4ba6e1ac196ac54689d239ec355c417f SHA512 05203f328c9f5fa262caf28f6629409075783a333cabb0ffacc9ee23d00ac8fe47d117dbd3bd02626491265fa131bd34b9d0641fd509031941cd13edc1235679 +AUX drone.sh 511 BLAKE2B dee9cb484102f92ad1eec6c63e8a008aa7fb11dbf3594bf8d281fae052f822606c2980c82ad5ff033124f7c6d92c92a16ff895ca371326bc85f33325a9f27916 SHA512 6874cbb4ab3972f8f791d419ad57832187d739da6e11eda81a06273d8235502a03761a7b3ba1aed09689c95e5f1a53826a0dd154c85e3a96dc21cb59b4745740 EBUILD drone-1.2.3.ebuild 523 BLAKE2B 20ec727b9488eab0e2c9c7eabc6845ec9705ad3bdfb70803cefc52a4e85ca87f81d9089272c60e3ace8860eb5260e6348aae9f8b719c478e69dca8207d8323bc SHA512 b3ba803d16f6cc8acffcd19c96c993f502551ff0388bf0e5dc6b8c87f7a9389e3da5390de0ec326db617aea96344a46fcb7095bac17280185b61cce06bc6905f EBUILD drone-1.5.1.ebuild 523 BLAKE2B 20ec727b9488eab0e2c9c7eabc6845ec9705ad3bdfb70803cefc52a4e85ca87f81d9089272c60e3ace8860eb5260e6348aae9f8b719c478e69dca8207d8323bc SHA512 b3ba803d16f6cc8acffcd19c96c993f502551ff0388bf0e5dc6b8c87f7a9389e3da5390de0ec326db617aea96344a46fcb7095bac17280185b61cce06bc6905f -EBUILD drone-1.9.1.ebuild 782 BLAKE2B 325868991758b8156e0a16065533e5c8801a86d5d34ab5c87509a99e680d1a3c9cd9b43ec848e1ffdc110fcf5cfc200f03069df9b99d90fd8ca974e912695780 SHA512 1055794d14135666050bc887e137c942c7481df3fb3424e34504daf097bf571a261e9f7592d05a06346ab651a5d62c4ad90b9d0777c4ab16f4c127d30208bb62 -MISC ChangeLog 1025 BLAKE2B a0e98c24a5800a70d1bc8b8bda2b9d6f955045737d21e4010a3b7ef648a485007b59b5e30ff74bacc670b1f4395dcfcd785fd41be6a72e67304f64ab0f4eab04 SHA512 f6d2b772920da26b74ff4ed7304fd42263ae46c9096202bfa135ba8e2d3e7cc50a5c3a765bf30238ec84fb41dfc393036cc3aad6776a76617d9a49352a074678 +EBUILD drone-1.9.1.ebuild 839 BLAKE2B e6819be8b37ee37213f718dae0cbf479ced61927048f44a2f24f2c8c82646cbeab4e9ae69bffe9ff07810adc75ef26ae521e084ce8754d38d693d8fbd9fe5a84 SHA512 ae132e180e0d3f86468e6de16dfaeb6a2a24f8ed98fce56ec7d01d11b720d500a30fed79bd1282d90058c1b1a3346c61a0a97e8214101156b44b099e292f2e17 +MISC ChangeLog 1181 BLAKE2B 859c5070401bb193f10a9ab9cbcba93994a61ed0897c0d1416b15605ff4f8a879630a0909f90fb16dcab472ffe9c3ef206f275aad31bcdfd5335090ddd5a3c2e SHA512 b36d542bae9266e7f749e41faf6e6c7ccc5a960bb0c67a8153645ae34f87a80fefce5141e7efc9d5e9e3ddb879543037af96359f0784b7f15ab9b28424e8ddc1 MISC metadata.xml 248 BLAKE2B cb50cad2c614a99daa2e236f9e0d0fab1ab20a898c0b0f0c28a1387820ab1f2b9dd4d396a3b38f732b493824f96a29ee5894e80e09dbd08dff62c1aaba3feaa0 SHA512 29f9b96b0a77546cce6a8bffd82fae2fd0939d32a7a05ffd0d91f9250a019a3ddaa599b93988c82daabb9c4c4b284dd947e2c47f6ca7727b8539cffa91bcb8c2 diff --git a/dev-util/drone/drone-1.9.1.ebuild b/dev-util/drone/drone-1.9.1.ebuild index 63cecd3..685f9b4 100644 --- a/dev-util/drone/drone-1.9.1.ebuild +++ b/dev-util/drone/drone-1.9.1.ebuild @@ -38,6 +38,9 @@ src_install() { insinto "/etc/drone" doins "${FILESDIR}/app.ini" + + fowners drone:drone /etc/drone + fperms 0700 /etc/drone fowners drone:drone /etc/drone/app.ini fperms 0600 /etc/drone/app.ini } diff --git a/dev-util/drone/files/drone.sh b/dev-util/drone/files/drone.sh index 00d027f..e2de059 100755 --- a/dev-util/drone/files/drone.sh +++ b/dev-util/drone/files/drone.sh @@ -8,21 +8,19 @@ fi . "${DRONE_CONFIG_FILE}" -publishes="" +docker_args="" + +for var in "${!DRONE_@}" ; do + docker_args="${docker_args} --env=${var}=${!var} " +done for p in ${DOCKER_PUBLISH} ; do - publishes="${publishes} --publish=${p}" + docker_args="${docker_args} --publish=${p}" done docker run \ --volume=/var/lib/drone:/data \ - --env=DRONE_GITEA_SERVER=${DRONE_GITEA_SERVER} \ - --env=DRONE_GITEA_CLIENT_ID=${DRONE_GITEA_CLIENT_ID} \ - --env=DRONE_GITEA_CLIENT_SECRET=${DRONE_GITEA_CLIENT_SECRET} \ - --env=DRONE_RPC_SECRET=${DRONE_RPC_SECRET} \ - --env=DRONE_SERVER_HOST=${DRONE_SERVER_HOST} \ - --env=DRONE_SERVER_PROTO=${DRONE_SERVER_PROTO} \ - ${publishes} \ + ${docker_args} --restart=always \ --detach=true \ --name=drone \