[workflow-plugin] can a workflow be defined by stitching together existing jobs (local or remote) in parallel/serial?

133 views
Skip to first unread message

Doug Lethin

unread,
Jan 14, 2015, 12:54:30 PM1/14/15
to jenkins...@googlegroups.com
I'm a complete newbie here to the workflow plugin having only gone through the docker container tutorial.

Are there constructs in the dsl to define a workflow that will execute a number of  existing jobs ( either jobs define on the same master, or remote) either in serial or parallel, controlling the parameters being passed, pulling them from jobs run earlier in the flow?

The benefit of this approach is that we could reuse our existing jobs while we we gain experience with workflow. The ultimate goal would be to transfer the work being doing in the individual jobs directly into the flow.

This seems like a basic core step that would be available in the dsl but I couldn't find an example of this in the documentation, and I'm not familiar yet with the implementation and source code layout to mine directly in the code to see if the functionality exists but is not documented, how to possibly write my own extensions for this using the extensions that are available.

Anyone have an experience with this that can provides some pointers/guidelines/examples that might help get me started?

Thanks.


Doug Lethin.


James Nord

unread,
Jan 14, 2015, 3:07:27 PM1/14/15
to jenkins...@googlegroups.com, Doug Lethin
Hi Drug,

'build' of the step you are looking for. It takes a job name and a map of parameters. The has been discussion of this on this list so a quick Google should get you to more information.

/James
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Doug Lethin

unread,
Jan 14, 2015, 10:06:49 PM1/14/15
to jenkins...@googlegroups.com, dle...@gmail.com
Thank you.  This was indeed enough to get me started on how to call a job using the 'build' step.

What I don't understand is -- does the build step return an object as a reference...   

In otherwords, how would I do something like this:

node {

Doug Lethin

unread,
Jan 14, 2015, 10:10:43 PM1/14/15
to jenkins...@googlegroups.com, dle...@gmail.com
grrr. premature post.  didn't get a chance to finish my question : -(

How would I do something like this:

node {
   def jobA = build [job: 'buildA', parameters]

Doug Lethin

unread,
Jan 14, 2015, 10:15:24 PM1/14/15
to jenkins...@googlegroups.com, dle...@gmail.com
Epic fail. Some kind of keybinding is tripping me up when I try to write code within google groups :-(

Third time's a charm (I just pasted from an editor)

How would I do something like this

// in psuedo-code)
node {
   def jobA = build( job: 'buildA', parameters])

   // call job b, using some of the environment variables queried from previous job

    def jobB = build(job: 'buildA', [jobA.env['SOME_ENV_VARIABLE')
}


Thanks

Mikhail Vassiliev

unread,
Jan 14, 2015, 11:32:49 PM1/14/15
to jenkins...@googlegroups.com

I would try first just to build your jobA without any parameters. You do not need to use a node statement for this. It does not make sense. You also do not need to assign the build result to some variable unless you want to analyze it later. I think the build method does not return anything useful. Just make a call:

 

build(“jobA”)

 

It should initiate you jobA with default parameters. My guess the build method is asynchronous. It won’t wait until “jobA” is finished. You should implement your own method of waiting until jobA is completed if I am not mistaken.

 

Mikhail

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/5f55598f-8145-4aba-a85c-6e9d6ebfb6a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jesse Glick

unread,
Jan 15, 2015, 3:11:00 PM1/15/15
to jenkins...@googlegroups.com, dle...@gmail.com
On Wednesday, January 14, 2015 at 10:06:49 PM UTC-5, Doug Lethin wrote:
does the build step return an object as a reference

Reply all
Reply to author
Forward
0 new messages