Creating BMC Helix ITSM change requests from Jenkins pipelines by using Jitterbit Harmony
BMC Helix iPaaS, powered by Jitterbit provides a pre-built integration template that enables you to track a Jenkins pipeline from BMC Helix ITSM. When a pipeline is triggered, the template leverages an existing change request that is created from the BMC Helix ITSM and Jira integration, or creates a change request.
To use the integration template with the values defined out of the box, you update the project variables with details of your systems and deploy the integration template.
The template provides the following capabilities:
Use case | Jenkins to BMC Helix ITSM (if a change request does not exist) | Jenkins to BMC Helix ITSM (if a change request exists) |
---|---|---|
Create tickets | Creates a change request and a task under it when a Jenkins pipeline has started. A task in a change request represents a pipeline stage. | Creates a task under an existing change request that is created from the BMC Helix ITSM and Jira integration. A task in a change request represents a pipeline stage. |
Synchronize statuses | Synchronizes the status of a pipeline stage with the corresponding task. |
The following status mappings between a stage and a task are available:
Status of a pipeline stage | Status of a task | Reason for a task status |
---|---|---|
IN_PROGRESS | Work In Progress | NA |
SUCCESS | Closed | Success |
FAILED | Closed | Failed |
ABORTED | Closed | Cancelled |
Jenkins to BMC Helix ITSM data flow by using an existing change request
The following image gives an overview of the data flow from Jenkins to BMC Helix ITSM when a change request already exists:
Jenkins to BMC Helix ITSM data flow by creating a change request
The following image gives an overview of the data flow for creating a BMC Helix ITSM change request from a Jenkins pipeline and shows how the change request is updated:
The following video (2:03) gives a quick overview of the BMC Helix ITSM integration with Jenkins:
Watch the YouTube video about BMC Helix ITSM and Jenkins integration
Before you begin
You require the following items to successfully set up and use this integration:
Required versions |
Important: Make sure you enable the plugins before proceeding with the integration. |
---|---|
Authentication and permissions |
|
Jitterbit Harmony subscription | A valid BMC Helix iPaaS subscription |
Task 1: To download and import the integration template project file
Download the Sync Jenkins Pipeline to BMC Helix ITSM Change Request 2023-01-03 project file to your system.
This file contains the BMC Helix iPaaS Integration Studio project Sync Jenkins Pipeline to BMC Helix ITSM Change Request.- As a developer, log in to BMC Helix iPaaS and navigate to the Integration Studio.
- On the projects page, click Import.
- Click Browse and then select the Sync Jenkins Pipeline to BMC Helix ITSM Change Request 2023-01-03 file you downloaded.
The Project Name and Organization fields are automatically populated depending on the values defined. - From the Environment list, select the environment to which you want to import this integration template, and click Import.
The project opens after the integration template is imported. - (Optional) To open the project file at a later time, select the environment where the integration templates are available, select the Sync Jenkins Pipeline to BMC Helix ITSM Change Request project and click View/Edit.
Task 2: To update the Jenkins pipeline script
Perform the following steps in the Jenkins pipeline script from which you want to create a change request:
In the pipeline script, add the following information:
Information type
Information
Variable
- env.ITSM_CR=""
When the pipeline is run, this variable is autopopulated. - env.ITSM_CR_STATUS="Draft"
Methods
def getCRStatus()—Checks the status of a change request until it is set to Implementation in progress to start executing a pipeline stage.
In the script, call this method after the pipeline starts.def notify(name, status)—Synchronizes the status of a pipeline stage with a task. In the script, call this method for each pipeline stage.
To see how to add these methods in the script, refer to the 1.0 Reference Pipeline Script workflow in the template.
- env.ITSM_CR=""
Task 3: To update the project variables for the integration template
- Next to the Environment name, click the ellipsis ... and select Project Variables.
- Update the following project variables:
Access points and authentication details for BMC Helix ITSM
Project variable
Action
BMC Helix ITSM
ITSM_Username
Enter the administrator username to access BMC Helix ITSM.
ITSM_Password
Enter the password to access BMC Helix ITSM.
ITSM_Rest_URL
Enter the URL to the BMC Helix ITSM REST endpoint.
Jenkins variables
Project variable
Action
Jenkins_Username
Enter the username to access the Jenkins instance.
Jenkins_Password
Enter the password for the username you provided.
Jenkins_URL
Enter the URL of the Jenkins instance you are using.
BMC Helix ITSM fields
Project variable
Value
ITSM_Location_Company
Enter the name of a valid BMC Helix ITSM company for which the change request should be created.
(Optional) Task 4: To set the time for API debug mode
By default, the debug mode is set to 2 hours after you run the integration. Debug logs are updated for the time set for the debug mode. To increase the debug mode for a longer period of time, perform the following steps:
- In BMC Helix iPaaS, select API Manager > My APIs.
- Open the API created for the integration.
The API name is the value defined in the BHIP_API_Name project variable. - Select Enable Debug Mode Until: and set it for the required date and time.
- Save and publish the API.
Workflows included in the integration template
The following workflows are defined as a part of the integration template. Refer to the following details for an overview of the tasks defined in the workflow operations and configurations defined within each workflow.
2.0 Jenkins to ITSM Change
This workflow defines the operations to create change requests and tasks, and update their statuses. The following operations are included in this workflow:
Operation name | Actions performed |
---|---|
2.0 Task Controller | Determines if a task should be created or updated |
2.1 CR Status Controller | Checks the payload and verifies if a change request exists. If not, creates a new change request. |
2.2 Query Change Request Details | Gets the details of the change request |
2.3 Create Task | Creates a task under a change request |
2.4 Query Task | Gets the task details |
2.5 Update Task Status | Updates the status of a task when the status of the corresponding stage is changed |
2.6 Create a New CR | Creates a new change request |
2.7 Query From TSM Association | Makes sure that tasks under a change request execute in a sequence |
2.8 Active the Task (TMS Flow Builder) | Activates a task in a sequence |
2.9 Query Task phase management | Ensures that tasks are executed in a sequence |
2.10 Get Pipeline Stages | Gets the details of a pipeline stage |