Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/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
Add Comment
Please, Sign In to add comment