Build jenkins job when push code to bitbucket

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 12:44:59

After some research I found a good solution finally:

  • Install Bitbucket Plugin at your Jenkins
  • Add a normal Post as Hook to your Bitbucket repository (Settings -> Hooks) and use following url:

https://YOUR.JENKINS.SERVER:PORT/bitbucket-hook

  • Configure your Jenkins project as follows:
    • under build trigger enable Build when a change is pushed to BitBucket
    • under Source Code Management select GIT; enter your credentials and define Branches to build (like **feature/*)

By this way I have three build projects, one for all features, one for develop and one for release branch.

Best, you don't have to create new hooks for every Jenkins project just define the separate build process or branches to be build.

AFAIK, you need to have Git or Mercurial setup to work with BitBucket. After all, you will be making changes to your files. Please refer these links for further info on how to configure it with Jenkins.

http://felixleong.com/blog/2012/02/hooking-bitbucket-up-with-jenkins
https://confluence.atlassian.com/display/BITBUCKET/Bitbucket+101
http://blogs.steeplesoft.com/posts/2014/02/05/integrating-bitbucket-and-jenkins/

I haven't done used Bitbucket for it. But it looks like a simple requirement and Jenkins Poll SCM feature should work for you. You can have a look here for instructions

Off-course you need to add your ssh public key in jenkins for this to work

I am not sure in method you describe what authentication mechanism Jenkins will use to checkout your repo from Bitbucket?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!