summaryrefslogtreecommitdiff
path: root/dev-util/webhook
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-07-06 08:06:16 +0100
committerV3n3RiX <venerix@koprulu.sector>2024-07-06 08:06:16 +0100
commit4187bba080530c5ca1c7dae9c233e88f3fc8f535 (patch)
treeb6f535e053876097ced1b6bda14a4da890c730d4 /dev-util/webhook
parent2a8d2f71d1d9963368e0ef3d641d75979a689d12 (diff)
gentoo auto-resync : 06:07:2024 - 08:06:15
Diffstat (limited to 'dev-util/webhook')
-rw-r--r--dev-util/webhook/Manifest6
-rw-r--r--dev-util/webhook/files/webhook.confd2
-rw-r--r--dev-util/webhook/files/webhook.initd22
-rw-r--r--dev-util/webhook/files/webhook.json.example13
-rw-r--r--dev-util/webhook/files/webhook.logrotated3
-rw-r--r--dev-util/webhook/webhook-2.8.1.ebuild84
6 files changed, 130 insertions, 0 deletions
diff --git a/dev-util/webhook/Manifest b/dev-util/webhook/Manifest
index ce0aa4e9eedc..a775fa66cc29 100644
--- a/dev-util/webhook/Manifest
+++ b/dev-util/webhook/Manifest
@@ -1,3 +1,9 @@
+AUX webhook.confd 119 BLAKE2B 8c7ae09fdb11e223aaf4bf805a007e62077f7ecb9899bedeff8eab7e87ad5a71a91443a33e09957d22bf5058a74797d90675532bba7026b5859c75f2929640d2 SHA512 49f40aaaaeeebb3ec0acac39e1137ceccec9fb8cb452bed9c84bcd5780c61a8e8098139629316ed4a900c4254c431893664bf161588a1d198d72ba7622069a61
+AUX webhook.initd 476 BLAKE2B 017b288aac52689ba2b5d64e28822bfa9a4fe1cbafc16ed1770e3e6976a256a95ecdc080730a47d146d9018328222a0b225c0f12b1d26c99e1d675af8e931933 SHA512 745f3370f4e3354ee70f011c820248c0f7bb93389091b298e923135f6f928e6e3db7546da6ffabee265bc141f29248ecc6cddaea2c3f1358c6b8ba5ffd7db2d1
+AUX webhook.json.example 237 BLAKE2B f4ac60e0b8827595c236782d4ce3664957adf2fb96dc7c95b9bccb746565aaca5da4bfa716f22947e04371a29704d6b179ea911807c323301f0ae969c0e0ad95 SHA512 7759a5cbb9365e17bf3fe9e6e8a14a302fbd2a3e47db0b42cd5d448d2282291fbe4557cf913aef4e17d68ab2ce23884b8f497a5e97c8a004a631bbe6950aacca
+AUX webhook.logrotated 25 BLAKE2B f8abfa5fe5796a0f3ae4df966408b26f21ed7600799ab6e765d5bff043e2b69608433fcdb901994e35c8abbb7b956de971d18c09b6f648aa63d4af761db2b350 SHA512 1917041ad16d34d07e514657df5e2efb481c1b17a8eff191ed69c786de2fe047f1cd841bd5618c8973851a66cb4b3581900aa814e6d41f105f1b1e396c0df585
DIST webhook-2.7.0.tar.gz 1652898 BLAKE2B e6cf049b39d7fea689060e9e1e42f6386a7a671a10cc7d3fc288ea9285dc90e674a3a4b5fcb77ac5af8a8b1bbfee0a574b2ae94f8df296b64e15578c824f8500 SHA512 107db4f873aa66c9e9910eb7542edf18c3bd5b3509ff03d6e6947cb162d08101f5b11855c403d6a0a27fea8da693aaa2c995799670b73693c8fe2b2f50ac1da1
+DIST webhook-2.8.1.tar.gz 1657848 BLAKE2B 7e6dbea83614042c6dcf2e0b377933dee625bfd300e24530f0682b68945734e11e3d2d5bc34ef8b19936b3880cab7febfa39160a5eea988c4f882acf47d99cbd SHA512 25edff21725ba9ac8823dbe5728234f7cd9218027e87df3e2482ef365a7dd0efe8659800233753c275f858ff87f848ff6141d09be3e0b66ff88b795680b9b635
EBUILD webhook-2.7.0.ebuild 1368 BLAKE2B 52676f747bc1b6803acd9fd98ce0c977fadbb4560f762612df344222f19e070508b219d7a99c884c87ce4c2915b53c819841d0647473fc50e50f3e0be3073c6f SHA512 12562ea2f8848a70bd4cb1c4c7c54761b80fa5d4f0f958e2e8a4794009f56afa754419b0bc12f8376aaf83c5ab0b9e5e10d391cce0352b27534cc0f8b1b6d02b
+EBUILD webhook-2.8.1.ebuild 1995 BLAKE2B 42c4da6d6fb439a037922e3816ff998ef8b8f98f0b00d5804c24d516a88611664d34af648fe4af5014fc739afcb271dc5a46ab8d4cc41fc69de007a3e6bb6018 SHA512 a55c27abc0a90766c99b65d10ac6b5cbd9916a67b97831baf8d447c25c14072bca59fef45fb4d2a5698fd514cbd9b0cf05d0ec84655845473123d0b077dc730d
MISC metadata.xml 330 BLAKE2B 411edae60844326c3f66194a7f56aeeda9137c80b9d36fdde8589a2c58e1f3fa311a48b9318946df6f795e47707e5f03126e855aff42c3623b1e141be316259a SHA512 02e728c26cb7b91e867cb3e28347cbc4657529e979a5a76ce1c68cd7fdefd7f947d087ab69fc5aee23519c1a30ee577a2ccb44308c9e901f20ac1fbe665da70d
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
+}