Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins and multi-configuration (matrix) jobs

Why are there two kinds of jobs for Jenkins, both the multi-configuration project and the free-style project project? I read somewhere that once you choose one of them, you can't convert to the other (easily). Why wouldn't I always pick the multi-configuration project in order to be safe for future changes?

I would like to setup a build for a project building both on Windows and Unix (and other platforms as well). I found this question), which asks the same thing, but I don't really get the answer. Why would I need three matrix projects (and not three free-style projects), one for each platform? Why can't I keep them all in one matrix, with platforms AND (for example) gcc version on one axis and (my) software versions on the other?

I also read this blog post, but that builds everything on the same machine, with just different Python versions.

So, in short: how do most people configure a multi-configuration project targeting many different platforms?

like image 549
joscarsson Avatar asked Sep 22 '11 13:09

joscarsson


People also ask

Which task is involved when configuring multi-configuration jobs in Jenkins?

Jenkins provides multi-configuration project. With this option we can create only one job with many configurations. Each configuration will be executed as a separate job. This is exactly what we need to simplify our scheduled tests, which can be used in conjunction with TestComplete or TestExecute.

What is configuration matrix in Jenkins?

The Configuration Matrix allows you to specify what steps to duplicate, and create a multiple-axis graph of the type of builds to create. For example, let us say that we have a build that we want to create for several different targets alpha, beta, and we want to produce both debug and release outputs.

What is multiJob project in Jenkins?

multiJob(String name) Creates or updates a multi-job project, suitable for running other jobs. Requires Multijob v1.22+ Since 1.31. multiJob(String name) {} Creates or updates a multi-job project, suitable for running other jobs.


2 Answers

The two types of jobs have separate functions:

  • Free-style jobs: these allow you to build your project on a single computer or label (group of computers, for eg "Windows-XP-32").
  • Multi-configuration jobs: these allow you to build your project on multiple computers or labels, or a mix of the two, for eg Windows-XP, Windows-Vista, Windows-7 and RedHat - useful for checking compatibility or building for multiple platforms (qt programs?)

If you have a project which you want to build on Windows & Unix, you have two options:

  • Create a separate free-style job for each configuration, in which case you have to maintain each one individually
  • You have one multi-configuration job, and you select 2 (or more) labels/computers/slaves - 1 for Windows and 1 for Unix. In this case, you only have to maintain one job for the build

You can keep the your gcc versions on one axis, and software versions on another. There is no reason you should not be able to.

The question that you link has a fair point, but one that does not relate to your question directly: in his case, he had a multi-configuration job A, which - on success - triggered another job B. Now, in a multi-configuration job, if one of the configuration fails, the entire job fails (obviously, since you want your project to build successfully on all your configurations).

IMHO, for building the same project on multiple platforms, the better way to go is to use a multi-configuration style job.

like image 69
Sagar Avatar answered Sep 19 '22 10:09

Sagar


Another option is to use a python build step to check the current OS and then call an appropriate setup or build script. In the python script, you can save the updated environment to a file and inject the environment again using the EnvInject plugin for subsequent build steps. Depending on the size of your build environment, you could also use a multi-platform build tool like SCons.

like image 27
Michael Avatar answered Sep 23 '22 10:09

Michael