x
login Signup

How do I call a Flow pipeline from a Jenkins pipeline

The documentation https://wiki.jenkins.io/display/JENKINS/ElectricFlow+Plugin shows an example of a call of a Flow pipeline from a jenkins job but not from a Jenkins pipeline. What code should be used?

avatar image By lrochette 5.9k asked Jun 27, 2018 at 08:15 PM
more ▼
(comments are locked)
10|750 characters needed characters left

1 answer: sort voted first

The code for the pipeline is as follow for a flow pipeline with 2 parameters: param1 and param2

 step([$class: 'ElectricFlowPipelinePublisher', 
         configuration: 'EFlow',
         projectName : 'my_flow_project',
         pipelineName : 'jenkinsTest',
         addParam : '''{
                     "parameters":[
                         {"parameterName": "param1", "parameterValue": "12345"},
                         {"parameterName": "param2", "parameterValue": "string2"}
                      ]
         }'''
 ])

Of course you need to create the Flow configuration on the Jenkins server as described in the documentation.

avatar image By lrochette 5.9k answered Jun 27, 2018 at 08:18 PM
more ▼
(comments are locked)
avatar image lrochette 3 days ago

Iris, a customer mentioned the parameter block was incomplete and needs an additional pipeline object as in:

addParam : '{"pipeline":{"parameters":[{"parameterName": "version", "parameterValue": "42"}]}}'

After verification, the code in the original answer works for Flow plugin 1.1.3. The code in this comment works on 1.1.5 (according to the Git history, the change was done between 1.1.3 and 1.1.4)

10|750 characters needed characters left
Your answer
toggle preview:

Up to 8 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.