1. On Cloudbees job configure, "Build Triggers" segment, check "Trigger builds remotely (e.g., from scripts)" box, and input any string in "Authentication Token" field, such as 123456.

2. On bitbucket repo "Admin" tab, select "Services" in left bar, add "Jenkins" service.
Input in "Endpoint" field with the format:
https://[cloudbees username]:[cloudbees password]@[account].ci.cloudbees.com
for example,
https:// ryan%40mail.com:mypassword123@myaccount.ci.cloudbees.com
Input "Project name" field with your Cloudbees Jenkins job name.
Input "Token" field with what you set in step 1, for example 123456.

3. Push code to the repo on bitbucket, and you will find your job on Cloudbees automatically be triggered to build.
Reference:
http://blog.cloudbees.com/2011/08/api-token-in-jenkins-rest-api.html
http://felixleong.com/blog/2012/02/hooking-bitbucket-up-with-jenkins
http://confluence.atlassian.com/display/BITBUCKET/Setting+Up+the+Bitbucket+Jenkins+Service
https://bitbucket.org/site/master/issue/3290/problem-with-jenkins-services-integration
http://paste.pocoo.org/show/iSvLXJTMnZFAFDrpWKw0/
https://wiki.jenkins-ci.org/display/JENKINS/Authenticating+scripted+clients
http://wiki.cloudbees.com/bin/view/DEV/Accessing+Jenkins%20using%20HTTP%20Basic%20Authentication
https://cloudbees.zendesk.com/entries/405505-triggering-builds-upon-commits-to-github
https://cloudbees.zendesk.com/entries/405505-triggering-builds-upon-commits-to-github
使用CURL触发
https://[cloudbees username]:[cloudbees password]@[account].ci.cloudbees.com/job/[job]/build?token=[build token]
for example:
https:// ryan%40mail.com:mypassword123@myaccount.ci.cloudbees.com/job/myjob/build?token=A84787dsaw
本文详细介绍了如何通过Cloudbees、Bitbucket和Jenkins的集成,实现远程触发Jenkins构建的过程。包括配置Cloudbees、添加Bitbucket服务、设置授权令牌等步骤,并展示了使用CURL命令手动触发构建的方法。
705

被折叠的 条评论
为什么被折叠?



