Search code examples
gitjenkinsassembla

auto deployment of code in jenkins based on git in assembla


I am able to configure jenkins with the git repository. I want to perform an auto deployment when ever there is any push done into the git repository. I am using git repository provided by assembla.

I followed the given link "https://wiki.jenkins-ci.org/display/JENKINS/Assembla+Merge+Request+Builder+Plugin". But I was not able to deploy the code on push command.

I am able achive auto deployment by creating a post-commit file into the hooks folder of .git and adding the following command curl "http://JENKINS_URL/jenkins/job/xxxx/build?delay=0sec". with this I am able to perform auto deployment on the commit. I want to know if there is any better approach.

Thanks.


Solution

  • I would use the method KK suggests here : Polling must die: triggering Jenkins builds from a git hook

    From the Git Plugin Documentation :

    To minimize the delay between a push and a build, it is recommended to set up the post-receive hook in the repository to poke Jenkins when a new push occurs. To do this, add the following line in your hooks/post-receive file, where is the fully qualified URL you use when cloning this repository.

    curl http://yourserver/git/notifyCommit?url=<URL of the Git repository>[&branches=branch1[,branch2]*][&sha1=<commit ID>]