Would there be a way to create a groovy variable named agentObject that
either contains the object {label "$agentLabel"} or the object any provided
by the pipeline namespace and use a syntax like: agent $agentObject?
On Monday, December 30, 2019 at 8:53:12 AM UTC-5, Mario Jauvin wrote:
>
> This seems to be the only way that I can get it working but it requires
>>> repeating the pipeline twice which in my case is a complicated one:
>>>
>>
> def call(String buildType, String agentLabel=null) {
> if ("versionBranch".equals(buildType)) {
> if (agentLabel==null) {
> pipeline {
> agent any
> ... rest of the pipeline
> }
> } else {
> pipeline {
> agent {label "${agentLabel}"}
> ... rest of the pipeline
> }
> }
> }
> }
>
> Is there another way?
>
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/8c9b5425-b386-492e-aa94-5197367b06b4%40googlegroups.com.