Using environment parameters in the combination Filter for multi-configuration project in Jenkins

1.1k views Asked by At

Any idea how to use parameters from the job's environment in the Combination Filter for multi-configuration job?

I've tried : index%3 == 0 and it's working properly, but I want to replace (3) with ${EXECUTOR_NUMBER} to make the runs more dynamic.

When using EXECUTOR_NUMBER I'm getting:

javax.servlet.ServletException: org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method groovy.lang.GroovyObject invokeMethod java.lang.String java.lang.Object (Script1 $ Script1$_run_closure1)

Tried looking online but couldn't find any good examples - would appreciate the help

1

There are 1 answers

1
KeepCalmAndCarryOn On

You can try Matrix Groovy Execution Strategy which gives you a more powerful way to specify which combinations to run.

println '---------parameters--------'
parameters.each{ k,v ->
    println "${k}-->${v}"
}
println '-------------env--------------'
env.each{ k,v ->
    println "${k}-->${v}"
}
println '--------------------------------'

will display stuff you can use.

The combinations are passed in and it expects a tree map out of the combinations to run.

Disclosure: I created the plugin