BitBucket WebHook Jenkins

前端 未结 2 496
暖寄归人
暖寄归人 2021-02-04 15:30

I\'d like to configure bitbutcket to trigger a jenkins build.

I\'ve spent some time researching this and all the answers are from a few years ago, and have not found any

相关标签:
2条回答
  • 2021-02-04 15:58

    Is your Jenkins URL accessible from your bitbucket server? If yes that it should be fairly simple to do it. You add the webhook in your repository as http://<url-of-jenkins>/git/notifyCommit?url=<url-of-repository>. When jenkins receives this POST, it automatically triggers builds on those jobs that use this git repo with that URL you give in webhook.
    But you also need to make sure your Build Schedule is set to empty for those jobs. otherwise it wont get triggered. You can specify a branch in webhook URL too
    See the Push Notification from repository here
    https://wiki.jenkins.io/display/JENKINS/Git+Plugin

    0 讨论(0)
  • 2021-02-04 16:03

    SPECIFIC solution for Jenkins CI server--Webhook to Jenkins for Bitbucket plugin has been commercialized in latest version of Bit-Bucket and the current price is around $4800 which was earlier a free offering, because of this, guys who want to save their bucks, can go to the alternative solution by using webhooks feature of bit-bucket:-

    Steps to create a webhook:-

    BitBucket Side

    1) Go to your bitbucket repo, click on Repository Setting, under WORKFLOW got for WEBHOOKS option and create a webhook.

    a) creation of webhook:- URL https://JenkinsserverURL/git/notifyCommit?url=https://bitbucket.repository-link/repository.git

    b) In the name tab, give any name of your choice

    c) click on TEST CONNECTION before saving it. Make sure you get http status 200 d) View details your logs, check your request and response is correct.

    Things to take care of from Jenkins Side:-

    1) Make sure repository mentioned in bitbucket webhook is used in Jenkins job. 2) In SCM option, activate/select Poll SCM option, don't mention anything in the schedule, leave it blank. 3) configure rest job,

    Whenever your git repo observes any change an automatic build will get triggered in Jenkins. By default push trigger is activated and if you want to activate other action, please select those events while creating webhook.

    ***to specify the branch in repository webhook:-

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

    Cheers,

    0 讨论(0)
提交回复
热议问题