This documentation supports releases of BMC Helix Intelligent Automation up to December 31, 2021. To view the latest version, select version 23.1 from the Product version menu.

Running a Jenkins job

The Generic REST API connector allows add an action to the automation policy for any of the REST API methods, GET, POST, PUT, PATCH, or DELETE.

This topic provides an example of creating an automation policy for running a job in Jenkins for adding or updating the storage based on an event that is generated for ES storage full. 

While creating an action, you can use an event stored in the BMC Helix Intelligent Automation database or provide an event in a JSON format. 

To add the Run a Jenkins Job action to a policy

  1. In the BMC Helix Intelligent Automation console, click Policies and the click Create Automation Policy.
  2. In the Policy Information section, enter a unique name and an optional description for the policy. 
  3. Select Manual or Automatic depending upon whether you want to execute the policy manually or automatically based on the incoming events.
  4. 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"
      }
  5. 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'
  6. To add system or custom tags to the policy, perform the following steps:
    1. System tags: Select one or more tags from the list of available system tags. 
      Based on the event, some system tags are displayed.
    2. 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. 
  7. To add action to the policy, click Add Action and perform the following steps by using the action wizard:
    1. From the Pick an automation tool section, click the connector name.
      Only configured connectors are displayed here. The wizard takes you to the next step to select an action. 
    2. Click Select against Generic REST Action.
      The action name is displayed. 
    3. From the HTTP Method list, select POST.
    4. 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.
    5. In the Query params section, provide the following values for each of the parameters.

      FieldValue
      TypeSpecify the type as Query.Valid values: Query, Path, Header, Cookie
      KeySpecify the key as Token.
      ValueProvide the value that matches the key.
    6. (Optional) If you want to specify a request body, select the Content type as JSON and paste the JSON in the body area. 

    7. Click Done.
      The added action appears in the Action Configuration section on the Create Automation Policies page.
  8. In the Estimated Savings section, enter an approximate time (in minutes) and money (in USD) that you may save by automating this action.
  9. 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. 

Was this page helpful? Yes No Submitting... Thank you

Comments