Jenkins build after mercurial commit

后端 未结 3 708
悲哀的现实
悲哀的现实 2021-01-02 23:38

I\'ve been working on this project for about a week now and I\'ve been searching for 2 days without any clear explanation online. For a school assignment, we need to set up

3条回答
  •  南方客
    南方客 (楼主)
    2021-01-02 23:45

    The most efficient way to trigger builds on Jenkins after someone pushed to your repo is using the changegroup hook in mecurial.

    Jenkins on the other hand allows builds to be triggered remotely by calling the URL of your job with a special token. This trigger with the corresponding token has to be configured in your job on Jenkins:

    Build trigger configuration

    The mercurial hook that will be put in the repos .hg/hgrc file can be defined like:

    [hooks]
    changegroup = curl --silent http://your.jenkins.server.url/jenkins/job//build?token=Foo
    

    This hook uses the curl command line tool to call the URL of your jenkins job with the defined token that allows to trigger the job remotely. Curl has to be installed on your linux box of course.

提交回复
热议问题