Automating triggering of Jenkins jobs
Run Jenkins Job element properties
A Run Jenkins Job element triggers a Jenkins job.
The following table describes the Run Jenkins Job input properties:
Property | Description |
---|---|
Connection ID | The ID of the Jenkins connector. |
Job | Location of the Jenkins job. Specify the job location in one of the following ways:
|
Parameters | Parameters that you want to pass to the Jenkins job. |
Delay in seconds | Time interval to delay the start of the Jenkins job. |
The following table describes the Run Jenkins Job output properties:
Property | Description |
---|---|
Queue Item ID | The ID of an item in the Jenkins queue. It is an integer value. For example, 149634. |
Get Jenkins Job Build element properties
A Get Jenkins Job Build element retrieves the build details of a Jenkins job.
The following table describes the Get Jenkins Job Build input properties:
Property | Description |
---|---|
Connection ID | The ID of the Jenkins connector. |
Job | Location of the Jenkins job. Specify the job location in one of the following ways:
|
Build ID | Build ID of the Jenkins job. |
The Get Jenkins Job Build output property is a JSON that provides information such as job location, build ID, and result.
For example,
"result": "SUCCESS",
"id":
"483",
"url":
"http://<host name>:8080/job/SBE/job/01_Developer_Jobs/job/Test%20Sleep/483/",
"building": false,
"status": null
}
Get Queue Item element properties
A Get Queue Item element retrieves the ID of an item in a Jenkins queue.
The following table describes the Get Queue Item input properties:
Property | Description |
---|---|
Connection ID | The ID of the Jenkins connector. |
Queue Item ID | The ID of an item in the Jenkins queue. You can map the output of the Run Jenkins Job element to this field. |
The Get Queue Item output property is a JSON that provides information such as job location and build ID.
For example,
"id":
"152645",
"executable": {
"number": 483,
"url": "http://clm-aus-000479.bmc.com:8080/job/SBE/job/01_Developer_Jobs/job/Test%20Sleep%20with%20Params/483/"
},
"others": null,
"inQueueSince": 1617290746546
}
To create a process to automatically trigger a Jenkins job
- Log in to BMC Helix Innovation Studio.
- Navigate to the Workspace tab, and select the application in which you want to create a process.
- In the application, select Processes, and click New.
The system opens the Process designer. - Drag the Run Jenkins Job element to the canvas and enter the values of the element properties.
- If required, add the Get Jenkins Job Build element and other elements, and enter the element properties.
- Specify the flow of execution and save the process.
Example: Setting up a process to automatically trigger a Jenkins job
Ajay is an application business analyst in Apex Global. He wants to automate the task of triggering a Jenkins job. To automate the task, he creates a process. Ajay uses the Create Document element to access attributes within the schema of the JenkinsParameters document definition. He adds the values for the document nodes and uses these values as input to run the Jenkins job. Ajay uses the Run Jenkins Job element to trigger the job.
Ajay performs the following actions to create the process to automate the triggering of a Jenkins job:
Step | Description | Example |
---|---|---|
1 | Create the process. | |
2 | Add the Create Document element properties. | |
a. To add a document, select the JenkinsParameters document definition. | ||
b. To add values for the document nodes, click Add/Remove Document Nodes, and select the key and value checkboxes of nodes. | ||
For information about the Create Document element, see Creating-a-document-instance. | ||
3 | Add the Run Jenkins Job element properties. | |
4 | In the Run Jenkins Job element properties, in the Parameters field, map the Create Template element output. | |
5 | Save the process. |