KitKarson
KitKarson

Reputation: 5637

Jenkinsfile - agent matching multiple labels

In my declarative pipeline, i need to select a node matching 2 labels. I tried something like this

agent { label 'label1 && label2'}

But i get an error that there are no nodes. I have a node with 2 labels label1 and label2 associated.

Started by user admin
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] node
Still waiting to schedule task
There are no nodes with the label ‘label1&&label2’

I know that i could temportailiy fix this by creating a 3rd label label1-2 and associate it with agent in the pipeline.

Is there any proper way to fix this?

Upvotes: 1

Views: 5695

Answers (1)

KitKarson
KitKarson

Reputation: 5637

Ok..figured it out.

agent {label "label1" && "label2"}

Upvotes: 7

Related Questions