Skip to content
Permalink
Browse files

Fix JENKINS-16841

  • Loading branch information...
gboissinot committed Feb 24, 2013
1 parent be9e505 commit 49673bf836d6dacb429ba23e8a48f8954d3d7b29
@@ -54,7 +54,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(0, new HudsonStartupCause());
project.scheduleBuild(startupTrigger.getQuietPeriod(), new HudsonStartupCause());
}
}

@@ -22,18 +22,31 @@

private String label;

private int quietPeriod;

@DataBoundConstructor
public HudsonStartupTrigger(String label) throws ANTLRException {
public HudsonStartupTrigger(String label, String quietPeriod) throws ANTLRException {
super();
this.label = Util.fixEmpty(label);
String givenQuietPeriod = Util.fixEmpty(quietPeriod);
if (givenQuietPeriod == null) {
this.quietPeriod = 0;
} else {
this.quietPeriod = Integer.parseInt(quietPeriod);
}
}

public String getLabel() {
return label;
}

public int getQuietPeriod() {
return quietPeriod;
}

@Override
public void start(BuildableItem project, boolean newInstance) {
//DO NOTHING HERE. RELIES ON EXTERNAL LISTENER
}

@Extension
@@ -1,7 +1,11 @@
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">

<f:entry field="label" title="${%Node Label}">
<f:entry field="label" title="${%Restricted node Label}">
<f:textbox name="label" value="${instance.label}"/>
</f:entry>

<f:entry field="quietPeriod" title="${%Quiet period}">
<f:textbox name="quietPeriod" value="${instance.quietPeriod}"/>
</f:entry>

</j:jelly>
@@ -2,7 +2,7 @@
<p>
By default, the build is triggered when Jenkins instance starts.<br/>
You can specify a specific a node name or a node label to trigger a build when nodes (whose names or labels
corresponding to the specified value) start. <br/>.
corresponding to the specified value) start. <br/>
You can also specify the 'master' value to refer explicitly to Jenkins master.
</p>
</div>
@@ -0,0 +1,7 @@
<div>
<p>
Give the quiet period before scheduling the job.<br/>
The time unit is in seconds.<br/>
'0' is the default value, the job is scheduling without any delay at startup.
</p>
</div>

0 comments on commit 49673bf

Please sign in to comment.
You can’t perform that action at this time.