(I apologize in advance if I get terminology wrong; I'm not fully versed in the jenkins world yet.)
At Khan Academy, we're very excited by the potential of the workflow plugin to improve our deploy process. But I have a couple of questions that I didn't see addressed in the (excellent) tutorial <https://github.com/jenkinsci/workflow-plugin/blob/master/TUTORIAL.md>: 1) Is it possible to run an existing jenkins job from a workflow groovy script? I saw mention elsewhere <https://groups.google.com/forum/#!topic/jenkinsci-dev/ZsIk0P7c9EQ> of a 'build' step, but don't see it mentioned in the tutorial. 2) Is it possible to cancel a running task (either a jenkins job or an ad-hoc job created by a workflow node step) from within a workflow groovy script? Here is what we are trying to do: our deploy process currently builds deploy artifacts and runs tests at the same time. I see how we could implement that using workflow via the 'parallel' step. However, we also want the behavior that if and when build-artifacts fails, it immediately cancels the running tests and fails the deploy job; and likewise if the tests fail, it immediately cancels the building of artifacts and fails the deploy job. If both succeed, then the deploy job continues. Pseudocode in a unix-y environment would be something like this: ``` p1 = spawnJobAsync('build-artifacts") p2 = spawnJobAsync("run-tests") // poll() returns True when a process has finished. while (!p1.poll() || !p2.poll()) { if (p1.poll() && p1.wait() != SUCCESS) { p2.kill() return FAIL } if (p2.poll() && p2.wait() != SUCCESS) { p1.kill() return FAIL } sleep(1) // check once a second } // ... continue to deploy ... ``` Is such a thing possibly using the workflow plugin? If not, is something like this contemplated? -- in particular, the ability to start a job in the background and poll it periodically to see how it's doing. Thanks, craig -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/d9968549-ce7f-42c9-aa91-3ad097bc2e04%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
