Guest User

Untitled

a guest
Sep 8th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. # The most important line in every Shell Script.
  4. set -e
  5.  
  6. JENKINS_USER="$(git config --get jenkins.username)"
  7. JENKINS_PASSWORD="$(git config --get jenkins.password)"
  8.  
  9. if [ -n "$2" ]; then
  10. JENKINS_JOB="$2"
  11. else
  12. JENKINS_JOB="$(git config --get jenkins.job)"
  13. fi
  14.  
  15. JENKINS_LOCATION="$(git config --get jenkins.server)"
  16.  
  17. BRANCH_PREFIX=$(git config --get gitflow.prefix.feature)
  18. BRANCH="$BRANCH_PREFIX$1"
  19.  
  20. POST_URL="$JENKINS_LOCATION/job/$JENKINS_JOB/buildWithParameters"
  21.  
  22. echo "Triggering Build Job $JENKINS_JOB with {branch: \"$BRANCH\"}" >&2
  23. curl -d branch="origin/$BRANCH" --user "$JENKINS_USER:$JENKINS_PASSWORD" "$POST_URL"
  24.  
  25. echo "Success." >&2
  26. echo >&2
  27. echo "Look at a Jenkins build monitor to see the job's progress." >&2
Add Comment
Please, Sign In to add comment