Created
February 3, 2012 11:07
-
-
Save CHH/1729691 to your computer and use it in GitHub Desktop.
git-flow-feature-build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# The most important line in every Shell Script. | |
set -e | |
JENKINS_USER="$(git config --get jenkins.username)" | |
JENKINS_PASSWORD="$(git config --get jenkins.password)" | |
if [ -n "$2" ]; then | |
JENKINS_JOB="$2" | |
else | |
JENKINS_JOB="$(git config --get jenkins.job)" | |
fi | |
JENKINS_LOCATION="$(git config --get jenkins.server)" | |
BRANCH_PREFIX=$(git config --get gitflow.prefix.feature) | |
BRANCH="$BRANCH_PREFIX$1" | |
POST_URL="$JENKINS_LOCATION/job/$JENKINS_JOB/buildWithParameters" | |
echo "Triggering Build Job $JENKINS_JOB with {branch: \"$BRANCH\"}" >&2 | |
curl -d branch="origin/$BRANCH" --user "$JENKINS_USER:$JENKINS_PASSWORD" "$POST_URL" | |
echo "Success." >&2 | |
echo >&2 | |
echo "Look at a Jenkins build monitor to see the job's progress." >&2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment