# From Bitbucket events

thatSuppose users want to trigger a pipeline or release on successful Pull request merge on Bitbucket or when a code is pushed to a particular branch, they can create a webhook using the webhook type as **Bitbucket**.\ <br>

### **Steps to create a Bitbucket Webhook for release** <a href="#steps-to-create-a-bitbucket-webhook-for-release" id="steps-to-create-a-bitbucket-webhook-for-release"></a>

**Pre-requisites:**

* An active Bitbucket account with repositories needs to have the PAT which can be entered while creating Bitbucket integrations
* An Active cluster
* A Release that has been created from the Release Templates section

&#x20;

**Steps**

1. On click of the **create webhook** button, a modal window appears in which we can enter the details for webhook creation

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FDwQOp6i8F8cfFQRizcB7%2Fimage-20240418-044646.png?alt=media&#x26;token=81a45b95-5617-4ef6-a2e6-b2a346d7cb74" alt=""><figcaption></figcaption></figure>

2. Now we need to select the Webhook Type as Bitbucket from the **Webhook Type** dropdown

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FBNHhbacRIxgtbFNGQhCZ%2Fimage-20240418-044734.png?alt=media&#x26;token=de5d8527-cb0b-4dca-b80b-02505bb3a646" alt=""><figcaption></figcaption></figure>

3. After selecting the webhook type as **Bitbucket**, a dropdown will be shown to select the repository for which the webhook needs to be created

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FuvqNFrrygDLKtA1ADpaW%2Fimage-20240418-044810.png?alt=media&#x26;token=d3b35349-030a-46f4-8cce-be4a7dd3d4f6" alt=""><figcaption></figcaption></figure>

4. Once the repository has been selected, users have the option to select the event for which they want the pipeline or release to be triggered\
   Ozone offers **2 events** for which webhooks can be created:
   * Push branch - whenever code is pushed to the **specified branch** the webhook is triggered
   * Pull request - whenever a pull request is merged at that point the webhook will be triggered

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FKwTQoQo3raMh3eDp7Y9R%2Fimage-20240418-044924.png?alt=media&#x26;token=b06c2605-c626-46fd-b261-878e0f8a60a9" alt=""><figcaption></figcaption></figure>

5. After selecting the event, users are provided an option to **select the branch** for the repository for which they want the webhook to be triggered

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FKmBVplHBKbNuBxEE2wIZ%2Fimage-20240418-044956.png?alt=media&#x26;token=959ad84d-afcc-4a07-a0ff-b1d066fb0d00" alt=""><figcaption></figcaption></figure>

6. since the branch has been selected, the next option which is provided for the users to select is whether they want to trigger a **release** or a **pipeline** on the successful happening of the event that they had selected

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FTw52KX8NvsKAK73i0tVJ%2Fimage-20240418-045036.png?alt=media&#x26;token=92355d36-420f-441e-86e0-41ba4b0fc5e5" alt=""><figcaption></figcaption></figure>

Here we will select the option of **Release**

7. After this users can select the release which they want to be triggered

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FA6phAtZfxTBywnPXxKLP%2Fimage-20240418-045114.png?alt=media&#x26;token=c6059cff-587d-49c0-92d9-bf8f0838a2ba" alt=""><figcaption></figcaption></figure>

8. Once every option have been selected the **map parameters** option will be enabled and users can click on it to move to the next step

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FqacmaC8mLKj4LiMTVdfj%2Fimage-20240418-045156.png?alt=media&#x26;token=dcef5470-2206-49ff-8021-5cd8e2b5f855" alt=""><figcaption></figcaption></figure>

9. After going to the second step users can choose the **input run parameters**, once all these options have been selected, users can click on the save button to create the webhook

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FFKA3kvnMeADhjFT5QlS7%2Fimage-20240418-045253.png?alt=media&#x26;token=8f6b79e1-2e26-4281-8fa6-11db71ccb97a" alt=""><figcaption></figcaption></figure>

10. Once the webhook has been created, it will be shown in the tabular list view

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2F9ArAsTHOYLCI39aHROfU%2Fimage-20240418-045326.png?alt=media&#x26;token=e26a1a2e-d7cc-4d4e-8dfe-da718eec660d" alt=""><figcaption></figcaption></figure>

The newly created webhooks are shown at the top of the list, as we can see the webhook type as **Bitbucket**, and the last triggered time is also shown. Users can also enable/disable the webhook from the toggle window, as well as click on the edit icon to edit the webhook.

### **Steps to create webhook for pipeline** <a href="#steps-to-create-webhook-for-pipeline" id="steps-to-create-webhook-for-pipeline"></a>

**Pre-requisites:**

* An Active cluster
* A microservice

Follow the same steps until **Step 5** of Creating Webhooks for release\
\
**Steps:**

1. Once the repository name and the branches have been selected select the trigger type as **Pipeline**

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FB39ioEhAbDwnGCR2XnSD%2Fimage-20240418-060833.png?alt=media&#x26;token=2d0ab39b-8420-416b-b33d-97d7c296a70b" alt=""><figcaption></figcaption></figure>

2. Once the Trigger type has been selected, now select the pipeline that needs to be triggered

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2Fg8bi3vKaF0MBY5H7pALX%2Fimage-20240418-061926.png?alt=media&#x26;token=91ff79a9-99d3-44f3-af67-bb96cf9b4b27" alt=""><figcaption></figcaption></figure>

3. After selecting the pipeline, select the environment in which the webhook needs to be created\
   **Remember to select the environment the same in which the cluster has been created**

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2F4G8sjaiEfFxolUJqeumV%2Fimage-20240418-061947.png?alt=media&#x26;token=c9ba0a40-70fd-4f8b-a211-cd7767eb7859" alt=""><figcaption></figcaption></figure>

4. Once the cluster has been selected, select the microservice

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FHIeuRTgrQ5TvdUwIwTQl%2Fimage-20240418-062004.png?alt=media&#x26;token=7ff75dbf-cd67-4f69-9d06-4adbf60a0b3b" alt=""><figcaption></figcaption></figure>

5. Once the cluster has been selected, select the microservice

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FarS7f0vRN8BteTFNFCIM%2Fimage-20240418-062044.png?alt=media&#x26;token=295a2def-b3f5-408d-ba71-55713b2bdfe1" alt=""><figcaption></figcaption></figure>

6. After selecting the microservice, users can move to the **Map parameters** step, to select the run parameters for the pipeline

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2Fg2KlIJicby41nwzjPD3X%2Fimage-20240418-062123.png?alt=media&#x26;token=9140a456-0154-4b19-b478-493912dfe0e6" alt=""><figcaption></figcaption></figure>

7. In **Map parameters,** users can select all the options as they desire.

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FHrZlu5xoWksCZ5bVnzTf%2Fimage-20240418-085247.png?alt=media&#x26;token=fea68aa7-6c02-4264-9a2f-ca8e29f0f8d2" alt=""><figcaption></figcaption></figure>

8. Once all this is done, users can click on the **Save** button to create the webhook for the pipeline.

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2Fk1mDXbBAwZYxx1ZwxbaI%2Fimage-20240418-085333.png?alt=media&#x26;token=bbf88896-34d2-4d93-bd2d-232a7bcb864a" alt=""><figcaption></figcaption></figure>

9. The created webhook will be shown in the webhook list view

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FzmAX0tGUHm0nWfWOgE6V%2Fimage-20240418-101942.png?alt=media&#x26;token=7f02d20e-cda2-498e-80f0-d416d504c545" alt=""><figcaption></figcaption></figure>

The last triggered time is also mentioned, along with this the webhook type is mentioned as **Bitbucket**.\
Users can click on the edit button to edit the webhook, click on the toggle button to enable/disable the webhook.
