Running a Jenkins job
To add the Run a Jenkins Job action to a policy
- In the BMC Helix Intelligent Automation console, click Policies and the click Create Automation Policy.
- In the Policy Information section, enter a unique name and an optional description for the policy.
- Select Manual or Automatic depending upon whether you want to execute the policy manually or automatically based on the incoming events.
- In the Trigger section, click Browse and perform one of the following steps to select an event:
- From the Select Event Type tab, select an existing event type, and click Done.
On the Paste Event JSON tab, enter event in the JSON format, and click Done.
{
"Resource": "ES",
"ResourceType": "Disk",
"Alarm": "on"
}
In the Trigger Condition text box, build the following expression to match the trigger condition to the event:
$.event.Resource == 'ES' && $.event.ResourceType == 'Disk' && $.event.Alrm == 'on'- To add system or custom tags to the policy, perform the following steps:
- System tags: Select one or more tags from the list of available system tags.
Based on the event, some system tags are displayed. - Custom tags: In the Tags (Optional) section, enter a key-value pair.
Tag key should start with an alphabet and end with an alphanumeric character. Key supports alphanumeric characters and periods, dashes, and underscores.
- System tags: Select one or more tags from the list of available system tags.
- To add Configure action to the policy, click Add Action and perform the following steps by using the action wizard:
- From the Pick an automation tool section, click the connector name.
Only configured connectors are displayed here. - Click Select against Generic REST Action.
The action name is displayed. - From the HTTP Method list, select POST.
- In the API Path, provide the path for the job that you want to execute when the event matches the trigger condition in the policy.
For example, <host:port>/view/IA-Jenkin-Actions/job/IA-ES-MinFreeSpace-Alarm-Action/buildWithParameters. - (Optional)To define variables and use them for dynamically configuring the API path, and use the same action for multiple API endpoints based on incoming events. In the Query params section, provide the following values for each of the parameters.
Field
Value
Type
Specify the type as Query.Valid values: Query, Path, Header, Cookie
Key
Specify the key as Token.
Value
Provide the value that matches the key.
Use the following expressions to transform variable values at runtime that you defined while creating the policy.
"key": $.'Set Input Variables'.output.VARIABLE_NAMEfn:concat(http/||$.event.msg||$.event.splitTest||More Concat) - (Optional) If you want to specify a request body and edit it, perform the following steps:
- Select the Content type as JSON.
- To transform the JSON by using the Raw JSON editor, do the following:
- In the Raw JSON editor, paste the JSON payload you want to edit.
You can add, delete and modify the JSON fields in this editor by using the event slots and variables that you define during policy creation.
- In the Raw JSON editor, paste the JSON payload you want to edit.
- To transform the JSON by using the JSON editor, do the following:
- Hover your mouse next to the field you want to transform.
- Click
.
You can transform the JSON fields in the editor by using the event slots and predefined variables populated automatically in the variable list.
After you add a transformation, a green check mark appears next to the field. The JSON editor updates automatically because both these editors are dynamically synced.- Click Done.
The added action appears in the Action Configuration section on the Create Automation Policies page.
- Click Done.
- From the Pick an automation tool section, click the connector name.
- In the Estimated Savings section, enter an approximate time (in minutes) and money (in USD) that you may save by automating this action.
- Select Publish Policy and click Save to publish the policy.
This policy runs every time an event that matches the trigger conditions appears in BMC Helix Intelligent Automation.
Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*