diff options
author | Holger Hoffstätte <holger@applied-asynchrony.com> | 2024-04-26 16:58:18 +0200 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2024-07-04 20:13:40 -0700 |
commit | 2dfb57229e521d7be1d5a73e392c45033f285a24 (patch) | |
tree | a80d416970d89d9b6d67217769914e4fa148a2a3 /dev-util | |
parent | dev-util/buildbot-worker: sync live (diff) | |
download | gentoo-2dfb57229e521d7be1d5a73e392c45033f285a24.tar.gz gentoo-2dfb57229e521d7be1d5a73e392c45033f285a24.tar.bz2 gentoo-2dfb57229e521d7be1d5a73e392c45033f285a24.zip |
dev-util/webhook: add 2.8.1, various additions/improvements
This adds a proper OpenRC init script and out-of-the box configuration.
Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com>
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/36436
Closes: https://bugs.gentoo.org/870304
Diffstat (limited to 'dev-util')
-rw-r--r-- | dev-util/webhook/Manifest | 1 | ||||
-rw-r--r-- | dev-util/webhook/files/webhook.confd | 2 | ||||
-rw-r--r-- | dev-util/webhook/files/webhook.initd | 22 | ||||
-rw-r--r-- | dev-util/webhook/files/webhook.json.example | 13 | ||||
-rw-r--r-- | dev-util/webhook/files/webhook.logrotated | 3 | ||||
-rw-r--r-- | dev-util/webhook/webhook-2.8.1.ebuild | 84 |
6 files changed, 125 insertions, 0 deletions
diff --git a/dev-util/webhook/Manifest b/dev-util/webhook/Manifest index 26d74735e8a3..42e0a70ca85b 100644 --- a/dev-util/webhook/Manifest +++ b/dev-util/webhook/Manifest @@ -1 +1,2 @@ DIST webhook-2.7.0.tar.gz 1652898 BLAKE2B e6cf049b39d7fea689060e9e1e42f6386a7a671a10cc7d3fc288ea9285dc90e674a3a4b5fcb77ac5af8a8b1bbfee0a574b2ae94f8df296b64e15578c824f8500 SHA512 107db4f873aa66c9e9910eb7542edf18c3bd5b3509ff03d6e6947cb162d08101f5b11855c403d6a0a27fea8da693aaa2c995799670b73693c8fe2b2f50ac1da1 +DIST webhook-2.8.1.tar.gz 1657848 BLAKE2B 7e6dbea83614042c6dcf2e0b377933dee625bfd300e24530f0682b68945734e11e3d2d5bc34ef8b19936b3880cab7febfa39160a5eea988c4f882acf47d99cbd SHA512 25edff21725ba9ac8823dbe5728234f7cd9218027e87df3e2482ef365a7dd0efe8659800233753c275f858ff87f848ff6141d09be3e0b66ff88b795680b9b635 diff --git a/dev-util/webhook/files/webhook.confd b/dev-util/webhook/files/webhook.confd new file mode 100644 index 000000000000..6cc27e091955 --- /dev/null +++ b/dev-util/webhook/files/webhook.confd @@ -0,0 +1,2 @@ +# arguments for webhook +command_args="-ip=localhost -port=9000 -hooks=/etc/webhook.json -logfile=/var/log/webhook.log" diff --git a/dev-util/webhook/files/webhook.initd b/dev-util/webhook/files/webhook.initd new file mode 100644 index 000000000000..d87e8cce035f --- /dev/null +++ b/dev-util/webhook/files/webhook.initd @@ -0,0 +1,22 @@ +#!/sbin/openrc-run +# Copyright 2016-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +description="Webhook server" +pidfile=${pidfile:-"/run/${RC_SVCNAME}.pid"} + +command="/usr/bin/webhook" +command_args="${command_args}" +command_background="true" +extra_started_commands="reload" +start_stop_daemon_args="" + +depend() { + after net +} + +reload() { + ebegin "Reloading webhooks" + start-stop-daemon --signal SIGHUP --pidfile "${pidfile}" + eend $? +} diff --git a/dev-util/webhook/files/webhook.json.example b/dev-util/webhook/files/webhook.json.example new file mode 100644 index 000000000000..12a314522595 --- /dev/null +++ b/dev-util/webhook/files/webhook.json.example @@ -0,0 +1,13 @@ +[ + { + "id": "example", + "execute-command": "/var/lib/webhooks/example.sh", + "command-working-directory": "/var/lib/webhooks" + "pass-arguments-to-command": + [ + { + "source": "entire-payload" + } + ] + } +] diff --git a/dev-util/webhook/files/webhook.logrotated b/dev-util/webhook/files/webhook.logrotated new file mode 100644 index 000000000000..7a6dd20b3ceb --- /dev/null +++ b/dev-util/webhook/files/webhook.logrotated @@ -0,0 +1,3 @@ +/var/log/webhook.log +{ +} diff --git a/dev-util/webhook/webhook-2.8.1.ebuild b/dev-util/webhook/webhook-2.8.1.ebuild new file mode 100644 index 000000000000..18c19358ef77 --- /dev/null +++ b/dev-util/webhook/webhook-2.8.1.ebuild @@ -0,0 +1,84 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit go-module + +DESCRIPTION="lightweight incoming webhook server to run shell commands" +HOMEPAGE="https://github.com/adnanh/webhook/" + +if [[ ${PV} == *9999 ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/adnanh/webhook/" +else + SRC_URI="https://github.com/adnanh/webhook/archive/${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="~amd64" + S="${WORKDIR}/webhook-${PV}" +fi + +# SPDX:BSD-3-Clause is 'BSD' in Gentoo +# SPDX:BSD-2-Clause is 'BSD-2' in Gentoo +LICENSE="Apache-2.0 BSD-2 BSD MIT" +SLOT="0" + +BDEPEND=">=dev-lang/go-1.13" +RESTRICT="test" # hardcoded paths, plus go extra dependencies not included in tarball + +DOCS=( + README.md + hooks.json.example + hooks.json.tmpl.example + hooks.yaml.example + hooks.yaml.tmpl.example + docs/Hook-Definition.md + docs/Hook-Examples.md + docs/Hook-Rules.md + docs/Referencing-Request-Values.md + docs/Templates.md + docs/Webhook-Parameters.md +) + +# Do not let these leak from outside into the package +unset GOBIN GOPATH GOCODE + +src_unpack() { + if [[ ${PV} == *9999 ]]; then + git-r3_src_unpack + go-module_live_vendor + else + go-module_src_unpack + fi +} + +src_compile() { + # Golang LDFLAGS are not the same as GCC/Binutils LDFLAGS + unset LDFLAGS + # -mod=vendor is needed because the go version specified in go.mod + # is too low. + ego build -mod=vendor +} + +src_install() { + dobin webhook + + newconfd "${FILESDIR}"/${PN}.confd ${PN} + newinitd "${FILESDIR}"/${PN}.initd ${PN} + + insinto /etc + newins "${FILESDIR}/${PN}.json.example" ${PN}.json + + insinto /etc/logrotate.d + newins "${FILESDIR}/${PN}.logrotated" ${PN} + + einstalldocs +} + +pkg_postinst() { + elog + elog "Note that due to technical restrictions the webhook server runs as root," + elog "which has obvious security implications." + elog "Please see the project home page for information about Hook rules and" + elog "restrict access to the server, for example by limiting the listening IP/port." + elog +} |