Skip to content

Commit

Permalink
Merge pull request #1 from lrobertson39/patch-1
Browse files Browse the repository at this point in the history
JENKINS-22422 - Add node to build cause
  • Loading branch information
ejpenney committed Sep 6, 2016
2 parents b5e9f07 + 922349e commit ce8a473
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Expand Up @@ -76,7 +76,7 @@ private void processAndScheduleIfNeeded(TopLevelItem item, Computer c, TaskListe
HudsonStartupService startupService = new HudsonStartupService();
if (startupService.has2Schedule(startupTrigger, node)) {
listener.getLogger().print("[StartupTrigger] - Scheduling " + project.getName());
project.scheduleBuild(startupTrigger.getQuietPeriod(), new HudsonStartupCause());
project.scheduleBuild(startupTrigger.getQuietPeriod(), new HudsonStartupCause(node));
}
}

Expand Down
Expand Up @@ -23,11 +23,18 @@
package org.jvnet.hudson.plugins.triggers.startup;

import hudson.model.Cause;
import hudson.model.Node;

public class HudsonStartupCause extends Cause {

private Node node;

public HudsonStartupCause(Node node) {
this.node = node;
}

@Override
public String getShortDescription() {
return "Started due to the start of a node.";
return "Started due to the start of the node " + node.getDisplayName();
}
}

1 comment on commit ce8a473

@heaseny
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can currentBuild.getBuildCauses() get this cause in jenkins workflow? If not, is there method to get the startup trigger build cause?
It return null list [] when build was triggerd by startup trigger plugin

Please sign in to comment.