Inclusion of Servicenow change request state as condition in pipeline prior to prod deployment approval

Hi All

We are looking for a way to include the Change Request State from ServiceNow as a condition in gitlab pipeline prior to Production deployment.

For example An Rest API call to ServiceNow to query change request state and say if state is “implement” then Gitlab should proceed for Prod deployment, Basically this should act as a conditional gate for deployment.

Anyone implemented this in your projects or share your experience on this can be implemented in pipeline. What is the best way to implement this using rules or something else? Any leads will be greatly helpful

1 Like

Hi,

I didn’t implement anything like that, but if you have access to REST API almost anything is possible with a custom script.

If we are talking a simple “yes/no” “true/false” gate, e.g. if yes → proceed, if no → don’t proceed, it should be quite simple.

You can make a script (python/bash/go/literally whatever language) that calls the API and depending on the result it returns either 0 (if it should proceed) or something else (if it should not proceed). GitLab pipelines by default do not proceed further when a job has failed. So the most basic setup would be like this:

stages:
- check
- deploy

check service:
  stage: check
  script:
    - # call api and evaluate the result; make sure it fails with exit > 0 when it shouldn't go further

deploy to prod:
  stage: deploy
  script: 
    - echo "Deploying to prod"

Hope this gives you enough inspiration for start! :slight_smile:

Hi @Tej you could set up a 2-way ServiceNow integration with Unito. It turns ServiceNow records into GitLab issues and back with automated real-time updates.

In the no-code interface, you could add a rule to only sync change requests from ServiceNow to GitLab if a certain state has been applied. The flow can be set up in around 10-15 minutes, the platform is SOC 2 Type 2 Compliant, and Unito doesn’t store user data. It’s just a bridge between apps and tools.

Let me know if you have any questions!