Test Data Manager

 View Only
Expand all | Collapse all

Javelin workflow execution using Jenkins

  • 1.  Javelin workflow execution using Jenkins

    Posted Apr 15, 2021 03:04 AM
    Hi there,

    We are developing Javelin workflow to automate the data generation process. We are using GIT Lab as a configuration management tool and Jenkins for CICD integration. So would like to understand the process of executing javelin workflow from Jenkins via Gitlab and how parameter values can be passed to Javelin in this scenario. 

    regards,
    Mahesh


  • 2.  RE: Javelin workflow execution using Jenkins

    Broadcom Employee
    Posted Apr 15, 2021 04:32 AM
    Hi Mahesh,

    You can use JavelinExecutor to run Javelin flows in Batch Mode. So, you can also pass variables by using variable file. Detailed information on below link.

    https://techdocs.broadcom.com/us/en/ca-enterprise-software/devops/test-data-management/4-9/javelin/run-javelin-in-batch-mode.html

    Best Regards,
    Cihan



  • 3.  RE: Javelin workflow execution using Jenkins

    Posted Apr 16, 2021 05:30 AM
    Hi Cihan,

    Thanks for the suggestion. I have tried the option of running Javelin flows in Batch mode and it is working fine when I am not passing any argument as parameter at run time from the command line. (which considers the variables that are already defined in the workflow). But when I am passing the parameter/s from command line as part of batch execution, the Javelin flow does not consider the provided parameter value for the variable even though it is getting reflected correctly in the CSV file created where the variables are defined.

    Eg: In my case, I have a variable for iterator, and the flow must execute for the iterator count. When I am providing value for this (say 2) in the workflow and running it in batch mode, it is getting executed for the iterator count (twice in this case). But when I am passing this variable value as argument (say 3) while executing the batch from command line, it still considers the value provided in the workflow (which is 2) and does not repeat thrice. When I do not assign any value for that variable in the workflow and try passing it from the batch mode, the flow does not iterate.

    Please can you advise here.



  • 4.  RE: Javelin workflow execution using Jenkins

    Broadcom Employee
    Posted Apr 16, 2021 09:50 AM
      |   view attached
    Hi Mahesh,

    I tried to replicate the case as basic as possible and It worked fine. I am attaching the sample flow and files.

    Best Regards,

    Attachment(s)

    rar
    IterationFlow.rar   2 KB 1 version


  • 5.  RE: Javelin workflow execution using Jenkins

    Posted Apr 19, 2021 02:13 AM
    Hi Cihan,

    I have executed the sample setup shared, and see the same behavior as that of earlier. (loop getting executed for the parameter configured in workflow, rather than the argument at runtime). In this case, I have the iteration as 1 in the workflow and 3 in the CSV input file.  Perhaps, it is not loading the configuration file correctly with the argument value, despite being able to access file/path C:\Program Files\Grid-Tools\Javelin\JavelinExecutor.exe.Config.?



    logfile:


  • 6.  RE: Javelin workflow execution using Jenkins

    Broadcom Employee
    Posted Apr 19, 2021 04:10 AM
    Hi Mahesh,

    I tried again and it worked just fine.


    Could you please check if you run CMD as administrator? Also, what version of Javelin are you using? 

    Best Regards,



  • 7.  RE: Javelin workflow execution using Jenkins

    Posted Apr 19, 2021 04:23 AM
    Hi Cihan,

    I am using 4.9.155 Javelin version. I tried with admin cmd prompt, but still no luck.




  • 8.  RE: Javelin workflow execution using Jenkins

    Broadcom Employee
    Posted Apr 19, 2021 05:21 AM
    Hi Mahesh,

    As far as I could understand, you create the variable files in runtime which overwrites the Iteration.csv file which has no value. That causes Javelin to use iteration variable value which is saved in flow.

    I am sending you the cmd script file. 

    REM @echo off
    if [%1]==[] goto error
    if [%2]==[] goto error

    (
    echo ^<?xml version="1.0" encoding="UTF-8"?^>
    echo ^<GTJavelinJob^>
    echo ^<FlowPath^>C:\TDMWork\IterationFlow.vwf^</FlowPath^>
    echo ^<VariableFilePath^>C:\TDMWork\IterationFlow.csv^</VariableFilePath^>
    echo ^<LogFile^>C:\TDMWork\mylogfile.log^</LogFile^>
    echo ^<outdir^>C:\TDMWork^</outdir^>
    echo ^</GTJavelinJob^>
    ) > C:\TDMWork\IterationFlow.xml

    (
    echo Name,Value,Scope
    ) > C:\TDMWork\IterationFlow.csv
    (
    echo "iteration","%1","Flowchart"
    ) >> C:\TDMWork\IterationFlow.csv
    (
    echo "i","%2","Flowchart"
    ) >> C:\TDMWork\IterationFlow.csv


    "C:\Program Files\Grid-Tools\Javelin\JavelinExecutor.exe" file="C:\TDMWork\IterationFlow.xml"
    goto end

    :error
    echo.
    echo ** ERROR SPECIFYING PARAMETERS
    echo.
    echo ** TO RUN: filePath OutFilePath
    echo.
    :end

    Could you please try with that one?

    Run as "IterationFlow.cmd 8 0" 

    8 > Iteration count
    0 > value of i which iteration should start

    Best Regards,




  • 9.  RE: Javelin workflow execution using Jenkins

    Broadcom Employee
    Posted Apr 19, 2021 05:24 AM
    Forgot to attach sample output.





  • 10.  RE: Javelin workflow execution using Jenkins

    Posted Apr 21, 2021 12:21 AM
    Thanks Cihan,

    I am now able to iterate through the argument value provided at runtime. Thank you for your kind response.

    Also, I would like to understand how the sessions are managed when we execute the batch each time. Does it close the session after invoking the Javelin executable? 

    regards,
    Mahesh


  • 11.  RE: Javelin workflow execution using Jenkins

    Broadcom Employee
    Posted Apr 21, 2021 08:13 AM
    Hi Mahesh,

    You can use "/user/logout" method to log out or invalidate user session in the end of the Javelin workflow.

    If it is related with execution of Javelin Workflow with Command Line, it automatically terminates the process in the end unless you define opposite.

    Best Regards,




  • 12.  RE: Javelin workflow execution using Jenkins

    Posted Apr 21, 2021 11:18 PM
    Thank you Cihan. Appreciate your support.