Skip to main content

Manual setup of CI jobs and Pipeline webhooks in Bitbucket

This is a guideline to manually setup webhooks in Bitbucket(BB)

Written by Jacob Joshua

This article explains how to manually create the Bitbucket webhooks Gearset needs to run CI jobs and Pipelines.

Gearset usually creates these webhooks automatically. If your Bitbucket permissions or internal security policy prevent Gearset from creating them, you can create them manually using the payload URL shown in Gearset.

Before you start

You’ll need:

  • Admin access to the Bitbucket repository.

  • The payload URL shown in Gearset.

You can check how the webhooks are setup for a CI job from this article.

Pipeline webhooks

To set up the webhook for this Pipeline:

  1. In Bitbucket, go to the repository used by the Pipeline.

  2. Go to Repository settings → Webhooks.

  3. Click Add webhook.

  4. Enter a title, for example Gearset Pipeline webhook.

  5. Set the URL field to the payload URL shown in Gearset.

  6. Leave the webhook enabled.

  7. Under Repository, leave Push checked.

  8. Under Pull Request, check Created, Updated, Merged and Declined.

  9. Save the webhook.

After completing these steps, you should see one new webhook in Bitbucket for the Pipeline.

The Pipeline webhook should use the URL provided on your Gearset Pipeline. The URL should include /pipeline.

CI job webhooks

Gearset needs one webhook to run all CI jobs for the same repository. This is part of Gearset’s webhook pooling behaviour: one repository webhook can trigger the relevant CI job by checking the event type, repository, and branch.

To set up the webhook for CI jobs:

  1. In Bitbucket, go to the repository used by the CI job.

  2. Go to Repository settings → Webhooks.

  3. Click Add webhook.

  4. Enter a title, for example Gearset CI job webhook.

  5. Set the URL field to the payload URL shown in Gearset.

  6. Leave the webhook enabled.

  7. Under Repository, leave Push checked.

  8. Under Pull Request, check Created, Updated, Merged and Declined.

  9. Save the webhook.

After completing these steps, you should see one new webhook in Bitbucket for CI jobs.

The CI job webhook should use the URL provided in the Gearset CI job setup. The URL should include /continuous-integration-job.

How many Bitbucket webhooks should I have?

For a repository using both CI jobs and a Pipeline, you should usually have two Gearset webhooks in Bitbucket: Gearset uses webhook pooling, so one Bitbucket CI job webhook can be shared by multiple CI jobs in the same pipeline. If you’re using a Pipeline with multiple CI jobs, you should still open the webhook setup dialog for each CI job in the Pipeline.

Webhook

Purpose

URL includes

Gearset CI job webhook

Runs CI jobs for the repository

/continuous-integration-job

Gearset Pipeline webhook

Allows the Pipeline to respond to repository events

/pipeline

Did this answer your question?