5.22.1.1. First Time Jenkins Configuration required before using the  “Loop Jenkins” action.

<< Click to Display Table of Contents >>

Navigation:  5. Detailed description of the Actions > 5.22. TA - Distributed Computations > 5.22.1. Loop with Jenkins >

5.22.1.1. First Time Jenkins Configuration required before using the  “Loop Jenkins” action.

 

This is a “one time” configuration process. Before following the instructions given in this section, you must first install Jenkins: See the section 4.8.2. to have more information on how to install Jenkins on your system.

 

If you already setup&configured the Anatella Jenkins-Wizard (see the steps 18 and 19 from section 4.8.2.), you don’t need to follow the instructions given inside this section (i.e. the Jenkins-Wizard already made everything automatically for you).

 

All instructions are illustrated using screenshots.

 

This is a 3 steps process:

 

Step 1:  Add (and configure) inside Jenkins the Project named “AnatellaRunner”.
 
Since Anatella v2.52, you don’t need to manually perform the “step 1”: This is done automatically for you when you configure the integratin of Jenkins inside Anatella: You can thus safely skip this first step and go directly to “Step2”.

 

1.1.Open a browser and click on “New Item” in the top left corner of the “Jenkins” home page:
 
ANATEL~4_img341
 

1.2.Give the name “AnatellaRunner” to your “project”.

 

1.3.Select the option “Freestyle Project”.
 

1.4.Click the OK button.
 
clip0272
 
 

1.5.Click (Enable) the “Discard old builds” option.
 

1.6.Enter “2” as the parameter “Days to keep builds”.
 
 
clip0273
 

 

ANATEL~4_img129

Selecting “2” as the parameter “Days to keep builds” means that Jenkins will keep for 2 days the informations about the success or failure of your Anatella jobs.

The ANATEL~4_img340 queryJenkins action (see section 5.22.3.) and the ANATEL~4_img339 waitJenkins action (see section 5.22.2.) both need this information in order to work properly.

This means that, if you use the ANATEL~4_img340 queryJenkin action to get the status (success or failure) of a “old” job that was launched more than 2 days ago, the information required to answer your question won’t be available anymore inside Jenkins (since the parameter “Days to keep builds” is set to the value “2” by default). Thus, the ANATEL~4_img340 queryJenkin action will be unable to answer your request (a similar failure will happen for the ANATEL~4_img339 waitJenkin action).

Thus, if you have very long running jobs (e.g. several days), I suggest that you select a larger value for the parameter “Days to keep builds”.

 
 
 

1.7.Add the three “String” parameters named “AnID”, “AnFile” and “AnParameters”:
 
1.7.1. Click (Enable) the “This project is parametrized” option.
 
1.7.2. Click the ComboBox named “Add Parameter” and select “String Parameter
 
clip0274
 
1.7.3. Enter “AnID” as the name of our first “String” parameter.
 
1.7.4. Click again the ComboBox named “Add Parameter” and select the option “String Parameter
clip0275

 

ANATEL~4_img129

The “AnatellaRunner” project must have the 3 parameters named “AnID”, “AnFile” and “AnParameters”. It’s important that the “AnID” parameter is the first parameter in the list.

 

 
1.7.5.Enter “AnParameters” as the name of our third “String” parameter
 
1.7.6 Click again the ComboBox named “Add Parameter” and select the option “String Parameter”
 
clip0277
 
1.7.7. Enter “AnParameters” as the name of our third “String” parameter.

 

1.8. Click (Enable) the “Execute concurrent builds if necessary” option.

 
clip0276

 

 

1.9.Scroll to the bottom of the webpage and, inside the section “Build”, click on the “Add build step” ComboBox and select the “Execute Windows batch command” option:

 

ANATEL~4_img355

 

1.10. Inside the “Command” text field, enter the following:
 

 
  chcp 1252 >nul
 "C:\soft\TIMiPortable\bin\anatella" -e "%AnFile%" -te -s %AnParameters%
 IF %ERRORLEVEL%==1 exit 0
 

 
 
 

ANATEL~4_img129

If the “Anatella” executable is inside another directory that the directory “C:\soft\TIMiPortable\bin”, please adjust the “Command” text field accordingly.
 

 
 

1.11. Click on the “Save” button.

 

ANATEL~4_img357

 
 

Step 2: Make sure that the CSRF Protection is active

 

This is a usefull security measure to prevent unauthrorized execution of Jenkins jobs (through the Cross Site Request Forgery -CSRF- exploit). By default, the “CSRF Protection” is already active, but it’s still better to check, just to be sure.

 
 
2.1. Inside the Jenkins Home page, click on “Manage Jenkins”:

 
clip0279

 

 
2.2. Click on the “Configure Global Security” button:

 
clip0280

 
 

2.3. Make sure that the “Prevent Coss Site Request Forgery exploits” option is checked (i.e. enabled). If it’s not, enable the option and then click on the “Save” button.

 

clip0281

 

Step 3: Optional Step: Aquire an “API Token”.

 

To use the ANATEL~4_img321 “Loop Jenkins” action (see section 5.22.1.), the ANATEL~4_img339 waitJenkins action (see the section 5.22.2.) or the ANATEL~4_img340 queryJenkins action (see the section 5.22.2.), you must enter your Jenkins password. For example:

 

 

ANATEL~4_img320

 

 

Alternatively, instead of entering you user password, you can enter an “API Token”. The procedure to obtain your “API Token” is:

 

3.1. Inside the Jenkins Home page, click on “People”:

 

clip0282

 

3.2. Click on your “User ID” (or on the “User ID” of the user that will be using Jenkins from Anatella):

 

clip0283

 

3.3. Click on “Configure”:

 

clip0284

 

 

3.4.  Click on the “Show API Token” button:

 

ANATEL~4_img368

 
 

3.5. Your “API Token” is here:

 

ANATEL~4_img369