Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins matrix project combination filter - how to configure the groovy expression?

Tags:

jenkins

groovy

I have a Jenkins multi configuration project with two axis:

  1. sbBrowser with values:

    firefox
    ie
    chrome
    
  2. envConfig with values:

    pp1
    pp2
    pp3
    staging
    systemtest
    

I have to create combination filter to run only with sbBrowser = firefox on all of the envConfig.

How to build the expression?

Something like:

sbBrowser=="firefox" && envConfig=="pp1" "pp2" "pp3" "staging" "systemtest"
like image 682
Atanas Kanchev Avatar asked Apr 26 '13 08:04

Atanas Kanchev


3 Answers

Ok, the following expression is working as a charm:

(sbBrowser=="firefox")  && (envConfig=="pp1") ||(sbBrowser=="firefox")  && (envConfig=="pp2")||(sbBrowser=="firefox")  && (envConfig=="pp3")||(sbBrowser=="firefox")  && (envConfig=="staging")||(sbBrowser=="firefox")  && (envConfig=="systemtest")
like image 179
Atanas Kanchev Avatar answered Oct 18 '22 01:10

Atanas Kanchev


If you want it to run only for firefox, on all values of envConfig, then why specify members of the envConfig set? Just do (sbBrowser=="firefox") and it will run only on Firefox, for all members of envConfig.

like image 43
chrisvarnz Avatar answered Oct 18 '22 00:10

chrisvarnz


you can do it this way either-

(sbBrowser=="firefox") && ["pp1","pp2","pp3","staging","systemtest"].contains(envConfig)
like image 1
Shubh Avatar answered Oct 18 '22 00:10

Shubh