Browse Source

Include the node name

Change-Id: I1cf2aee446c1e51c8eb15f7d84c3e828f3716cce
James E. Blair 5 years ago
parent
commit
36ca349ad1

+ 10
- 0
src/main/java/org/jenkinsci/plugins/ZMQEventPublisher/Phase.java View File

@@ -23,6 +23,8 @@ import hudson.model.Job;
23 23
 import hudson.model.ParameterValue;
24 24
 import hudson.model.ParametersAction;
25 25
 import hudson.model.Run;
26
+import hudson.model.Executor;
27
+import hudson.model.Computer;
26 28
 import hudson.model.TaskListener;
27 29
 
28 30
 import java.io.IOException;
@@ -71,6 +73,14 @@ public enum Phase {
71 73
             buildState.setFullUrl(rootUrl + run.getUrl());
72 74
         }
73 75
 
76
+        Executor executor = run.getExecutor();
77
+        if (executor != null) {
78
+            Computer computer = executor.getOwner();
79
+            if (computer != null) {
80
+                buildState.setNodeName(computer.getName());
81
+            }
82
+        }
83
+
74 84
         jobState.setBuild(buildState);
75 85
 
76 86
         ParametersAction paramsAction = run.getAction(ParametersAction.class);

+ 10
- 0
src/main/java/org/jenkinsci/plugins/ZMQEventPublisher/model/BuildState.java View File

@@ -34,6 +34,8 @@ public class BuildState {
34 34
 
35 35
     private Map<String, String> parameters;
36 36
 
37
+    private String nodeName;
38
+
37 39
     public int getNumber() {
38 40
         return number;
39 41
     }
@@ -81,4 +83,12 @@ public class BuildState {
81 83
     public void setParameters(Map<String, String> params) {
82 84
         this.parameters = params;
83 85
     }
86
+
87
+    public String getNodeName() {
88
+        return nodeName;
89
+    }
90
+
91
+    public void setNodeName(String nodeName) {
92
+        this.nodeName = nodeName;
93
+    }
84 94
 }

Loading…
Cancel
Save