From 8de3305aa38ba00e9ab3c811234597f5a963bf32 Mon Sep 17 00:00:00 2001 From: Timothy Chavez Date: Thu, 20 Aug 2015 00:14:19 -0500 Subject: [PATCH] Send node label with data status packet Zuul can use this information to organize its build data by node type. This will give us more granular insights into load and capacity. Change-Id: Ibca938fcf8a65facd7e39dab4eb994dfc637722a --- .../java/hudson/plugins/gearman/StartJobWorker.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/hudson/plugins/gearman/StartJobWorker.java b/src/main/java/hudson/plugins/gearman/StartJobWorker.java index ecc0f0b..c232310 100644 --- a/src/main/java/hudson/plugins/gearman/StartJobWorker.java +++ b/src/main/java/hudson/plugins/gearman/StartJobWorker.java @@ -99,6 +99,17 @@ public class StartJobWorker extends AbstractGearmanFunction { if (result != null) { data.put("result", result.toString()); } + + ArrayList nodeLabels = new ArrayList(); + Node node = build.getBuiltOn(); + if ( node != null ) { + Set nodeLabelAtoms = node.getAssignedLabels(); + for (LabelAtom labelAtom : nodeLabelAtoms) { + nodeLabels.add(labelAtom.getDisplayName()); + } + } + data.put("node_labels", nodeLabels); + Gson gson = new Gson(); return gson.toJson(data); }