Service Management plays an integral role in managing, delivering, and auditing changes across the pipeline, as well as tracking incidents that occur as part of the software delivery lifecycle. In this blog series I will showcase four use cases for integrating a FlexDeploy pipeline with ServiceNow.

The first three use cases focused on Change Management. Let’s shift gears and talk about another use case for Incident Management.

When a deployment fails someone will need to take action to resolve the issue. Often times organizations look to record these events by creating an incident in their Service Management system. This is quite simple to implement using FlexDeploy’s Outgoing Webhooks. An outgoing webhook offers functionality to subscribe to FlexDeploy events and take some action. Most often, but not always, this is used to integrate outbound to external tools.

For this use case I created an outbound webhook to subscribe to the Workflow Completed event. The webhook function is implemented in Groovy, and makes use of a rich library of functions that are available out of the box. This function extracts information from the event payload (project name, environment name, and workflow execution id), and formulates a map setting the values for an incident.

Line 16 uses the createIncident function to create the ServiceNow incident.

Outbound webhook to subscribe to the Workflow Completed event.

Notice that the event is for “Workflow Completed”, which means that it applies whether it was successful or failed. In this case we only want to create an incident if the status is failed. Here we can make use of a Filter and conditionally return whether the function should be called. If the event is due to a failed workflow request the function will be executed, otherwise it will not.

Use a Filter in FlexDeploy to see if workflows failed.

We did not implement it here, but we could also filter to exclude build workflow failures. As implemented above the function applies to workflows of all types.

To test this use case I intentionally introduced a deployment failure for one of the packages in my snapshot.

Deployment failure in a package in FlexDeploy.

Reviewing the messages and logs for the webhook we can see that the event was fired and that it created an incident in ServiceNow.

Incident in ServiceNow

Incident log in ServiceNow

In ServiceNow we can see the short description and description that we set in the Groovy function.

Incident description in ServiceNow

Outbound Webhooks enable endless integration scenarios, and this example shows just how easy it is to incorporate Incident Management into your DevOps pipelines.

Share this:
Erick Jones

I have been working with Java EE technologies for 25 years, and have applied industry experience implementing IBM and Oracle solutions. Through my architecture and development experience I have implemented several homegrown and third party automation solutions to manage the software delivery lifecycle. At Flexagon I am a DevOps evangelist, with a passion for helping customers deliver software to their customers faster, cheaper, and with higher quality. My primary focus is on FlexDeploy product strategy, and pre-sales and post-sales implementations.

More posts by Erick Jones
    

Leave a Reply

Your email address will not be published. Required fields are marked *