Cookie consent

By clicking “Accept”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View our Privacy Policy for more information.

Use Jira to automate the creation of a runbook

Last Updated: October 7th, 2024

Problem Statement

Cutover runbooks can be created manually with the user interface, however there are many cases where you may want to automatically create a runbook as a result of responding to a newly raised bug or incident.

Solution

Jira functionality allows you to create automated rules that can be used to trigger the creation or copy a runbook from a newly created bug or issue. The creation of JIRA tickets could necessitate the need to execute a Cutover runbook to carry out tasks outside of JIRA.

Key Benefits

  • Move through Cutover at speed
  • Save time and effort
  • Less room for error
  • Ability to respond in real time

Recipe

Configuring the Jira Automation Rule

This section provides guidance on how to create a Jira Automation rule. The Jira Automation rule will trigger when you create a new bug or a new issue. This all happens in real time.

Note: The steps documented may differ depending on your Jira set up. Use these as an example to understand the changes and match them to your current configuration where necessary.

Prerequisites

  • You will need to ensure you’re a Project Admin on the Jira project that you would like to create the Jira Automation rule. A good way to test you have the right access is to see if the Project Settings are visible to you.
  • You will need Workspace Runbook Creator or Folder Runbook Creator in the appropriate workspace to create a new runbook. 

Steps for creating the Jira Automation Rule

1. Set up your Jira Automation Rule.

2. Test your Jira Automation Rule.

Set up your Jira Automation Rule

Once the prerequisites are met, you can create a new Jira automation by following these steps:

1. Navigate to your Jira Board > Select Project Settings.

2. Click on Automation and you will be presented with a page as shown below:

3. Click Create Rule > set When:Add a Trigger > Select Issue created. The rule should look like the following:

4. Click Add component > Then: Add an action > Send web request. The rule should look like the following:

5. Update the Send web request form with the following details:

  • Web request URL : Enter in your Base URL and add /core/runbook to the end of the URL. We will be executing the Create a new Runbook API.
  • HTTP method:  Select POST.
  • Web request body: Select Custom data.
  • Custom data:  Paste in the request body below:

In the example below the Jira Automation rule will trigger when an issue is created. The Cutover API will copy a runbook from a template.

{
  "data": {
    "type": "runbook",
    "attributes": {
      "name": "{{issue.summary}} {{issue.key}}"
    }
  },
  "meta": {
    "copy": {
      "source_runbook_id": "Include runbook ID",
      "tasks": true,
      "teams": true,
      "users": true
    },
    "shift_fixed_times": true
  }
}
  
Copy to clipboard

Note: We are using Jira Smart Values in the Runbook name as shown in the code above. This will carry across the issue.summary and the issue.key to form the runbook title. In the source ID please specify the runbook ID that you would like to copy.

  • Headers (optional) - Add in the Key and Value as shown below:

Note: For your Authorization values, write the word Authorization in the key field and in the value field write Bearer followed by your App Token. The rule should then look like the following:

6. Click Next > Turn On Rule

Test your Jira Automation Rule

1. Go back to your Jira Board where you have created your automation rule. Create a new issue ticket by clicking Create:

2. Enter all the relevant details into your new issue and click Create.

3. We can now see our newly created ticket with a ticket number CP-487.

4. Login to Cutover >  Go to the workspace from which runbook was copied from as specified in your code. You will see your newly created runbook.

Note: The issue summary and issue key was carried over into the Cutover runbook title. 


Available endpoints