Search code examples
jenkinsmercurialsynchronizationcontinuous-integrationtortoisehg

Syncing TortoiseHG with Jenkins


I'm new to this continuous integration thing. I want to use Jenkins as my CI system, but I can't get it to pull the build everytime there's a new one.

Using mercurial's plugin I'm able to connect to my repository and pull my builds normally, but I don't want Jenkins to keep polling, I want it to update the build only when there's a new one instead. On the plugin's wiki I found this:

As of version 1.38 it's possible to trigger builds using push notifications instead of polling. In your repository's .hg/hgrc file add:

[hooks] 

  commit.jenkins = wget -q -O /dev/null <jenkins root>/mercurial/notifyCommit?url=<repository remote url>
  incoming.jenkins = wget -q -O /dev/null <jenkins root>/mercurial/notifyCommit?url=<repository remote url>

For now I'm keeping Jenkis local, so I used this o my hgrc file:

commit.jenkins = wget -q -O /dev/null http://localhost:8080/mercurial/notifyCommit?url=<my repository remote url>
incoming.jenkins = wget -q -O /dev/null http://localhost:8080/mercurial/notifyCommit?url=<my repository remote url>

But builds aren't being triggered. Could someone help me?

[UPDATE]

I didn't pay attention to the wget command, which doesn't exist on windows. Installed it and it's still the same. Jenkins is not pulling the builds.


Solution

    1. You must to have wget on PATH (I'll recommend native port of GOW, not Cygwin - or Bash in Win10)
    2. Your hooks must be in working state
    3. wget ... must produce the expected result

    you have threenow two possible points of failure and have to test all independently


    • Does my hooks work?

    Replace your current content of hooks with dumb billet like

      commit.jenkins = echo Commit hook here
      incoming.jenkins = echo Incoming hook here
    

    and test hooks (in console for better visibility) by executing commit into repo with added hook and pull|push to it|unbundle anything. If you'll see hook output - they are usable

    • Does Jenkins integration work?

    After commit to repo you can perform task of hook by hand: run wget -q -O /dev/null ... and check results in Jenkins