Skip to content
Permalink
Browse files

Provide the old trigger object when configuring a new timer trigger

This allows the slice implementor to copy any values that are not
of interest to the given slice.  This was motivated by the bug
[JENKINS-29941], and this commit includes a fix for that bug.
  • Loading branch information...
mdonohue committed Sep 18, 2015
1 parent 120e5ee commit 7474a28792b19149354799e5a38652fef9eb8b8a
@@ -52,7 +52,7 @@ public String getName(AbstractProject<?, ?> item) {
return TopLevelItemSelector.getAllTopLevelItems(AbstractProject.class);
}

public abstract Trigger newTrigger(String spec) throws ANTLRException;
public abstract Trigger newTrigger(String spec, Trigger oldTrigger) throws ANTLRException;

public boolean setValues(AbstractProject<?, ?> item, List<String> set) {
if (set.isEmpty())
@@ -76,7 +76,7 @@ public boolean setValues(AbstractProject<?, ?> item, List<String> set) {
try {
Trigger newtrigger = null;
if (!disabled) {
newtrigger = newTrigger(spec);
newtrigger = newTrigger(spec, oldTrigger);
}
if (oldTrigger != null) {
item.removeTrigger(oldTrigger.getDescriptor());
@@ -28,8 +28,12 @@ public String getUrl() {
}

@SuppressWarnings("unchecked")
public Trigger newTrigger(String spec) throws ANTLRException {
return new SCMTrigger(spec);
public Trigger newTrigger(String spec, Trigger oldTrigger) throws ANTLRException {
boolean ignorePostCommitHooks = false;
if(oldTrigger instanceof SCMTrigger) {
ignorePostCommitHooks = ((SCMTrigger)oldTrigger).isIgnorePostCommitHooks();
}
return new SCMTrigger(spec, ignorePostCommitHooks);
}

}
@@ -28,8 +28,8 @@ public String getUrl() {
}

@SuppressWarnings("unchecked")
public Trigger newTrigger(String spec) throws ANTLRException {
return new TimerTrigger(spec);
public Trigger newTrigger(String spec, Trigger oldTrigger) throws ANTLRException {
return new TimerTrigger(spec);
}

}

0 comments on commit 7474a28

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