Using the Jenkins Spoke

Bill7
Mega Expert

So I am just starting to try and use Flow Designer for integration.  We currently use Jenkins as well as ServiceNow.  Is there a guide that will walk me through how to call a job or perform a build?  I am just looking for a basic guide to get started.  Thank you for any help.

6 REPLIES 6

sachin_namjoshi
Kilo Patron
Kilo Patron

you can use below to get started

 

https://www.youtube.com/watch?v=03xJ_l93b8s

 

Regards,

Sachin

So this video is all about qtest.  I need to know how to use Flow Designer and the Jenkins spoke.

ezrawalgraf
ServiceNow Employee
ServiceNow Employee

Hi Bill,

Here is the Jenkins Spoke Guide documentation:

https://docs.servicenow.com/bundle/newyork-servicenow-platform/page/administer/integrationhub-store-...

 

The bare minimum actions you would use to test performing a build would be the following:

1. Get CSRF Token Action

find_real_file.png

 

2. Perform a Build Action

find_real_file.png

 

What I would do is make copies of those actions and then configure the required parameters like Connection Alias for the "Get CSRF Token Action" and Job Path for the "Perform a Build" Action.

**be sure to publish those newly created actions or you won't be able to use them in any Flows. Also make sure you have already created your Jenkins Connection and Credential Alias as stated in the ServiceNow Documentation I gave the link for above.

 Once you have published the actions, go into Flow Designer and make a simple Flow that uses them.

**hint, I usually use Run Once as my trigger when first making Flows and testing them out.

 ! notice that I used the "CSRF Token" Data Pill that was the output of the "Jenkins Test - Get CSRF Token" Action in the CSFR Token Parameter Field of the "Jenkins Test - Perform a Build" Action. Just pull it over and drop it in.

 

Example of a *very* simple Flow that would invoke a Jenkins build.

find_real_file.png

 

-here is also the documentation for Jenkins that talks about Remote API Access. Might help you have issues calling the Jenkins API. https://wiki.jenkins.io/display/JENKINS/Remote+access+API

 

I hope that helps to get you started.

 

Cheers,

Ezra

Hi Ezra,

I tried executing action Get CSRF Token which return value. But when the Build still fails with the error as No valid CSRF token was included in the request.

 

I did include in the script section of Perform a Build Action, along with including it in the inputs & input variables , csrf_token.

Script::

(function execute(inputs, outputs) {
inputs = new JenkinsUtils().trimStringInputs(inputs);
outputs.csrf_token = inputs.csrf_token;

 

Is there any other place where i need to include the csrf_token other than the script section of Perform a Build Action ?