SVN commit automatically triggers hudson job

SVN commit automatically triggers hudson job

      The project team has been using hudson for automated builds for some time, and has been using timed builds, or manually triggering builds and deployments by testers. Of course, you can set the Poll SCM of hudson's build triggers to * * * * * to poll every minute, but after all, this is still a waste of server resources.

      Although this method can solve the problems in daily work, it always feels uncomfortable and is not automatic enough. These things should be done by the computer itself. Therefore, I have been searching the Internet recently for how to implement SVN commit, automatically trigger the hudson job and automatically deploy. I checked a lot of information, but none of them solved the effect I want to achieve.

       In fact, there is already a plug-in for automatic deployment of hudson, which is relatively simple, so I won't go into details here. The key question is how to automatically trigger hudson to start the job when SVN commits. Although I have also researched the use of hooks, I still haven't found the effect I want to achieve.

       Today, I accidentally saw an article mentioning curl, an open source tool (http://curl.haxx.se/download.html). It feels very powerful. About the specific introduction of this tool, Baidu Encyclopedia has already said it in great detail. , omitted here. So with the attitude of giving it a try, I downloaded the toolkit, put it on the server, and started the hudson job by setting the post-commit hooks of hudson, thus realizing the goal of SVN commit automatically triggering the hudson job. specific methods:

 

1. Download the curl.exe tool and extract it to the server hard disk;

2. Copy the post-commit.tmpl file in the hooks directory of the server-side SVN project library and name it post-commit.cmd;

3. Edit the content of post-commit.cmd file as follows: path to install curl.exe\curl http://address/hudson/job/library name/build?delay=0sec

 

       Through the above steps, you can automatically call the specified job for compilation and deployment when svn commits. I hope this article is helpful to those who have the same needs as me! ! !

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326390489&siteId=291194637