Skip to content

Instantly share code, notes, and snippets.

@hexathos
Created October 8, 2017 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hexathos/49cc511945afd7ed65632511447046d4 to your computer and use it in GitHub Desktop.
Save hexathos/49cc511945afd7ed65632511447046d4 to your computer and use it in GitHub Desktop.
#!/bin/bash
jenkinsjobname=<INSERT>
jenkinsbuildtoken=<INSERT>
jenkinsusername=<INSERT>
jenkinspasswordhash=<INSERT>
jenkinsurl=<INSERT>
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ "master" == "$branch" ]; then
echo "$(date) triggering jenkins build..."
curl -s -k "https://${jenkinsusername}:${jenkinspasswordhash}@${jenkinsurl}/job/${jenkinsjobname}/build?token=${jenkinsbuildtoken}&cause=triggered+by+gogs"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment