Child pages
  • Bitbucket pullrequest builder plugin

Due to some maintenance issues, this service has been switched in read-only mode, you can find more information about the why

and how to migrate your plugin documentation in this blogpost

Skip to end of metadata
Go to start of metadata

Most critical issues found with Bitbucket pullrequest builder plugin is no control in triggering builds by open pull requests. When the plugin is initially installed & configured, all open pull requests will be triggered, which might crash the system when there are many open PRs. Besides, whenever a user creates a PR or commits a change, the build will be triggered, causing massive unnecessary build processes and failures. Users like to control the triggering of builds when it's ready.

Suggestion: add a checkbox like below

Only build if asked with the build phrase

Plugin Information

View Bitbucket Pullrequest Builder on the plugin site for more information.

This plugin builds pull requests from Bitbucket.org and will report the test results.Basic documentation can be found on GitHub.


28 Comments

  1. Unknown User (raitis)

    This plugin triggers builds even if pr/commit was already built. Is that a bug? I have one open PR in my bitbucket repository and in jenkins job configuration in bbprb plugin section cron field i have "* * * * *" so it triggers build every minute for the same PR/commit.

    I expected that it will check every minute for untested commits in PRs and if all of them were already built then the build would not be triggered. Am I missing something here?

    1. Unknown User (johannsig)

      Hi Raitis. Did you get this sorted out?

  2. Unknown User (dodoent)

    Same for me. After v1.4.8 all my pull requests are continuously rebuilt. Even more, since one build lasts 15 minutes, every minute new build is triggered. I am currently using v1.4.7 because it was last one which worked correctly. 

    1. Unknown User (johannsig)

      Hi Nenad. Did you get this sorted out?

  3. Unknown User (cayanbr)

    This plugin does not support pipeline projects.

    1. Unknown User (damovsky)

      check out the latest release 1.4.21. This plugin suports Jenkins pipeline now...

  4. Unknown User (damovsky)

    Hi all, 

    today I made a new release of bitbucket pullrequest plugin. It does supports Jenkins Pipelines!

    give it a try and let me know then!

    Martin

  5. Unknown User (yairs)

    @Martin - Is the issue mentioned by @Raitis and @Nenad fixed (rebuilding same PR)?

    Yair

    1. Unknown User (damovsky)

      Hi @yair_segal!

      this is quite old issue....I'm not aware of any issue like that. I've been using it in my team quite heavily every day. You can give it a try and let us know. 

      P.S. I started working on bitbucket-pullrequest-plugin one month ago...and some old issues might have been already fixed by original author. Thus I try to focus on newly reported issues and the one I'm aware of...

      Martin

      1. Unknown User (yairs)

        After a few days of trying this plugin it seems the behaviour is good.

        1. Unknown User (damovsky)

          thanks for info!

  6. Unknown User (sreeramk)

    Works great!! Thanks for such a useful plugin. 

    It'd be nice if I can set the name of the repository using a variable collected as a Build parameter instead of having to hard code it.  If I don't hardcode the name of the repository, the cron expression does not trigger the job when a PR is generated in bitbucket.  Otherwise, all good!! 

  7. Unknown User (dokaspar)

    Hi,

    Could you please give a clue on how to define the BIT_BUCKET_PATH in a pipeline configuration? This is in the documentation without explanation:

            bitbucketpr(projectPath:'<BIT_BUCKET_PATH>', ...
    
    For example, if my repository is at "bitbucket.org:${repositoryOwner}/${repositoryName}.git", then should BIT_BUCKET_PATH be the whole URL, only the base URL "bitbucket.org", only the path to the repo "${repositoryOwner}/${repositoryName}" or even something else?
    I tried all I could think of in the Jenkinsfile of my Multibranch Pipeline... but no pull-request yet triggered a build (sad)

    Regards,
    Dominik
  8. Unknown User (dokaspar)

    Can this plugin also be used for private Bitbucket servers?

    1. Unknown User (renescheibe)

      It looks like that only the public instance is supported (the URL is hardcoded in the sources).

      That's also stated in the plugin's description "This plugin builds pull requests from Bitbucket.org and will report the test results.".

       

  9. Unknown User (johannsig)

    Am encountering the same issues that Raitis and Nenad reported above: Cron keeps spamming new PR jobs even though they're unchanged in the repo. I looked at the source code at https://github.com/nishio-dens/bitbucket-pullrequest-builder-plugin and don't seem to find any "skip new one if nothing's changed" logic, only "abort previous ones if  queued or running". Anyone who can help?

    1. Unknown User (johannsig)

      This might work properly using post-hooks, but since our build server is on-site and not exposed to the web it's Cron or nothing, I fear.

      1. Unknown User (fhamel_arimasoft)

        Hey Johann. My comment below might help you with the job spam : Re: Bitbucket pullrequest builder plugin

  10. Unknown User (pavanreddy)

    Hello all, I am using the below configuration in my Jenkins pipeline file but my Jenkins server send the inprogress build status to bit bucket using the CI key but it is not updating the status once the build is finished. when I tried using the same plugin in free style project it send the build status using the CI name and updates the build status also once the build is finished.
    triggers{
    bitbucketpr(projectPath:'################################',
    cron:'* * * * *',
    credentialsId:'##################',
    username:'########',
    password:'#########',
    repositoryOwner:'#####',
    repositoryName:'#####',
    branchesFilter:'',
    branchesFilterBySCMIncludes:false,
    ciKey:'',
    ciName:'',
    ciSkipPhrases:'',
    checkDestinationCommit:true,
    approveIfSuccess:true,
    cancelOutdatedJobs:true,
    commentTrigger:'test this please')
    }

  11. Unknown User (flemmingdjensen)

    Hi,

    We would really like to use this plugin in order to automatically build new pull request and so forth.

    But I really cannot get it to work,

    On the GitHub page it says create a new job. Is this a Freestyle job?

    When I use the following:

    • Add Repository URL, git@bitbucket.org:${repositoryOwner}/${repositoryName}.git
    • In Branch Specifier, type */${sourceBranch}

    Jenkins doesn't seem to recognize the ${} parameters? How can I get this to work?

    What is the meaning by RepositoryOwner and RepositoryName?


    Then the guideline tells about pipeline???

    So next step is to create a pipeline job in jenkins? And paste the example in?

    If I run this pipeline project - it complains about missing stages information

    So as you see - I am really in deep water here?

    Can this plugin work for me?

    We are using jenkins version 2.121.1

    BR Flemming

  12. Unknown User (samkr)

    Hello everyone

       This plugin has been working wonderfully for me for the past year or more.  I'm using it to run sonarqube analysis on the Bitbucket Pull request code and post results directly in the PR for reviewers to see.  I'll post my configuration in hopes it will help someone.  Let me know if you have any other questions. 

       its been a while since I worked on this, but the way its supposed to work is that a full analysis is done already on the code and any new code that is in the PR will trigger an incremental over the already analyzed code.  But our full analysis is not possible as we have 2 million lines of code and it never finishes on time.  So, I'm pulling the changes in each PR in the jenkins job and running analysis only on it and posting results in bitbucket.  

    On the sonarqube side, I have installed the plugin 'Bitbucket for Sonar' version 1.2.3

    On Bitbucket side I have created OAuth consumer and the key and secret are in the configuration below.  

    More details...

    1. I have disabled manual triggering of this job as it will try to analyze all the open pull requests.  At one time we had close to 100 or more open PR's and imagine the catastrophe of emails and what not.  LOL
    2. Eventhough I use groovy declarative pipelines, for this exercise I stuck with the standard freestyle job in Jenkins.  I did try, but dont have the time or patience to work on porting this to the declarative pipelines.  So, I think that already answers one question from above. 
    3. Our code is in private Bitbucket repo.  We are using Bitbucket cloud and not Bitbucket server.  Please note that detail.  
    4. In Source code management section, the git URL is simply git@bitbucket.org:${COMPANY}/${REPO_NAME}.git
    5. The branch specifier is **    I could be wrong, but I believe this has to be ** so it can process any branch name.  The PR is technically a branch which gets merged to the parent.  So, if you put master on it, since there can be Pull request branch called master, it will not work.H  
    6. This is the content of the sonar-project.properties

      echo "
      sonar.bitbucket.repoSlug=${REPO_NAME}        <---  This is simply the repository name.  Nothing else.  

      sonar.bitbucket.accountName=<COMPANY-NAME>
      sonar.bitbucket.teamName=<COMPANY-NAME>

      # OAuth credentials created under <COMPANY-NAME> account in bitbucket
      sonar.bitbucket.oauthClientKey=<Created in bitbucket>
      sonar.bitbucket.oauthClientSecret=<Created in bitbucket>
      sonar.bitbucket.approvalFeatureEnabled=false


      # This project does not need to exist
      sonar.projectKey=${REPO_NAME}
      sonar.sources=${FILES_TO_ANALYZE}
      sonar.bitbucket.branchName=${GIT_BRANCH}

      #sonar.inclusions=**/*.C
      sonar.exclusions=**/*.H, **/*.h, **/GENVOIP/GenClientLib/**/*, src/CLIENTLIB/GENVOIP/GenClientLib/samples/INI1Sim/sim.C, src/CORE/RHOST/lib/RHOST_G.C, **/TEST/*

      # These are set in sonarqube
      sonar.login=<Sonarqube user name with rights to run analysis>
      sonar.password=<password>
      sonar.host.url=http://<IP - ADDRESS of sonarqube server> 
      sonar.analysis.mode=preview
      sonar.cxx.cppcheck.reportPath=./cpp_report.xml
      sonar.bitbucket.minSeverity=CRITICAL

      " > sonar-project.properties

      # Invoke the sonar scanner
      /home/support/sonar-scanner-3.0.3/bin/sonar-scanner

    7. The jenkins configuration of the pull request plugin is below.  

  13. Unknown User (fhamel_arimasoft)

    For those of you who have the problem that pull requests are continuously rebuilding, try to change your jenkins URL from "http://servername/jenkins" to "http://servername.local/jenkins". BitBucket API seems to treat the first URL as invalid. Here is where I found the solution : https://github.com/nishio-dens/bitbucket-pullrequest-builder-plugin/issues/62#issuecomment-223901248

    I hope it will help some of you.

    F. Hamel

  14. Unknown User (ganesh1991)

    This plugin does not work as expected. Jenkins should kick off the build only when the "Comment phrase to trigger build" is commented on Bitbucket PR.

    Does anyone have a solution for this??

    Current config: 

    CRON : H/2 * * * *

    Comment phrase to trigger build: build

    It is not building when build ("Comment phrase to trigger build") is commented on Bitbucket PR. But it builds every 2 mins defined in the CRON.

  15. Unknown User (newlix)

    I've been trying to figure out why the build result is not being updated in Bitbucket.

    My job gets triggered properly when a PR is created or a commit to exiting PR is pushed and when I look at the commits, I see the "build in progress" icon but it doesn't get updated to "build successful" upon completion. The build does succeed without error as well.

    At this point, I'm just out of ideas on how to debug this.

    1. Unknown User (geraldi29)

      check here  JENKINS-53572 - Getting issue details... STATUS

  16. Unknown User (pcadigan)

    I recently upgraded my branch strategy and I'm having difficulty getting the builds to run automatically.  When I configure the strategies, the project is scanned by Jenkins, the proper multi-branch pipelines are created and the builds execute like I think they should.  However, subsequent pushes to the repository are ignored by the Multi-branch builds in the organization folder. 

    From what I can tell, the organization scan runs correctly, but the multi-branch pipelines do not.  When you run the multi-branch scan manually, all of the proper jobs are picked up.

  17. Unknown User (kathir06)

     In my case developer forked the main repository and give the pull request  to main repo ,so without adding fork repository in the jenkins pipeline is there is anyway build the pull request?

  18. Unknown User (vishnu87)

    First of all, Thanks a ton to this team for having built this very useful plug-in. I have 2 issues


    1. This is Most Critical to me. Using the BranchesFilter option, I would like to run different Build jobs for source branches having different name patterns. For instance, I would like to run BuildJob1 for all pull requests whose source branches have names starting with a pre-defined text, say, ABC. Similarly, I would like to run BuildJob2 for all pull requests whose source branches have names starting with yet another pre-defined text, say, XYZ. 

      I have tried all combinations of filter values in the BranchesFIlter (both in SCM and BitBucket Pull Request builder), text, regex, etc. Nothing seems to work for me. All pull request (both conforming to the specified pattern or otherwise) keep triggering my BuildJob. Been struggling with this for months now.

      2. The other one is, I am unable to change the default build trigger text. If I change it to anything other than "test this please", it does not trigger the build.

      Any help on this would be much appreciated.