Jenkins How to find if a given slave is running a Job

前端 未结 3 823
盖世英雄少女心
盖世英雄少女心 2021-01-05 08:21

I have this unique requirement to check if the given node is running a job or not. I am thinking of using groovy as it looks easiest option.

I have found this answer

3条回答
  •  再見小時候
    2021-01-05 08:52

    To get the name of the node, that is running the current build, just use System.getenv("NODE_NAME")

    When a Jenkins job executes, it sets some environment variables..

    You may find these variables very useful. Check this link

提交回复
热议问题