From owner-svn-ports-all@freebsd.org Mon Mar 26 12:24:20 2018 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2EB85F67F9C; Mon, 26 Mar 2018 12:24:20 +0000 (UTC) (envelope-from jrm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CEDB87B481; Mon, 26 Mar 2018 12:24:19 +0000 (UTC) (envelope-from jrm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C5BE44E79; Mon, 26 Mar 2018 12:24:19 +0000 (UTC) (envelope-from jrm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2QCOJUF068299; Mon, 26 Mar 2018 12:24:19 GMT (envelope-from jrm@FreeBSD.org) Received: (from jrm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2QCOJRP068292; Mon, 26 Mar 2018 12:24:19 GMT (envelope-from jrm@FreeBSD.org) Message-Id: <201803261224.w2QCOJRP068292@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jrm set sender to jrm@FreeBSD.org using -f From: Joseph Mingrone Date: Mon, 26 Mar 2018 12:24:19 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r465583 - in head/www: . webhook webhook/files X-SVN-Group: ports-head X-SVN-Commit-Author: jrm X-SVN-Commit-Paths: in head/www: . webhook webhook/files X-SVN-Commit-Revision: 465583 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Mar 2018 12:24:20 -0000 Author: jrm Date: Mon Mar 26 12:24:18 2018 New Revision: 465583 URL: https://svnweb.freebsd.org/changeset/ports/465583 Log: New port, www/webhook: lightweight incoming webhook server WWW: https://github.com/adnanh/webhook PR: 222883 Submitted by: stb@lassitu.de (maintainer) Differential Revision: https://reviews.freebsd.org/D14853 Added: head/www/webhook/ head/www/webhook/Makefile (contents, props changed) head/www/webhook/distinfo (contents, props changed) head/www/webhook/files/ head/www/webhook/files/webhook.in (contents, props changed) head/www/webhook/files/webhook.yaml (contents, props changed) head/www/webhook/pkg-descr (contents, props changed) Modified: head/www/Makefile (contents, props changed) Modified: head/www/Makefile ============================================================================== --- head/www/Makefile Mon Mar 26 11:58:44 2018 (r465582) +++ head/www/Makefile Mon Mar 26 12:24:18 2018 (r465583) @@ -2443,6 +2443,7 @@ SUBDIR += webfs SUBDIR += webgo SUBDIR += webgrind + SUBDIR += webhook SUBDIR += webinject SUBDIR += webkit-gtk2 SUBDIR += webkit-gtk3 Added: head/www/webhook/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/www/webhook/Makefile Mon Mar 26 12:24:18 2018 (r465583) @@ -0,0 +1,35 @@ +# $FreeBSD$ + +PORTNAME= webhook +PORTVERSION= 2.6.8 +CATEGORIES= www + +MAINTAINER= stb@lassitu.de +COMMENT= Easily create HTTP endpoints (hooks) to execute shell commands + +LICENSE= APACHE20 BSD3CLAUSE MIT +LICENSE_COMB= multi + +USES= go +GO_PKGNAME= github.com/${GH_ACCOUNT}/${PORTNAME} +USE_GITHUB= yes +GH_ACCOUNT= adnanh +USE_RC_SUBR= webhook + +PLIST_FILES= "@sample etc/webhook.yaml.sample" sbin/webhook + +.include + +.if ${OPSYS} == FreeBSD && ${OSVERSION} >= 1100513 +DAEMONARGS= -S -l \$${webhook_facility} -s \$${webhook_priority} -t \$${name} +.else +DAEMONARGS= -f +.endif + +SUB_LIST+= DAEMONARGS="${DAEMONARGS}" + +do-install: + ${INSTALL_PROGRAM} ${GO_WRKDIR_BIN}/${PORTNAME} ${STAGEDIR}${PREFIX}/sbin + ${INSTALL_DATA} ${FILESDIR}/webhook.yaml ${STAGEDIR}${PREFIX}/etc/webhook.yaml.sample + +.include Added: head/www/webhook/distinfo ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/www/webhook/distinfo Mon Mar 26 12:24:18 2018 (r465583) @@ -0,0 +1,3 @@ +TIMESTAMP = 1513967412 +SHA256 (adnanh-webhook-2.6.8_GH0.tar.gz) = 1b92f2958a25d363c9d1c498ab8317d36348a24397b1cb27c002181e3d6df4f0 +SIZE (adnanh-webhook-2.6.8_GH0.tar.gz) = 822195 Added: head/www/webhook/files/webhook.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/www/webhook/files/webhook.in Mon Mar 26 12:24:18 2018 (r465583) @@ -0,0 +1,39 @@ +#!/bin/sh + +# $FreeBSD$ + +# PROVIDE: webhook +# REQUIRE: NETWORKING SYSLOG +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf to enable webhook: +# +# webhook_enable="YES" + +. /etc/rc.subr + +desc="webhook daemon" +name=webhook +rcvar=webhook_enable + +load_rc_config $name + +: ${webhook_conf:=%%PREFIX%%/etc/webhook.yaml} +: ${webhook_enable:=NO} +: ${webhook_facility:=daemon} +: ${webhook_priority:=debug} +: ${webhook_user:=nobody} + +pidfile=/var/run/${name}.pid +extra_commands=reload +sig_reload=USR1 + +procname=%%PREFIX%%/sbin/${name} +command=/usr/sbin/daemon +command_args="%%DAEMONARGS%% -p ${pidfile} ${procname} \ + -hooks ${webhook_conf} ${webhook_options}" + +start_precmd="install -o ${webhook_user} /dev/null ${pidfile}" +reload_cmd="pkill -SIGUSR1-U ${webhook_user} -F {pidfile} ${procname}" + +run_rc_command "$1" Added: head/www/webhook/files/webhook.yaml ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/www/webhook/files/webhook.yaml Mon Mar 26 12:24:18 2018 (r465583) @@ -0,0 +1,66 @@ +--- +# See https://github.com/adnanh/webhook/wiki for further information on this +# file and its options. Instead of YAML, you can also define your +# configuration as JSON. We've picked YAML for these examples because it +# supports comments, whereas JSON does not. +# +# In the default configuration, webhook runs as user nobody. Depending on +# the actions you want your webhooks to take, you might want to run it as +# user root. Set the rc.conf(5) variable webhook_user to the desired user, +# and restart webhook. + +# An example for a simple webhook you can call from a browser or with +# wget(1) or curl(1): +# curl -v 'localhost:9000/hooks/samplewebhook?secret=geheim' +- id: samplewebhook + execute-command: /usr/bin/logger + pass-arguments-to-command: + - source: string + name: '-p' + - source: string + name: 'daemon.notice' + - source: string + name: '-t' + - source: string + name: 'samplewebhook' + - source: string + name: 'Sample webhook has been invoked. User Agent:' + - source: header + name: 'user-agent' + response-message: | + Example webhook executed + trigger-rule-mismatch-http-response-code: 400 + trigger-rule: + match: + type: value + value: geheim + parameter: + source: url + name: secret + +# Running an Ansible playbook on pushing to Github, courtesy of Dave +# Cottlehuber. +- id: ansible + execute-command: "/home/ansible/src/ansible/deploy.sh" + command-working-directory: "/home/ansible/src/ansible" + pass-arguments-to-command: + - source: payload + name: head_commit.id + - source: payload + name: pusher.name + - source: payload + name: pusher.email + trigger-rule: + and: + - match: + type: payload-hash-sha1 + secret: ..... + parameter: + source: header + name: X-Hub-Signature + - match: + type: value + value: refs/heads/master + parameter: + source: payload + name: ref Added: head/www/webhook/pkg-descr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/www/webhook/pkg-descr Mon Mar 26 12:24:18 2018 (r465583) @@ -0,0 +1,10 @@ +Easily create HTTP endpoints (hooks) to execute shell commands + +webhook is a lightweight configurable tool written in Go, that allows you to +easily create HTTP endpoints (hooks) on your server, which you can use to +execute configured commands. You can also pass data from the HTTP request +(such as headers, payload or query variables) to your commands. webhook +also allows you to specify rules which have to be satisfied in order for the +hook to be triggered. + +WWW: https://github.com/adnanh/webhook