Flow DSL: non-blocking build trigger

21 views
Skip to first unread message

Barry Laffoy

unread,
Jan 22, 2016, 3:19:33 AM1/22/16
to Jenkins Users
Is it possible to trigger a build of a job from a Build Flow job whose execution does not block the execution of the calling job?

If that's not clear, say I have three Jenkins jobs: flow-job, short-job, long-job. "flow-job" is used to trigger a build of both "short-job" and "long-job". However, as implied by their names, one job normally takes much longer than the other. Using the build() function in the build flow DSL, flow-job won't exit until both short-job and long-job have completed. However, I would like for both the short and long job to be triggered by the flow DSL, but for flow-job to only wait for short-job to complete: long-job should be allowed continue operation after flow-job has completed.

Is there any functionality in the flow DSL that would allow this? I've put together a system by which groovy will execute a curl command to trigger the long running job:

        def vars = "FOO=BAR&BAZ=QUX";
       
def trigger_url = "http://localhost:8080/job/long-job/buildWithParameters?${vars}";
       
def cmd = "curl -o trigger.log ${trigger_url}";
       
out.println(cmd);
       
def proc = cmd.execute();
        proc
.waitFor();

and trigger the short running job normally with build("short-job").

This feels a bit messy to me. Is there any native way within the DSL to achieve this?
Reply all
Reply to author
Forward
0 new messages