The CreatorCon Call for Content is officially open! Get started here.

Integration of changes in service now to run in jenkins pipelines

NiloCorreia
Kilo Contributor

Hi all, I need to integrate the changes in the service now to run in the pipelines I have in Jenkins.

1 REPLY 1

catherinewil
Mega Expert

Hi all,

If you need to integrate changes in ServiceNow to run in your Jenkins pipelines, here’s a straightforward way to do it:

  1. Install Jenkins Plugins:

    • First, ensure you have the necessary plugins installed in Jenkins:
      • ServiceNow Jenkins Plugin: This plugin helps connect Jenkins with ServiceNow.
      • Pipeline Plugin: For managing your Jenkins pipelines.
  2. Configure ServiceNow Credentials in Jenkins:

    • In Jenkins, go to Manage Jenkins > Manage Credentials.
    • Add a new credential with your ServiceNow instance details (username, password, and instance URL).
  3. Create a ServiceNow Trigger in Jenkins:

    • Go to your Jenkins job and click on Configure.
    • In the Build Triggers section, select Trigger builds remotely (e.g., from scripts).
    • Generate an authentication token to be used by ServiceNow to trigger Jenkins builds.
  4. Set Up ServiceNow Business Rule:

    • In ServiceNow, navigate to System Definition > Business Rules.
    • Create a new Business Rule that triggers on the specific changes you are monitoring (e.g., on record update).
    • In the When to run section, set the conditions for when this rule should trigger.
    • In the Script section, add a script to send an HTTP request to Jenkins to trigger the pipeline. For example:

var request = new sn_ws.RESTMessageV2();
request.setHttpMethod('POST');
request.setEndpoint('https://<your-jenkins-url>/job/<your-job-name>/build?token=<your-token>');
var response = request.execute();

  1. Build Your Jenkins Pipeline:

    • In Jenkins, define your pipeline steps in a Jenkinsfile. This file will include the stages and steps required to build, test, and deploy your application.
    • Make sure your pipeline includes stages that will be triggered by the changes coming from ServiceNow.
  2. Test the Integration:

    • Make a change in ServiceNow that should trigger the Jenkins pipeline.
    • Monitor the Jenkins job to ensure it starts and runs as expected.

By following these steps, you'll be able to integrate changes in ServiceNow with your Jenkins pipelines, enabling seamless and automated workflows.

 

If you need further assistance or a customized solution, Impressico Business Solutions can help streamline and optimize your integration processes.

 

I hope this helps! Let me know if you have any questions.

Best regards,