Bitbucket trigger build не работает

PRs not triggering build. Manually Clicking the button is not working too. #283


ashishyadav13237 commented Apr 20, 2018

If things don’t work as you expect, perhaps you should file an issue. But first, try troubleshooting it and provide as much info as possible. Here are some things that may help if added to an issue.

  • Plugin version used. Installed version: 3.18
  • Bitbucket Server version used. v5.5.1
  • Stack traces in Bitbucket Server log file.


The text was updated successfully, but these errors were encountered:

ashishyadav13237 commented Apr 20, 2018

ashishyadav13237 commented Apr 20, 2018

The ‘button’ stopped working this morning and no changes have been made on our internal bitbucket-server

tomasbjerre commented Apr 21, 2018

If you do not have access to the server log files, one idea is to:

  • Also trigger on button pressed, and add a button
  • Open a PR
  • Open Chrome developer tools, F12
  • Press the button in the PR
  • Check the response in the network tab in Chrome. See if it contains something interesting

ashishyadav13237 commented Apr 21, 2018

When I enable the confirmation button, I am getting a 401. Where is this coming from?
Integration Button

You may check network tab in web browser for exact URL and response.

ashishyadav13237 commented Apr 21, 2018

tomasbjerre commented Apr 21, 2018

So the credentials you have in «Basic authentication» or in «Proxy» are wrong.

ashishyadav13237 commented Apr 21, 2018

Thanks. Why is it using the credentials in «Basic authentication» or in «Proxy» if we have a token? As for the auth, why does it state «KEEP_THIS_TO_LEAVE_UNCHANGED»?

ashishyadav13237 commented Apr 21, 2018

Lastly, we didn’t change the id/pwd so why are we getting a 401 now 🙂

tomasbjerre commented Apr 21, 2018

Remove it, save it again, try again.

Perhaps your browser recognized it as a login form and added some password.

haroonzone commented Aug 2, 2018

Bitbucket server: v5.11.1
Bitbucket server notifier: v2.62

We are consistently seeing that for any new Jenkins pipeline for a specific branch, a PR job is not being triggered. We get the following response when trying to trigger a job by clicking the button.

content»:»No git jobs using repository: ssh://git@git.host.com/tstau/test-data.git and branches: pr_master\nNo Git consumers using SCM API plugin for: ssh://git@git.host.com/tstau/test-data.git\

tomasbjerre commented Aug 2, 2018

@haroonzone that should be reported in its own issue.

haroonzone commented Aug 2, 2018

This was already open and looked similar. anyway reporting a new issue.

tomasbjerre commented Aug 2, 2018

Closing this one since there has been no response to my suggested fix posted 21 april.

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.


BitBucket+Jenkins: Trigger build only when specific branch is changed

The following is a purported solution to the problem, although it does seem like a workaround rather that a definitive solution. Is there a way, through either job config or bitbucket hook config, that I can set my jobs to run a build only when a specific branch is pushed to?

It has been about a year since the posting of that question, I’m hoping there’s been some plugin updates to allow for this without the extra work required in the above link, or perhaps there’s always been an easy way that I’m just not seeing.

5 Answers 5

As @Ryan Taylor already said you can use the Bitbucket-Plugin:

  • Install Bitbucket Plugin at your Jenkins
  • Add a normal Post as Hook to your Bitbucket repository (Settings -> Hooks) and use following url:
  • Configure your Jenkins project as follows:
    • under build trigger enable Build when a change is pushed to BitBucket
    • under Source Code Management select GIT; enter your credentials and define Branches to build (like **feature/*)

By this way I have three build projects, one for all features, one for develop and one for release branch.

And best of it, you don’t have to ad new hooks for new Jenkins projects.

You should be able to use Generic Webhook Trigger Plugin. You can use the «Optional filter» feature to trigger only for the branch you want.

You will need to fiddle with JSONPath which requires you to have knowledge about the structure of the JSON sent with the webhook from Bitbucket.

Читайте также:  У бобкэт не работает ковш

It may help to have a look this example where its used with GitLab.

The solutions suggested above would be better than my own, but I don’t think the Bitbucket Plugin allows branch specific triggers.

From the Bitbucket Plugin documentation,

On each commit, all jobs with «Build when a change is pushed to BitBucket» option enabled will be triggered.

This is a shotgun approach, and obviously wasteful.

I have solved this problem by deploying a small web application to the same application server hosting my jenkins instance which parses the json post content sent by bitbucket and selectively trigger branch specific hooks.

The code is clean and easy to follow, and would be very easy to modify to meet your own needs; however, its worth noting I did not set out to create a generic solution for others. Regardless it could prove useful to you as a starting point.


Bitbucket Push not triggering pipeline build #204


jbmolle commented Jun 19, 2019 •

Your checklist for this issue

Jenkins version
Docker image 1.17.0 · Core 2.181 · 449ec0e · 7th June 2019 10:15 PM

Plugin version

Bitbucket server and version


I’m using BlueOcean / Bitbucket plugin and my repositories are on Bitbucket Cloud.
I’ve set up a webhook in Bitbucket to https:///bitbucket-scmsource-hook/notify
When I do a push on the repo, the webhook is correctly triggered. I can see it in Bitbucket and I receive a 200 response.

On Jenkins, I get the following:

  • When I enable plugin logs: X-Bitbucket-Type header / server_url request parameter not found. Bitbucket Cloud webhook incoming.
    So I guess this is working correctly because I’m using Bitbucket Cloud.
  • On /var/jenkins_home/logs/jenkins.branch.MultiBranchProject.log, I get «Received com.cloudbees.jenkins.plugins.bitbucket.hooks.PushHookProcessor$1 UPDATED event. » and then «Finished processing com.cloudbees.jenkins.plugins.bitbucket.hooks.PushHookProcessor$1 UPDATED event. Matched 0.»

So it seems that the plugin doesn’t find a corresponding Bitbucket repository when receiving the hook event. It’s strange because I logged in Bitbucket Cloud with BlueOcean and it can list all my repositories. I select the repository with the dropdown so I can’t make any mistake here.

Do you have any idea if it’s a bug or if I’m doing something wrong?

The text was updated successfully, but these errors were encountered:


BitBucket Jenkins doesn’t automatically build

On my Jenkins I configured:

Source Code Management

Builder Triggers

Build when a change is pushed to BitBucket

On my BitBucket Webhooks:

I tried pushing a small change to a .txt file, but the Jenken doesn’t build automatically. If I manually click «build now», it shows success.

What could be the problem?

In the bitbucket repository, the project is simple. I just have a text file to test. I think as long as I made any change to the text file, it should trigger a Jenkins build.

In the System Log of Jenkins, it shows «Polling has not run yet.». But in Bitbucket Webhook request log, I can see all the requests.

15 Answers 15

You don’t need to enable Polling SCM..

You have to ensure that your Webhook (Settings->Webhooks) is pointing to your Jenkins bitbucket-hook like the following: «https://ci.yourorg.com/bitbucket-hook/».

Notice that last «/», without it, the build will not be triggered.

It’s an annoying thing, as you will get a 200 status code from Jenkins when sending requests, with or without it.

After some struggling with the BitBucket plugin, I have managed to get it working. Below is the summary of things I found are necessary for builds to be triggered, but are not obvious from plugin’s documentation:

  1. Make sure your webhook has repository push trigger enabled. I thought pull request created / updated would suffice (building on PR is what I wanted) but the plugin reacts only to push .
  2. Set your repository URL (in Git plugin) to https://bitbucket.org/REPOSITORY_OWNER/REPOSITORY_NAME . Plugin will not match it if it’s the SSH url.
  3. You do need the SCM polling enabled. The plugin itself does not pull the changes. You can leave the schedule field empty, so repository is polled only when the plugin triggers it.

I hope this helps. If the build is still not triggered for you, try enabling logs for the following classes:


Pipeline triggers

Bitbucket allows you to run multiple pipelines by triggering them manually or by scheduling the trigger at a given time.


In the following tutorial, you’ll learn how to trigger manual pipelines or how to schedule triggers.

Читайте также:  Мир не работает с симкой

Before you begin

Triggers in Pipelines have the following limitations:

Run pipelines steps manually

Manual steps allow you to customize your CI/CD pipeline by making some steps run only if they are manually triggered. This is useful for items such as deployment steps, where manual testing or checks are required before the step runs.

Configure a manual step by adding trigger: manual to the step in your bitbucket-pipelines.yml file.

Since a pipeline is triggered on a commit, you can’t make the first step manual. If you’d like a pipeline to only run manually, you can set up a custom pipeline instead. Another advantage of a custom pipeline is that you can temporarily add or update values for your variables, for example, to add a version number, or supply a single-use value.

Set a manual pipelines

Any existing pipeline can also be manually run against a specific commit, or as a scheduled build.

If you want a pipeline to only run manually then use a custom pipeline. Custom pipelines do not run automatically on a commit to a branch. To define a custom pipeline, add the pipeline configuration in the custom section of your bitbucket-pipelines.yml file. Pipelines which are not defined as a custom pipeline will also run automatically when a push to the branch occurs.

You’ll need write permission on the repository to run a pipeline manually, and you can trigger it from the Bitbucket Cloud UI.


Add a pipeline to the bitbucket-pipelines.yml file. You can manually trigger a build for any pipeline build configuration included in your bitbucket-pipelines.yml file

Trigger the pipeline from Bitbucket Cloud. Pipelines can be triggered manually from either the Branches view or the Commits view in the Bitbucket Cloud interface.

Run a pipeline manually from the Branches view

In Bitbucket, choose a repo and go to Branches.

Choose the branch you want to run a pipeline for.

Click (. ) , and select Run pipeline for a branch.

Choose a pipeline and click Run:

Run a pipeline manually from the Commits view

In Bitbucket, choose a repo and go to Commits.

Go to the Commits’ view for a commit.

Select a commit hash.

Select Run pipeline.

Choose a pipeline, then click Run:

Run a pipeline manually from the Pipelines page

In Bitbucket, choose a repo and go to Pipelines.

Click Run pipeline

Choose branch, a pipeline, and click Run

Additionally, you can run custom pipelines manually parsing variables to the pipeline.
To enable the variables, define them under the custom pipeline that you want to enter when you run the pipeline.

Then, when you run a custom pipeline by going to Branches > > Run pipeline for a branch > Custom.

On schedule

Scheduled pipelines allow you to run a pipeline at hourly, daily or weekly intervals.

Scheduled pipelines run in addition to any builds triggered by commits, or triggered manually.

You can create a schedule for any pipeline defined in your bitbucket-pipelines.yml file.

If you make a custom pipeline it will only run when scheduled or manually triggered.


Create a pipeline

Here’s a simple example showing how you would define a custom pipeline in the bitbucket-pipelines.yml file.

Create a schedule for your pipeline

Go to the repository in Bitbucket.

Click Pipelines then Schedules (at the top right), and then click New schedule.

Choose the Branch and Pipeline that you want to schedule:

The schedule will run the HEAD commit of the branch.

The pipeline must be defined in the bitbucket-pipelines.yml on the branch you selected.

Set the Schedule:

Select how often you would like the pipeline to run (hourly, daily or weekly)

Select the time (in your local time). However, your pipeline will be scheduled in UTC time (unaffected by daylight savings hours)

The scheduled pipeline can run at any time in the selected time period. This is to distribute all schedules in Pipelines triggering across the hour.

Remove a schedule

Go to Pipelines > Schedules (at the top right-hand side of the screen) to see all the schedules for a repository.

Remove a schedule by using the ‘trash’ icon at the right of the schedule.

Note that schedules created using the API are displayed as a Cron expression (such as 0 10 15 * * ).

Branch workflows

You can change what your pipeline does depending on which branch you push to. All you need is some branch-specific configuration in your bitbucket-pipelines.yml file.

That example shows two branches based on the main branch:

Читайте также:  Какая будет сумма алиментов если человек не работает

a branch called feature/BB-123-fix-links that is a feature branch

a branch called experimental where your team can go crazy innovating and breaking stuff. This branch is not a feature branch.

The same bitbucket-pipelines.yml file lives in the root directory of each branch. On each push to a branch, Pipelines executes the scripts assigned to that branch in the bitbucket-pipelines.yml file where:

main step definition contains instructions that run on a commit to main

feature/* definition contains instructions that run on a commit to any feature branch (that’s our BB-123-fix-links branch)

default definition contains instructions that run on a commit to any branch that is not main or feature (that’s our experimental branch)

Note that the branch pipelines are triggered only if the bitbucket-pipelines.yml file requirements for a branch are met.

If you ever want to push a commit and skip triggering its pipeline, you can add [skip ci] or [ci skip] to the commit message.


Default branches: Contains the pipeline definition for all branches that don’t match a pipeline definition in other sections. The default pipeline runs on every push to the repository unless a branch-specific pipeline is defined. You can define a branch pipeline in the branches section.

Note: The default pipeline doesn’t run on tags or bookmarks.

tags: Defines all tag-specific build pipelines. The names or expressions in this section are matched against tags and annotated tags in your Git repository.

This tag triggers a pipeline when a tag starting with “release-” is pushed.

pull-request: A special pipeline that only runs on pull requests initiated from within your repo. It merges the destination branch into your working branch before it runs. Pull requests from a forked repository don’t trigger the pipeline. If the merge fails, the pipeline stops.

Pull request pipelines run in addition to any branch and default pipelines that are defined, so if the definitions overlap you may get 2 pipelines running at the same time.

If you already have branches in your configuration, and you want them all to only run on pull requests, replace the keyword branches with pull-requests.

custom: Defines pipelines that can only be triggered manually or scheduled from the Bitbucket Cloud interface.

With a configuration like the one above, you should see the following pipelines in the Run pipeline dialog in Bitbucket Cloud:

variables [Custom pipelines only] Contains variables that are supplied when a pipeline is launched. To enable the variables, define them under the custom pipeline that you want to enter when you run the pipeline:

Then, when you run a custom pipeline (Branches > > Run pipeline for a branch > Custom:..) you’ll be able to fill them in.

The keyword variables can also be part of the definition of a service.

bookmarks: Defines all bookmark-specific build pipelines. The names or expressions in this section are matched against bookmarks in your Mercurial repository.

Glob patterns

Glob patterns don’t allow any expression to start with a star. Every expression that starts with a star needs to be put in quotes.

Matches with feature/.

The glob pattern doesn’t match the slash ( /), so Git branches like feature// are not matched for feature/*.

If you specify the exact name of a branch, a tag, or a bookmark, the pipeline defined for the specific branch overrides any more generic expressions that would match that branch. For example, let’s say you specify a pipeline for feature/* and feature/bb-123-fix-links. On a commit to the feature/bb-123-fix-links branch, Pipelines executes the steps defined for feature/bb-123-fix-links and won’t execute the steps defined in the feature/*.

Matches all branches, tags, or bookmarks. The star symbol ( * ) must be between single quotes.

This glob pattern doesn’t match the slash (/ ), so Git branches like feature/bb-123-fix-links are not matched for ‘*’. If you need the slash to match, use ‘**’ instead of ‘*’.

Matches all branches, tags, or bookmarks. For example, it includes branches with the slash ( /) like feature/bb-123-fix-links. The ** expression must be in quotes.

This expression requires quotes.

‘ main ‘ and duplicate branch names

Names in quotes are treated the same way as names without quotes. For example, Pipelines sees main and ‘ main ‘ as the same branch names.

In the situation described above, Pipelines will match only against one name ( main or ‘ main ‘, never both).