Skip to content

Instantly share code, notes, and snippets.

@CHH
Created February 3, 2012 11:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CHH/1729691 to your computer and use it in GitHub Desktop.
Save CHH/1729691 to your computer and use it in GitHub Desktop.
git-flow-feature-build
#!/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