Leon
Leon

Reputation: 255

Find out in which Slave the Jenkins Pipeline is running

I am starting my Pipeline this way:

node('my_Label') { // my code }

I want to know in which Slave my code is running. I tried multiple things but I was not able to find out the correct method to call for that :(

Upvotes: 7

Views: 3560

Answers (1)

Peter McNab
Peter McNab

Reputation: 1101

The environment variable ${NODE_NAME} should have it:

node ('my_Label) {
   println "${NODE_NAME}"
}

Upvotes: 10

Related Questions