Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Integrating your MettleCI Workbench with ServiceNow will enable MettleCI Workbench to perform a dynamic lookup when linking DataStage Git commits to one or more ServiceNow work items directly within the Workbench user interface. It is a two-step process, there are some items to configure and collect from the ServiceNow instance, and then some items to configure in Workbench.

...

Register Workbench as an OAuth2 ServiceNow Application

  1. Setup OAuth in ServiceNow in your ServiceNow instance.

  2. Create a new OAuth API endpoint for Workbench to access ServiceNow:

    Image RemovedImage RemovedImage AddedImage Added
  3. Set the “Name” Field to “MettleCI Workbench” and the “Redirect URL” to https://<workbench url>:<port>/api/auth/delegated/<N> where <workbench url>is the URL of your Workbench installation (usually your Development engine), <port> is the https port you are running on (often but not always 8443, check your <config.yml file if unsure), and <N>is the index of the WIM you plan to add (the default generic is 0 and if this is the first other WIM you are adding, the value here would be 1) and click “Submit”:

    Image RemovedImage Added


    Record the redirect URL for later use so you don’t have to derive it again. If your organization has installed multiple MettleCI Workbench applicationapplications, you can add them all to the same ServiceNow Application Registration by adding multiple Redirect URLs. (comma separated)

Info

Note that some ServiceNow instance connections may not function properly if your workbench instance is using a self signed certificate. The submission shown here will save successfully but runtime errors happen when trying to query work items from MettleCI Workbench. If this occurs you will need to reconfigure your Workbench instance to use a CA signed certificate.

  1. Click on your newly created Application Registration:

...

  1. Image Added

  2. Anchor
    ServiceNowRegisterConfig
    ServiceNowRegisterConfig
    Note down the “Client ID” and “Client Secret” field properties for later use:

...

...

  1. Image Added

Note that the example shows http:// because it is the automatically supplied default value, but your URL will most likely need to be https://. You’re ServiceNow portion of the configuration is now complete.

Configuring MettleCI Workbench Work Item Lookup with Service Now ServiceNow

  1. Access the MettleCI Workbench page to integrate with your Service Now ServiceNow Work Item Management system by logging in to MettleCI Workbench and select Issue Management from the Profile menu (top right)

    1. Image RemovedImage Added
  2. On the Registered Issue Management Systems screen select the “+” to create a new Issue Management type.. Initially you will have only the “Default Generic Issue Manager” present, but you can add as many as you need to (including more than one of the same type if necessary) one at a time. It is recommended that you get one working before you add another.

    Image RemovedImage Added
  3. On the Add Issue Management screen that appears

    Image RemovedImage Added

select Service Now ServiceNow from the Select Issue Management Type dropdown

...

  • Field list

    • Name: Anything you like, but something that identifies your Service Now ServiceNow organisational instance would be a sensible choice

    • URL: The URI of your Service Now ServiceNow instance recorded earlier.

    • Client ID: Your Application (client) ID recorded earlier

    • Client Secret: Your client secret recorded earlier

    • Search Queries: This has no default, you will need to create at least one query. Consult with your ServiceNow administrators to determine what table(s) your organization uses, and thus, what table(s), then add or edit the query or queries as needed by using the “pencil” icon and “+” icon to edit what is queried or add a new table to query, respectively. The example dialog below uses change_task incident as the table, keyed on ${number} with ${number}: ${short_description} as the summary shown to the user.

    • OPTIONAL - In the Search Queries section of any query, you can add add a filter expression to limit what is returned. Note that this expression is not checked for correct syntax. Consult with your ServiceNow administrators to determine whether you need to filter (most organizations will not) and what columns/values to filter on.


    Image Removed
    • The example dialog below includes a filter on the status column, which limits the result to rows where the value of the column is “Active” Leave this field empty if you do not wish to filter results.

...

Info

Search queries use ${ } to represent column values. Other characters, if any, are reproduced as is.

The filter, on the other hand, takes the column name and a literal without any enclosing ${ }.

  • Submit (Save) the newly registered ServiceNow issue management system.

Info

...

Expand
titleTips to aid debugging when having trouble registering a new ServiceNow issue management system.
  • It is not necessary to restart the Workbench service, but clearing the log and then restarting the service may aid in debugging.

    Code Block
    $> cd /opt/dm/mci
    $> mv mci.log mci.log_preIssueManagementChanges
    $> sudo service dm-mettleci-workbench restart
  • During issue lookup, Workbench will search each ServiceNow Table configured in the Search Queries list. The Ids that will appear in the commit message are generated from the value of the “Primary Key Column” value and the text shown to the user in the lookup is generated from the “Ticket Summary Column” value. These settings are retained in the issuesmanagement-settings.yaml file in the installation directory. Assuming the choices above were made, this file would

...

  • appear like so: (Note: ID 0 is the default generic issue management which takes no other parameters.)

Code Block
---
- id: 0
  type: "GENERIC"
  name: Default Generic Issue Manager"
- id: 1
  type: "SERVICENOW"  
  name: MyServiceNow:
  url: <your ServiceNow instance URL>
  clientId: <your Client ID>
  clientSecret: "<your Client Secret>"
  search:
      - table: "
change_ task
incident"
        id: "${number}"
        summary: "${number}: ${short_description}"
        filter: "
state
status='
ACTIVE
Active'"

Template Strings are text containing special ${column_name} formatted variables which Workbench will replace with Column data from the ServiceNow Table based on the column_name. As above, the filter expression, if any, does not use this notation.

5. You can now select your new Service Now ServiceNow WIM from for any existing or new project.

From Project Managementthe Registered Projects page, select an existing project for editing via the pencil icon:

...

At the bottom there is a dropdown to let you select from all currently configured types of Work Item Management

...

Select myServiceNow (or whatever you named your connection) from the choicesavailable options …

...

and then select Update Project. Change all existing projects that you want to use Service Now ServiceNow with, as desired.

6. ServiceNow work items will be available from the the Issues drop down on the Git Commit page during Check-in for projects using it:

...

That concludes Service Now setup.

(cut the rest of this as it’s obsolete)

For older Workbench installations prior to 1520 (??)

...

If you are starting Workbench for the first time, you will be taken through a setup wizard. You can configure your ServiceNow work item lookup in the setup wizard.
Alternatively, log into your MettleCI Workbench server and open /opt/dm/mci/config.yml in your favorite editor and follow the next three steps.

Change the issueManagement property to serviceNow, add an serviceNow section as shown below and replace the <tags> with the values noted in the previous steps:

Code Block
languageyaml
issueManagement: serviceNow
serviceNow:
   url: <your ServiceNow instance URL>
   clientId: <your Client ID>
   clientSecret: "<your Client Secret>"

...

Add at least one ServiceNow Table to search during Work Item lookup:

Code Block
issueManagement: serviceNow
serviceNow:
   url: <your ServiceNow instance URL>
   clientId: <your Client ID>
   clientSecret: "<your Client Secret>"
   search:
      - table: <first ServiceNow Table to search>
        id: <template string>
        summary: <template string>
      - table: <second ServiceNow Table to search>
        id: <template string>
        summary: <template string>

During issue lookup, Workbench will search each ServiceNow Table configured in the search list. The Ids that will appear in the commit message are generated from the “id” template string and the text shown in the lookup is generated from the “summary” template strings.
Template Strings are text containing special ${column_name} variables which work bench will replace with Column data from the ServiceNow Table based on the column_name.
For example, the following configuration can be used to first lookup Incident and then Problem Tables as provided in default ServiceNow configurations:

Code Block
issueManagement: serviceNow
serviceNow:
   url: <your ServiceNow instance URL>
   clientId: <your Client ID>
   clientSecret: "<your Client Secret>"
   search:
      - table: incident
        id: "${number}"
        summary: "${number}: ${short_description}"
      - table: problem
        id: "${number}"
        summary: "${number}: ${short_description}"

Restart the workbench service

Code Block
sudo service dm-mettleci-workbench restart

ServiceNow work items will be available from the the Issues drop down during Check-in:

...

This last step concludes your ServiceNow integration!