Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-2813

Ability to select which combination to build in matrix projects

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Major Major
    • matrix-project-plugin
    • None
    • Platform: All, OS: All

      I have set up Hudson to take builds of C++ projects. I have to build my projects
      in different OS and compiler combinations. Matrix project seems like a good
      solution, but I need to be able to select which combinations will actually be
      built instead of an exhaustive build of all combinations.

      A matrix table with checkboxes in each cell may be a solution.

      I will try to write down my scenario here. If there's another way to solve this
      with current matrix project settings, I would be glad to hear it.

      I set up my Slave Label's like this:

      Windows Slave - Labels: Windows
      Fedora10 Slave - Labels: Fedora10
      Solaris Slave - Labels: Solaris

      Now what I want to do is, build for both CC (SunStudio) and GCC compilers in
      Solaris, but only Solaris labels.

          [JENKINS-2813] Ability to select which combination to build in matrix projects

          ertanden added a comment -

          Any suggestion on this? I think it's a very important feature.

          If you think it's easy to implement, please at least guide me through the code.
          I would be glad to help.

          ertanden added a comment - Any suggestion on this? I think it's a very important feature. If you think it's easy to implement, please at least guide me through the code. I would be glad to help.

          Agreed. I've been thinking it would be nice to support a boolean expression to
          control which combination gets run. I'm bit worried about a matrix full of
          checkboxes, because it's tedious.

          Assuming we only build those configurations where the expression returns true,
          in your case we'd say something like "CC==SunStudio -> label==Solaris" or
          "label!=Solaris -> CC!=SunStudio" or "label==Solaris || CC==GCC" (it's a matter
          of taste which one feels more natural)

          It's also great to hear that you are interested in giving this a shot. In terms
          of implementation strategy:

          1. Hudson already bundles Groovy, so I think you can just evaluate the
          expression as Groovy script as a starter. This has a security problem, however,
          as Groovy script can run arbitrary code, which is not desirable.

          The rest should be fairly straight-forward, I think.

          Kohsuke Kawaguchi added a comment - Agreed. I've been thinking it would be nice to support a boolean expression to control which combination gets run. I'm bit worried about a matrix full of checkboxes, because it's tedious. Assuming we only build those configurations where the expression returns true, in your case we'd say something like "CC==SunStudio -> label==Solaris" or "label!=Solaris -> CC!=SunStudio" or "label==Solaris || CC==GCC" (it's a matter of taste which one feels more natural) It's also great to hear that you are interested in giving this a shot. In terms of implementation strategy: 1. Hudson already bundles Groovy, so I think you can just evaluate the expression as Groovy script as a starter. This has a security problem, however, as Groovy script can run arbitrary code, which is not desirable. The rest should be fairly straight-forward, I think.

          ertanden added a comment -

          Created an attachment (id=526)
          Feature that adds filtering capability to matrix projects

          ertanden added a comment - Created an attachment (id=526) Feature that adds filtering capability to matrix projects

          ertanden added a comment -

          Created an attachment (id=527)
          Documentation of the feature that adds filtering capability to matrix projects

          ertanden added a comment - Created an attachment (id=527) Documentation of the feature that adds filtering capability to matrix projects

          ertanden added a comment -

          I implemented this feature. I am not a Java developer, so can you please review it?

          I tested it on my computer, and it works as expected. But I am not exactly sure
          if the evalGroovyExpression method I added is the way it should be.

          ertanden added a comment - I implemented this feature. I am not a Java developer, so can you please review it? I tested it on my computer, and it works as expected. But I am not exactly sure if the evalGroovyExpression method I added is the way it should be.

          Thanks for the patch!

          I just started looking.

          Kohsuke Kawaguchi added a comment - Thanks for the patch! I just started looking.

          Code changed in hudson
          User: : kohsuke
          Path:
          trunk/hudson/main/core/src/main/java/hudson/matrix/Combination.java
          trunk/hudson/main/core/src/main/java/hudson/matrix/MatrixProject.java
          trunk/hudson/main/core/src/main/resources/hudson/matrix/MatrixProject/configure-entries.jelly
          trunk/hudson/main/core/src/main/resources/hudson/matrix/MatrixProject/configure-entries_tr.properties
          trunk/hudson/main/core/src/test/java/hudson/matrix/CombinationTest.java
          trunk/hudson/main/war/resources/help/matrix/combinationfilter.html
          http://fisheye4.cenqua.com/changelog/hudson/?cs=14777
          Log:
          [FIXED JENKINS-2813] Applied a change with a bit of modifications. This will be 1.279

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : kohsuke Path: trunk/hudson/main/core/src/main/java/hudson/matrix/Combination.java trunk/hudson/main/core/src/main/java/hudson/matrix/MatrixProject.java trunk/hudson/main/core/src/main/resources/hudson/matrix/MatrixProject/configure-entries.jelly trunk/hudson/main/core/src/main/resources/hudson/matrix/MatrixProject/configure-entries_tr.properties trunk/hudson/main/core/src/test/java/hudson/matrix/CombinationTest.java trunk/hudson/main/war/resources/help/matrix/combinationfilter.html http://fisheye4.cenqua.com/changelog/hudson/?cs=14777 Log: [FIXED JENKINS-2813] Applied a change with a bit of modifications. This will be 1.279

            Unassigned Unassigned
            ertanden ertanden
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: