How to Automated Deployments using Build and Release Pipelines

Brian104
Tera Expert

Our team is looking at how to automate deployment from dev to test instances using Azure Pipelines, Git Pipelines, etc. Are there any API endpoints available to initiate a "Publish" and/or "Install" command on a ServiceNow instance? Basically, what we’re trying to create is a build pipeline that gets triggered by a pull request and then invoke the publish or install commands via a REST API call. This is basically what we do on the full stack development side of things (change is made, pull request approved, test is built). QA and Prod require a release approval.

Thanks!

6 REPLIES 6

WORKFLOW-COWBOY
ServiceNow Employee
ServiceNow Employee

Why yes there is... it's called the "Continuous Integration/Continuous Delivery (CI/CD) API". 

https://docs.servicenow.com/bundle/sandiego-application-development/page/integrate/inbound-rest/conc...

You can set up your own pipeline or utilize App Engine Studio.  In AES, there is the concept of a "Deployment Request".  When the request is approved, AES uses the CI/CD API to move the app from Dev to Test to Prod while stopping in Test to do some automated testing before going to Prod. 


--------------------------------------------------
Workflow Cowboy
LinkedIn: https://www.linkedin.com/in/dalestubblefield/
YouTube: https://www.youtube.com/@starlordnow

CI/CI API also leverages Application Repository.  It's good to be familiar with how the Application Repository works as well.

App Repo -> https://docs.servicenow.com/bundle/sandiego-application-development/page/build/applications/concept/...

Here's a nice deployment diagram as well -> https://developer.servicenow.com/dev.do#!/guides/sandiego/now-platform/pro-dev-guide/pd-deploy


--------------------------------------------------
Workflow Cowboy
LinkedIn: https://www.linkedin.com/in/dalestubblefield/
YouTube: https://www.youtube.com/@starlordnow

This is great Dale!  After some initial investigation, it looks like to say publish an application I would need to do something like the following:

In ServiceNow:

  1. Install the Integration Hub Stater Pack
  2. Create a CI/CD credential to my repo.
  3. Create a Scripted REST API that calls the "Publish Application With Scope" subflow provided

In Jenkins, ADO, Github, etc:

  1. Create the build pipeline
  2. Trigger it manually
  3. Call the Scripted REST API  endpoint with required inputs (i.e.scope, credential_alias, instance_url)

I'm going to try this and post my results.   This won't work in a PDI since you can't publish to the store, so my goal is to at least hit the endpoint and get the error from the subflow.

You are on the right path. Correct that it will not work in a PDI as PDI can not publish to Application Repository.  App Repo is only available on ServiceNow customer instances. 


--------------------------------------------------
Workflow Cowboy
LinkedIn: https://www.linkedin.com/in/dalestubblefield/
YouTube: https://www.youtube.com/@starlordnow