...
Setup OAuth in ServiceNow in your ServiceNow instance.
Create a new OAuth API endpoint for Workbench to access ServiceNow:
Set the “Name” Field to “MettleCI Workbench” and the “Redirect URL” to
https://<workbench url>:8080<port>/api/auth/delegated/service_now<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”:
Record the redirect URL for later use so you don’t have to derive it again. If your organization has installed multiple MettleCI Workbench application, you can add them all to the same ServiceNow Application Registration by adding multiple Redirect URLs. (comma separated)Click on your newly created Application Registration:
Note down the “Client ID” and “Client Secret” field properties for later use:
You are done with the Service Now portion of the configuration but you may want to keep this open until you have validated everything is working.
Configuring MettleCI Workbench Work Item Lookup with
...
Service Now
Access the MettleCI Workbench page to integrate with your Azure Service Now Work Item Management system by logging in to MettleCI Workbench and select Issue Management from the Profile menu (top right)
On the Registered Issue Management Systems screen select the “+” to create a new Issue Management type.. Initially you will have only the “Default “Default Generic Issue Manager” Manager” present, but you can add as many as you need to (including more than one of the same type if necessary) Enter one at a time. It is recommended that you get one working before you add another.
On the Add Issue Management screen that appears
On the Register ServiceNow Issue Management screen that appears next, enter the following values and click Submit:
Issue Management Type: Azure
...
Name: Anything you like, but something that identifies your
...
Service Now organisational instance would be a sensible choice
...
URL: The URI of your Service Now instance recorded earlier.
Client ID: Your Application (client) ID recorded earlier
Client Secret: Your client secret
...
recorded earlier
Search Queries: This defaults to change_task as the table, keyed on number with short_description as the summary shown to the user. If this is sufficient, you can accept this default, or you can edit the query as needed by using the “pencil” icon and “+” icon to edit what is queried or add a new table to query, respectively. Consult with your ServiceNow administrators to determine what table(s) your organization uses.
OPTIONAL - In the Search Queries section of any query, you can add add a filter expression to any of your queries to limit what is returned. Note that this expression is not checked for correct syntax.
It is not necessary to restart the workbench service but clearing the log and restarting may aid in debugging
Code Block $> 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 issumManagement.yaml
file in the installation directory and assuming the choices above were made, would appear like so:
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" id: "${number}" summary: "${number}: ${short_description}" query: |
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
5. ServiceNow work items will be available from the the Issues drop down on the Git Commit page during Check-in:
...
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 toserviceNow
, add anserviceNow
section as shown below and replace the<tags>
with the values noted in the previous steps:Code Block language yaml 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 thecolumn_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: