/hudson-war/src/main/webapp/help/matrix/combinationfilter.html

http://github.com/hudson/hudson · HTML · 57 lines · 51 code · 6 blank · 0 comment · 0 complexity · 09b967b9bf9b408d7a854ae8d56d90cf MD5 · raw file

  1. <div>
  2. By default, Hudson builds all the possible combinations of axes exhaustively. But sometimes this is too many,
  3. or may contain combinations that don't make sense.
  4. In such a situation, you can make the matrix sparse by filtering out combinations that you don't want through
  5. a Groovy expression that returns true or false.
  6. <p>
  7. When you specify a Groovy expression here, only the combinations that result in <b>true</b>
  8. will be built. In evaluating the expression, axes are exposed as variables (with their values set
  9. to the current combination evaluated).
  10. <h4>Filtering based on values</h4>
  11. <p>
  12. For example, let's say you are building on different operating systems for
  13. different compilers. Assume that your slave labels are <b>label=[linux,solaris]</b> and you have
  14. created an axis as <b>compiler=[gcc,cc].</b>
  15. Any of the following expressions will filter out <b>cc</b> builds on <b>linux</b>. Depending on
  16. how you think about this constraint, you'll probably find some more intuitive than others.
  17. <center>
  18. <table>
  19. <tr>
  20. <td>Read "if both linux and cc, it's invalid"</td>
  21. <td>
  22. <pre>!(label=="linux" && compiler=="cc")</pre>
  23. </td>
  24. </tr>
  25. <tr>
  26. <td>Read "for a combination to be valid, it has to be either on solaris or on gcc."</td>
  27. <td>
  28. <pre>label=="solaris" || compiler=="gcc"</pre>
  29. </td>
  30. </tr>
  31. <tr>
  32. <td>Read "if on Solaris, just do cc"</td>
  33. <td>
  34. <pre>(label=="solaris").implies(compiler=="cc")</pre>
  35. </td>
  36. </tr>
  37. </table>
  38. </center>
  39. <h4>Sparsening of the matrix</h4>
  40. <p>
  41. In addition to the specific filtering rules based on values, one can also use a special
  42. variable "<tt>index</tt>", which can be used to sparsen the matrix.
  43. <p>
  44. For example, <tt>index%2==0</tt> would cut the matrix size in half by removing one
  45. combination per every 2 combinations, in such a way that the coverage is still reasonable.
  46. Similarly, <tt>index%3!=0</tt> would cut the matrix size into 66% by throwing
  47. away every 1 out of 3 combinations.
  48. <p>
  49. It's possible to use Project cascading feature for this property. Please review <a href="http://wiki.hudson-ci.org/display/HUDSON/Project+cascading">
  50. this document</a>.
  51. </div>