Node info in Jenkins pipeline environment

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Node info in Jenkins pipeline environment

console2016
I'm write a jenkins plugin to get some infos of jobs,  i want to get the node info which the job running on.  now i have the code by extend RunListener,  the code works fine in free style project, but in pipeline, the EnvVars not contains NODE_NAME,  so it not works.

@Override
public void onCompleted(Run<?, ?> run, TaskListener listener) { 
  Node node = run.getExecutor().getOwner().getNode();
  String nodeName = node.getNodeName();
  EnvVars environment = run.getEnvironment(listener);
  if (nodeName.equals("") && environment.containsKey("NODE_NAME")) {
      nodeName = environment.get("NODE_NAME");
  }
}
But in the code workflow-durable-task-step-plugin ,  the NODE_NAME is put in the EnvVars. I don't know why this happened and is there any way  to get node info.  

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/c17fd3d7-86a6-4622-8f34-1a6c95feac05%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Node info in Jenkins pipeline environment

Ulli Hafner
In my plugin I’m simply using build.getExecutor().getOwner().getName(). Note that getOwner() might return null.

Am 14.06.2018 um 06:02 schrieb [hidden email]:

I'm write a jenkins plugin to get some infos of jobs,  i want to get the node info which the job running on.  now i have the code by extend RunListener,  the code works fine in free style project, but in pipeline, the EnvVars not contains NODE_NAME,  so it not works.

@Override
public void onCompleted(Run<?, ?> run, TaskListener listener) { 
  Node node = run.getExecutor().getOwner().getNode();
  String nodeName = node.getNodeName();
  EnvVars environment = run.getEnvironment(listener);
  if (nodeName.equals("") && environment.containsKey("NODE_NAME")) {
      nodeName = environment.get("NODE_NAME");
  }
}
But in the code workflow-durable-task-step-plugin ,  the NODE_NAME is put in the EnvVars. I don't know why this happened and is there any way  to get node info.  

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/c17fd3d7-86a6-4622-8f34-1a6c95feac05%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/A66EA91B-D9BE-47B0-9EB5-02CB1F207059%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

signature.asc (540 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Node info in Jenkins pipeline environment

console2016
Thanks, but it can not get node info in pipeline.

在 2018年6月14日星期四 UTC+8下午3:39:20,Ullrich Hafner写道:
In my plugin I’m simply using build.getExecutor().getOwner().getName(). Note that getOwner() might return null.

Am 14.06.2018 um 06:02 schrieb <a href="javascript:" target="_blank" gdf-obfuscated-mailto="380dcscqBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">conso...@...:

I'm write a jenkins plugin to get some infos of jobs,  i want to get the node info which the job running on.  now i have the code by extend RunListener,  the code works fine in free style project, but in pipeline, the EnvVars not contains NODE_NAME,  so it not works.

@Override
public void onCompleted(Run<?, ?> run, TaskListener listener) { 
  Node node = run.getExecutor().getOwner().getNode();
  String nodeName = node.getNodeName();
  EnvVars environment = run.getEnvironment(listener);
  if (nodeName.equals("") && environment.containsKey("NODE_NAME")) {
      nodeName = environment.get("NODE_NAME");
  }
}
But in the code <a href="https://github.com/jenkinsci/workflow-durable-task-step-plugin" style="color:rgb(17,85,204)" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fworkflow-durable-task-step-plugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEL6Srm0xTvGVWC2oRnWQTdKrG8yA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fworkflow-durable-task-step-plugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEL6Srm0xTvGVWC2oRnWQTdKrG8yA&#39;;return true;">workflow-durable-task-step-plugin ,  the NODE_NAME is put in the EnvVars. I don't know why this happened and is there any way  to get node info.  

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="380dcscqBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-dev/c17fd3d7-86a6-4622-8f34-1a6c95feac05%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-dev/c17fd3d7-86a6-4622-8f34-1a6c95feac05%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-dev/c17fd3d7-86a6-4622-8f34-1a6c95feac05%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-dev/c17fd3d7-86a6-4622-8f34-1a6c95feac05%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.


在 2018年6月14日星期四 UTC+8下午3:39:20,Ullrich Hafner写道:
In my plugin I’m simply using build.getExecutor().getOwner().getName(). Note that getOwner() might return null.

Am 14.06.2018 um 06:02 schrieb <a href="javascript:" target="_blank" gdf-obfuscated-mailto="380dcscqBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">conso...@...:

I'm write a jenkins plugin to get some infos of jobs,  i want to get the node info which the job running on.  now i have the code by extend RunListener,  the code works fine in free style project, but in pipeline, the EnvVars not contains NODE_NAME,  so it not works.

@Override
public void onCompleted(Run<?, ?> run, TaskListener listener) { 
  Node node = run.getExecutor().getOwner().getNode();
  String nodeName = node.getNodeName();
  EnvVars environment = run.getEnvironment(listener);
  if (nodeName.equals("") && environment.containsKey("NODE_NAME")) {
      nodeName = environment.get("NODE_NAME");
  }
}
But in the code <a href="https://github.com/jenkinsci/workflow-durable-task-step-plugin" style="color:rgb(17,85,204)" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fworkflow-durable-task-step-plugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEL6Srm0xTvGVWC2oRnWQTdKrG8yA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fworkflow-durable-task-step-plugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEL6Srm0xTvGVWC2oRnWQTdKrG8yA&#39;;return true;">workflow-durable-task-step-plugin ,  the NODE_NAME is put in the EnvVars. I don't know why this happened and is there any way  to get node info.  

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="380dcscqBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-dev/c17fd3d7-86a6-4622-8f34-1a6c95feac05%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-dev/c17fd3d7-86a6-4622-8f34-1a6c95feac05%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-dev/c17fd3d7-86a6-4622-8f34-1a6c95feac05%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-dev/c17fd3d7-86a6-4622-8f34-1a6c95feac05%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.


在 2018年6月14日星期四 UTC+8下午3:39:20,Ullrich Hafner写道:
In my plugin I’m simply using build.getExecutor().getOwner().getName(). Note that getOwner() might return null.

Am 14.06.2018 um 06:02 schrieb <a href="javascript:" target="_blank" gdf-obfuscated-mailto="380dcscqBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">conso...@...:

I'm write a jenkins plugin to get some infos of jobs,  i want to get the node info which the job running on.  now i have the code by extend RunListener,  the code works fine in free style project, but in pipeline, the EnvVars not contains NODE_NAME,  so it not works.

@Override
public void onCompleted(Run<?, ?> run, TaskListener listener) { 
  Node node = run.getExecutor().getOwner().getNode();
  String nodeName = node.getNodeName();
  EnvVars environment = run.getEnvironment(listener);
  if (nodeName.equals("") && environment.containsKey("NODE_NAME")) {
      nodeName = environment.get("NODE_NAME");
  }
}
But in the code <a href="https://github.com/jenkinsci/workflow-durable-task-step-plugin" style="color:rgb(17,85,204)" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fworkflow-durable-task-step-plugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEL6Srm0xTvGVWC2oRnWQTdKrG8yA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fworkflow-durable-task-step-plugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEL6Srm0xTvGVWC2oRnWQTdKrG8yA&#39;;return true;">workflow-durable-task-step-plugin ,  the NODE_NAME is put in the EnvVars. I don't know why this happened and is there any way  to get node info.  

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="380dcscqBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-dev/c17fd3d7-86a6-4622-8f34-1a6c95feac05%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-dev/c17fd3d7-86a6-4622-8f34-1a6c95feac05%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-dev/c17fd3d7-86a6-4622-8f34-1a6c95feac05%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-dev/c17fd3d7-86a6-4622-8f34-1a6c95feac05%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.


在 2018年6月14日星期四 UTC+8下午3:39:20,Ullrich Hafner写道:
In my plugin I’m simply using build.getExecutor().getOwner().getName(). Note that getOwner() might return null.

Am 14.06.2018 um 06:02 schrieb <a href="javascript:" target="_blank" gdf-obfuscated-mailto="380dcscqBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">conso...@...:

I'm write a jenkins plugin to get some infos of jobs,  i want to get the node info which the job running on.  now i have the code by extend RunListener,  the code works fine in free style project, but in pipeline, the EnvVars not contains NODE_NAME,  so it not works.

@Override
public void onCompleted(Run<?, ?> run, TaskListener listener) { 
  Node node = run.getExecutor().getOwner().getNode();
  String nodeName = node.getNodeName();
  EnvVars environment = run.getEnvironment(listener);
  if (nodeName.equals("") && environment.containsKey("NODE_NAME")) {
      nodeName = environment.get("NODE_NAME");
  }
}
But in the code <a href="https://github.com/jenkinsci/workflow-durable-task-step-plugin" style="color:rgb(17,85,204)" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fworkflow-durable-task-step-plugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEL6Srm0xTvGVWC2oRnWQTdKrG8yA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fworkflow-durable-task-step-plugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEL6Srm0xTvGVWC2oRnWQTdKrG8yA&#39;;return true;">workflow-durable-task-step-plugin ,  the NODE_NAME is put in the EnvVars. I don't know why this happened and is there any way  to get node info.  

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="380dcscqBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-dev/c17fd3d7-86a6-4622-8f34-1a6c95feac05%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-dev/c17fd3d7-86a6-4622-8f34-1a6c95feac05%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-dev/c17fd3d7-86a6-4622-8f34-1a6c95feac05%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-dev/c17fd3d7-86a6-4622-8f34-1a6c95feac05%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.


在 2018年6月14日星期四 UTC+8下午3:39:20,Ullrich Hafner写道:
In my plugin I’m simply using build.getExecutor().getOwner().getName(). Note that getOwner() might return null.

Am 14.06.2018 um 06:02 schrieb <a href="javascript:" target="_blank" gdf-obfuscated-mailto="380dcscqBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">conso...@...:

I'm write a jenkins plugin to get some infos of jobs,  i want to get the node info which the job running on.  now i have the code by extend RunListener,  the code works fine in free style project, but in pipeline, the EnvVars not contains NODE_NAME,  so it not works.

@Override
public void onCompleted(Run<?, ?> run, TaskListener listener) { 
  Node node = run.getExecutor().getOwner().getNode();
  String nodeName = node.getNodeName();
  EnvVars environment = run.getEnvironment(listener);
  if (nodeName.equals("") && environment.containsKey("NODE_NAME")) {
      nodeName = environment.get("NODE_NAME");
  }
}
But in the code <a href="https://github.com/jenkinsci/workflow-durable-task-step-plugin" style="color:rgb(17,85,204)" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fworkflow-durable-task-step-plugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEL6Srm0xTvGVWC2oRnWQTdKrG8yA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fworkflow-durable-task-step-plugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEL6Srm0xTvGVWC2oRnWQTdKrG8yA&#39;;return true;">workflow-durable-task-step-plugin ,  the NODE_NAME is put in the EnvVars. I don't know why this happened and is there any way  to get node info.  

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="380dcscqBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-dev/c17fd3d7-86a6-4622-8f34-1a6c95feac05%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-dev/c17fd3d7-86a6-4622-8f34-1a6c95feac05%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-dev/c17fd3d7-86a6-4622-8f34-1a6c95feac05%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-dev/c17fd3d7-86a6-4622-8f34-1a6c95feac05%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/8e2871c8-dcf8-4da4-8baf-575365998421%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Node info in Jenkins pipeline environment

Markus Winter
In reply to this post by console2016

In pipeline, the information is added to ENV_VARS only for the time that the pipeline really is using an executor on a node. So you will not be able to collect this information in the onCompleted method of a RunListener. Also consider that a pipeline can run on multiple nodes.

You might consider implementing an ExecutorListener.



On 14.06.2018 06:02, [hidden email] wrote:
I'm write a jenkins plugin to get some infos of jobs,  i want to get the node info which the job running on.  now i have the code by extend RunListener,  the code works fine in free style project, but in pipeline, the EnvVars not contains NODE_NAME,  so it not works.

@Override
public void onCompleted(Run<?, ?> run, TaskListener listener) { 
  Node node = run.getExecutor().getOwner().getNode();
  String nodeName = node.getNodeName();
  EnvVars environment = run.getEnvironment(listener);
  if (nodeName.equals("") && environment.containsKey("NODE_NAME")) {
      nodeName = environment.get("NODE_NAME");
  }
}
But in the code workflow-durable-task-step-plugin ,  the NODE_NAME is put in the EnvVars. I don't know why this happened and is there any way  to get node info.  
--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/c17fd3d7-86a6-4622-8f34-1a6c95feac05%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/97657019-e2b5-7cb3-36a7-a6cc1b14803e%40gmx.de.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Node info in Jenkins pipeline environment

Jesse Glick-4
On Thu, Jun 14, 2018 at 10:58 AM, Markus Winter <[hidden email]> wrote:
> In pipeline, the information is added to ENV_VARS only for the time that the
> pipeline really is using an executor on a node. So you will not be able to
> collect this information in the onCompleted method of a RunListener. Also
> consider that a pipeline can run on multiple nodes.

Right, the problem statement does not even make sense. What you _can_
collect is a possibly empty set of nodes a build used.

> You might consider implementing an ExecutorListener.

You can use `RunListener`, just get the `FlowNode` graph and look for
those nodes with a `WorkspaceAction` attached.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr3M5E1Uw7N5Boq_B1-0mHcAR0E0BZMUCKw7zpp_%2B1n4ng%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Node info in Jenkins pipeline environment

console2016
ok, thanks for your reply

Jesse Glick <[hidden email]> 于2018年6月16日周六 上午4:01写道:
On Thu, Jun 14, 2018 at 10:58 AM, Markus Winter <[hidden email]> wrote:
> In pipeline, the information is added to ENV_VARS only for the time that the
> pipeline really is using an executor on a node. So you will not be able to
> collect this information in the onCompleted method of a RunListener. Also
> consider that a pipeline can run on multiple nodes.

Right, the problem statement does not even make sense. What you _can_
collect is a possibly empty set of nodes a build used.

> You might consider implementing an ExecutorListener.

You can use `RunListener`, just get the `FlowNode` graph and look for
those nodes with a `WorkspaceAction` attached.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr3M5E1Uw7N5Boq_B1-0mHcAR0E0BZMUCKw7zpp_%2B1n4ng%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CABokNCJgD9CtHKBYdA0j0Ca6LJ-ib0qR9Z3YxZF20voPsW4imA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.