How to configure jenkins multi-configuration build

2019-02-21 21:28发布

问题:

I need to build and test on multiple configurations: linux, osx and solaris. I have slave nodes labeled "linux", "osx" and "solaris". On each configuration, I want to (a) build (b) run smoke tests (c) if smoke tests pass, then run full tests, and perhaps more.

I thought that multi-configuration jobs might be the answer, so I setup a multi-configuration build job and it starts concurrent builds on each OS. The build job will trigger a downstream smoke-test build, which, in turn, triggers the full-test job.

I've run into the following issues

  1. If one of the configurations fails, the job as a whole fails, and Jenkins will not fire any downstream jobs (e.g., if the solaris build fails, Jenkins will not run smoke tests or full tests for osx and linux).

  2. The solaris build takes about twice as long as the others (on the order of an hour), and I'd prefer the linux and osx smoke tests not wait for the solaris build to finish.

Does that mean I'm left with hand-crafting three pipelines of jobs, and putting them behind a "start-all" job (i.e., creating and hand-chaining the following jobs)?

build-linux   smoke-test-linux   full-test-linux
build-osx     smoke-test-osx     full-test-osx
build-solaris smoke-test-solaris full-test-solaris

Did I miss something obvious?

回答1:

As far as I know the answer is to create 3 matrix jobs, one for each system. They then would have 3 subjobs (build, smoke-test, fulltest) with the build-job as a touchstone.



回答2:

Have you thought about combining the build, smoke-test and full tests into a single multi-configuration job? Other than being a little messy, this should work for you.

To answer your first issue: to trigger a downstream job regardless of result, use trigger parameterized build to run when complete (always trigger) and then check "build w/o parameters"

To answer your second issue: either use an all encompassing multi-configuration (matrix) job or use three separate job streams as you mentioned. UPDATE: you could run 3 sequential matrix jobs for each step (build, smoke-test, full tests) but it would mean that if any of the build steps failed then none of the smoke-tests would be run.