From 1223602679048403dc55f839dadd3bb079cccf41 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Fri, 3 Jul 2015 17:11:53 -0400 Subject: [PATCH] Add docs for `receive-branch` hook. Refs #1149 [ci skip] --- docs/development/pluginhooks.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/development/pluginhooks.md b/docs/development/pluginhooks.md index e4c669bde..78e464d4d 100644 --- a/docs/development/pluginhooks.md +++ b/docs/development/pluginhooks.md @@ -589,3 +589,27 @@ APP="$1"; REV="$2" dokku hg-build $APP $REV ``` + +### `receive-branch` + +- Description: Allows you to customize what occurs when a specific branch is received. Can be used to add support for specific branch names +- Invoked by: `dokku git-hook`, `dokku ps:rebuild` +- Arguments: `$APP $REV $REFNAME` +- Example: + +```shell +#!/bin/bash +# Gives dokku the ability to support multiple branches for a given service +# Allowing you to have multiple staging environments on a per-branch basis + +reference_app=$1 +refname=$3 +newrev=$2 +APP=${refname/*\//}.$reference_app + +if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then + REFERENCE_REPO="$DOKKU_ROOT/$reference_app + git clone --bare --shared --reference "$REFERENCE_REPO" "$REFERENCE_REPO" "$DOKKU_ROOT/$APP" > /dev/null +fi +pluginhook receive-app $APP $newrev +```