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:[email protected]
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:[email protected]/job/myjob/build?token=A84787dsaw