Alois Mahdal
Alois Mahdal

Reputation: 11243

Running same job in different MultiJob phases

What I want to do

Well, if it was a bash script, it would be something like this:

# run "foo" test
prepare_test_machine --profile=foo
run_test
# run "bar" test
prepare_test_machine --profile=bar
run_test
# run "baz" test
prepare_test_machine --profile=baz
run_test

I don't need no parallelization, since all tests actually run on the very same box.

What have I tried

I created two jobs, one for prepare_test_machine and one for run_test. prepare_test_machine accepts just one parameter, and run_test does not accept any--it can simply assume that the preceding job has set everything up.

Next I set up a MultiJob, that calls each step as a MultiJob phase, passing parameters only where necessary.

What is wrong?

While it does seem to do the work I need it behaves in a completely confusing way: After I start the MultiJob:

  1. all prepare jobs sart to "blink",

  2. after they finish, all report the same result and duration in the MJ view,

  3. then all run jobs sart to "blink",

  4. and behave the same as the prepare jobs,

  5. which repeats for each pair, results of each run being written to all similar runs, instead of just the single phase in the MJ view.

So for example, if "baz" takes 97s and 8s respectively, "bar" takes 87s and 11s, and "baz" takes 111s and 25s I'd expect to see something like this ("#" mark the phase labels):

+-----------------------------------+
| # prepare foo                     |
| O   prepare_test_machine     97s  |
| # run foo                         |
| O   run_test                 8s   |
| # prepare bar                     |
| O   prepare_test_machine     87s  |
| # run bar                         |
| O   run_test                 11s  |
| # prepare baz                     |
| O   prepare_test_machine     111s |
| # run baz                         |
| O   run_test                 25s  |
+-----------------------------------+

but instead see:

+-----------------------------------+
| # prepare foo                     |
| O   prepare_test_machine     111s |
| # run foo                         |
| O   run_test                 25s  |
| # prepare bar                     |
| O   prepare_test_machine     111s |
| # run bar                         |
| O   run_test                 25s  |
| # prepare baz                     |
| O   prepare_test_machine     111s |
| # run baz                         |
| O   run_test                 25s  |
+-----------------------------------+

Questions

Can this setup be tweaked so that it behaves the way I want? Or I'm just using wrong tool for the job? (I'm new to Jenkins, so I wouldn't be surprised). If so, could anyone point me to the right direction?

(If it's possible, I'd like to keep the layout flat, i.e. avoid messy sub-projects or "run-after" triggers.)

Upvotes: 1

Views: 390

Answers (1)

Sascha Vetter
Sascha Vetter

Reputation: 2506

This issue is documented (Future obj not observed when same job executed parallel) and I provided a bug-fix, unfortunately the fix isn't part of the latest version.

Upvotes: 1

Related Questions