Child pages
  • Bitbucket pullrequest builder plugin
Skip to end of metadata
Go to start of metadata

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.


25 Comments

  1. 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. Hi Raitis. Did you get this sorted out?

  2. 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. Hi Nenad. Did you get this sorted out?

  3. This plugin does not support pipeline projects.

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

  4. 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. @Martin - Is the issue mentioned by @Raitis and @Nenad fixed (rebuilding same PR)?

    Yair

    1. 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. After a few days of trying this plugin it seems the behaviour is good.

  6. 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. 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. Can this plugin also be used for private Bitbucket servers?

    1. 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. 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. 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. Hey Johann. My comment below might help you with the job spam : Re: Bitbucket pullrequest builder plugin

  10. 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. 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. 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. 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. 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. 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. check here  JENKINS-53572 - Getting issue details... STATUS