0

I would like to do the below scenario:

  1. After post commit to svn, notify a server(example, node.js server running)
  2. Once the server is notified, the server should restart.

I can use Post commit hook to let me know when there is svn commit happens. But after that I am not sure how to proceed further. Either use Jenkins or SVN Notify. I know Jenkins can generate builds and send emails after commit, but can they notify a server(node.js server) to restart? SVNNotify - it ca only send emails right? or can I use it to notify the server to restart?

Sweety Bertilla
  • 972
  • 10
  • 35

1 Answers1

0

or rather than using a push "Hook", you can have your integration server "jenkins" do a regular pull "Poll", this can be implemented by running a job that polls your versioning system with a cron tab change check

do this like so...

  • job -> Configure

  • select your "Source Code Management" of choice git/svn/cvs etc

  • Build Triggers -> select "Poll SCM" I would recommend a Schedule of "H/2 * * * *" which is every 2 minutes

  • Then on your Continuous Integration job make it redeploy to server, restart server etc

for more details on cron schedule -> How to schedule jobs in Jenkins?

If you really really want a push job, it's implemented by a curling a url on the jenkins server using a post commit hook, instructions here -> https://wiki.jenkins-ci.org/display/JENKINS/Subversion+Plugin

script is

REPOS="$1"
REV="$2"
UUID=`svnlook uuid $REPOS`
/usr/bin/wget \
  --header "Content-Type:text/plain;charset=UTF-8" \
  --post-data "`svnlook changed --revision $REV $REPOS`" \
  --output-document "-" \
  --timeout=2 \
  http://server/subversion/${UUID}/notifyCommit?rev=$REV

But I wouldn't recommend this as it's hard to maintain and spreads the logic for

Community
  • 1
  • 1
aqm
  • 2,942
  • 23
  • 30