From c161b664d51e0ddd85cf531154f945860599eb26 Mon Sep 17 00:00:00 2001 From: drigato Date: Fri, 31 Jan 2014 16:34:25 -0500 Subject: [PATCH] Adding commit hook scripts for running phpunit --- commit-hook-scripts/postCommitBuildTrigger.py | 13 ++++++++++ commit-hook-scripts/postCommitBuildTrigger.sh | 25 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 commit-hook-scripts/postCommitBuildTrigger.py create mode 100755 commit-hook-scripts/postCommitBuildTrigger.sh diff --git a/commit-hook-scripts/postCommitBuildTrigger.py b/commit-hook-scripts/postCommitBuildTrigger.py new file mode 100644 index 000000000..2c02a007e --- /dev/null +++ b/commit-hook-scripts/postCommitBuildTrigger.py @@ -0,0 +1,13 @@ +#!/usr/bin/python +# +# ./postCommitBuildTrigger.py http://bamoo.atlassian.com/bamboo/ myBuildName + +import sys +import urllib; + +baseUrl = sys.argv[1] +buildKey = sys.argv[2] + +remoteCall = baseUrl + "/api/rest/updateAndBuild.action?buildKey=" + buildKey +fileHandle = urllib.urlopen(remoteCall) +fileHandle.close() \ No newline at end of file diff --git a/commit-hook-scripts/postCommitBuildTrigger.sh b/commit-hook-scripts/postCommitBuildTrigger.sh new file mode 100755 index 000000000..9bb411c3d --- /dev/null +++ b/commit-hook-scripts/postCommitBuildTrigger.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# the base url of the bamboo server +baseurl="$1/updateAndBuild.action?buildKey=" + +# +# Use the REST API to trigger a build +# + +# Moves to the 2nd param (first is URL) +shift +# Loop for each build key +while (( "$#" )); do + + # + # Invoke the trigger + # + remoteCall=$baseurl$1 + echo "Detected last directory that was committed ... triggering $remoteCall" + /usr/bin/wget --timeout=10 -t1 $remoteCall -O /dev/null + shift +done + + +exit 0