Setup

Let's assume we already have a Jira Cloud project and a Bitbucket pipeline setup. If you want to know more about it, please read the documentation:

eficode-Bildschirmfoto-2021-02-05-um-14.06.41

Prerequisites

To configure Jira automation, you need to have specific permissions. For Classic Projects you need the Administer Project permission, for Next-gen Projects, you need to be within the Administrator Role.

Depending on which project type you use, you'll find the automation page here:

Classic project

  • Project settings - Automation

Next-gen project

  • Project settings - Apps - Project Automation

One more thing we need to look at before we start is to find out how the use the Bitbucket API.

eficode-Bildschirmfoto-2021-02-05-um-14.12.42

Automation

1. Trigger

As sketched above we want to trigger the pipeline every time an issue is transitioned into the status "Testing." In this case we should use the "Issue Transitioned" trigger.

eficode-new-trigger

2. Notification

Pick the From Status and To Status.

You can choose several statuses with both fields.

When you've saved this configuration, we can choose to pick a condition to limit the scope of issues. In our case we'll simply pick a new action right away.

From the list of options, we pick Send web request which is within the notifications list.

eficode-web-request

To configure the Send web request, we need the following information:

  • Workspace: Team name or your account name.
  • Repository slug: Repository name.
  • POST Data:

{
      “target”: {
          “ref_type”: “branch”,
          “type”: “pipeline_ref_target”,
          “ref_name”: “master”
      }
}

One way to trigger pipelines is by specifying the branch for which you want to trigger a pipeline. The specified branch will be used to determine which pipeline definition from the bitbucket-pipelines.yml file will be applied to initiate the pipeline. This will then clone the repository and checkout the latest revision of the specified branch.

With this information we can configure our web request:

eficode-web-request-2
eficode-Bildschirmfoto-2021-02-05-um-14.12.42

 

Published: Feb 5, 2021

Updated: Nov 18, 2024

Atlassian