Why do we need a ServiceNow Custom Stage in Spinnaker?
In today’s fast-paced world of software delivery business with high release cadence, organizations need to have the proper approvals in place before releasing any applications into the production environments. The release items need to undergo various testing and approvals processes before going into production and we need to have the proper “SignOff Approvals” from each and every release team member with approval authority. In order to have a smooth and continuous ongoing release process, we need to have a good System of Record – Ticketing (feedback) systems like ServiceNow, Jira, etc.
The Spinnaker CD (Continuous Delivery) application makes life easier for the busy release teams handling production releases. By integrating the Spinnaker with the ServiceNow application helps DevOps teams automate the ticketing/auditing of deployments and approval of pipeline stages. Thus, we can have a much easier release process with all the required approvals in place.
In this blog, we will discuss how to use ServiceNow for production deployments using Spinnaker.
Steps for the Integration Process:
- Pre Requisites.
- Configuring Webhook in Service Now.
- Configuring ServiceNow Custom Stage in Spinnaker.
ServiceNow Developer Account.
This blog assumes that the user has the “ServiceNow Developer” account created. If the user does not have the developer account, he can create one using the following steps:
- Navigate to https://developer.servicenow.com/dev.do
- Sign in, if the user already has an account or click “Signup and Start building” to create a new account.
- After logging in, click the “Request Instance” option on the left side.
- Launch the new instance. It will take around 5 mins for the new instance to be created.
- Once the new instance is created, note down the following details for future reference:
- Your instance URL
Configuring Spinnaker Webhook Listener in ServiceNow:
In ServiceNow, we need to create a Scripted Web Service. At a high level, this service performs the following actions:
- Receives the Webhook from Spinnaker.
- Processes the contents of the payload.
Below are the steps to create the Scripted Web Service in ServiceNow:
- Search for Scripted REST APIs in the ServiceNow Navigator.
- Create a new “Scripted Web Service” and give it a descriptive name e.g. SpinnakerWebhookListener.
- Click Submit and create the service.
Configuring ServiceNow Custom Stage in Spinnaker:
To create a ServiceNow custom stage, you can go to /home/spinnaker/.hal/default/
- label: "Service Now: Wait for state"
description: Custom stage that waits for a specific state on a ServiceNow Issue
Authorization: Basic <base64 Encoded Username and pwd of ServiceNow instance>
- label: ServiceNow Issue ID
description: "The Service Now issue ID"
- label: ServiceNow Success States
description: "Service Now issue States that progress the pipeline, e.g,: In Verification, etc."
- label: ServiceNow Retry States
description: "Service Now issue states that Retry the stage e.g, New, etc."
- label: ServiceNow Termination States
description: "ServiceNow issue states that terminate the pipeline, e.g, Done, etc."
- label: ServiceNow Canceled States
description: "ServiceNow issue states that cancel the pipeline e.g,: Closed, etc."
The Custom Stage uses the following labels as a parameter:
- ServiceNow Issue ID: This is the “ServiceNow Change Request” number that is created for the particular release or the deployment activity.
- ServiceNow Success States: This indicates to the Spinnaker in which state of the “ServiceNow Change Ticket”, the Spinnaker pipeline should proceed to the next stage. e.g. Approved.
- ServiceNow Retry States: This indicates to the Spinnaker for what and all the statues of the ServiceNow Change Ticket, the Spinnaker pipeline should wait and retry before the change ticker is moved to the ‘Success’ state.
- ServiceNow Termination States: This indicates to the Spinnaker, in which state of the “ServiceNow Change Ticket” the Spinnaker pipeline should be ‘Terminated’.
- ServiceNow Canceled States: This Indicates to the Spinnaker, in which state of the “ServiceNow Change Ticket” the Spinnaker pipeline should be ‘Canceled’.
- The pipelines that the user creates with this ‘CustomStage’ will need to have the “ChangeRequest number” as one of the mandatory parameters.
- The pipeline will take this “Change Number” as the input and check for the status of the Change ticket in the ServiceNow.
- Once the status of the Change ticket is moved to the desired state by the ServiceNow Change ticket approver, then only this stage will be marked as the ‘Success’ and will be moved to the next deployment of the application into the respective environments.
- If the change request is moved to any of the other statuses then based on the status of the ticket, the pipeline will be canceled or terminated. These states can be configured in the Pipeline.
If you want to know more about the Spinnaker integrations or request a demonstration, please book a meeting with us.
OpsMx is a leading provider of Continuous Delivery solutions that help enterprises safely deliver software at scale and without any human intervention. We help engineering teams take the risk and manual effort out of releasing innovations at the speed of modern business. For additional information, contact us