Skip to content
Permalink
Browse files

The new mixin should also handle Trigger’s.

(Left the upstream pseudo-trigger out of this, as it is pretty hackish and might not generalize well—requires Publisher’s to make any sense.)
  • Loading branch information
jglick committed Mar 10, 2014
1 parent 5b7ece6 commit 6aa5ea8c7225c6726abb9affb22966df778e6ea4
@@ -1594,7 +1594,7 @@ void removeFromList(Descriptor<T> item, List<T> collection) throws IOException {
}

@SuppressWarnings("unchecked")
public Map<TriggerDescriptor,Trigger<?>> getTriggers() {
@Override public Map<TriggerDescriptor,Trigger<?>> getTriggers() {
return triggers().toMap();
}

@@ -59,6 +59,7 @@
import javax.annotation.CheckForNull;
import edu.umd.cs.findbugs.annotations.SuppressWarnings;
import hudson.model.Items;
import jenkins.model.ParameterizedJobMixIn;

/**
* Triggers a {@link Build}.
@@ -246,7 +247,7 @@ public void run(AbstractProject p) {
}

// Process all triggers, except SCMTriggers when synchronousPolling is set
for (AbstractProject<?,?> p : inst.getAllItems(AbstractProject.class)) {
for (ParameterizedJobMixIn.ParameterizedJob p : inst.getAllItems(ParameterizedJobMixIn.ParameterizedJob.class)) {
for (Trigger t : p.getTriggers().values()) {
if (! (t instanceof SCMTrigger && scmd.synchronousPolling)) {
LOGGER.fine("cron checking "+p.getName());
@@ -40,12 +40,15 @@
import hudson.model.Run;
import hudson.model.queue.QueueTaskFuture;
import hudson.search.SearchIndexBuilder;
import hudson.triggers.Trigger;
import hudson.triggers.TriggerDescriptor;
import hudson.views.BuildButtonColumn;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import javax.annotation.CheckForNull;
import javax.servlet.ServletException;
import static javax.servlet.http.HttpServletResponse.SC_CREATED;
@@ -250,7 +253,7 @@ public final String getBuildNowText() {
/**
* Marker for job using this mixin.
*/
public interface ParameterizedJob extends hudson.model.Queue.Task {
public interface ParameterizedJob extends hudson.model.Queue.Task, hudson.model.Item {

@SuppressWarnings("deprecation")
@CheckForNull hudson.model.BuildAuthorizationToken getAuthToken();
@@ -259,6 +262,13 @@ public final String getBuildNowText() {

String getBuildNowText();

/**
* Gets currently configured triggers.
* You may use {@code <p:config-trigger/>} to configure them.
* @return a map from trigger kind to instance
*/
Map<TriggerDescriptor,Trigger<?>> getTriggers();

}

}
@@ -23,7 +23,7 @@ THE SOFTWARE.
-->

<!--
Configure build triggers
Configure build triggers, applicable to ParameterizedJobMixIn.ParameterizedJob
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">

0 comments on commit 6aa5ea8

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