Skip to content

Instantly share code, notes, and snippets.

@mfriedenhagen
Created September 4, 2013 08:34
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 mfriedenhagen/6434313 to your computer and use it in GitHub Desktop.
Save mfriedenhagen/6434313 to your computer and use it in GitHub Desktop.
Small shell script which will read the GIT scm connection and ciManagement URL from a POM and trigger the poll of jobs in a Jenkins instance
#!/bin/sh
# Small shell script which will read the GIT scm connection and ciManagement URL
# from a POM and trigger the poll of jobs in a Jenkins instance.
# SED-Voodoo via http://www.grymoire.com/Unix/Sed.html
#
# Note that you have do run this once online to get all needed dependencies for
# help plugin. Afterwards you may invoke this with "--offline" or "-o" for speed.
GOAL="org.apache.maven.plugins:maven-help-plugin:2.2:evaluate"
BASEURL="`mvn $@ $GOAL -Dexpression=project.ciManagement.url | sed -n '\,/job/, s,\(.*\)\/job\/.*,\1/git/notifyCommit?url=,p'`"
CONNECTION="`mvn $@ $GOAL -Dexpression=project.scm.connection | sed -n '/^scm:git/ s/scm:git://p'`"
URL="${BASEURL}${CONNECTION}"
echo "notifyURL=${URL}"
curl --netrc --head ${URL}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment