Skip to content

Commit

Permalink
Switch to ignore post-commit hook in SCM polling triggers [FIXED JENK…
Browse files Browse the repository at this point in the history
  • Loading branch information
kutzi committed Nov 24, 2012
1 parent 41f1fe6 commit b65c30c
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
4 changes: 4 additions & 0 deletions changelog.html
Expand Up @@ -58,6 +58,10 @@
<li class=bug>
Slave's Name should be trimmed of spaces at the beginning and end of the Name on Save.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-15836">issue 15836</a>)
<li class=rfe>
Added new switch to ignore post-commit hooks in SCM polling triggers.
This requires that the SCM plugin supports this feature, too!
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-6846">issue 6846</a>)

</ul>
</div><!--=TRUNK-END=-->
Expand Down
21 changes: 20 additions & 1 deletion core/src/main/java/hudson/triggers/SCMTrigger.java
Expand Up @@ -73,9 +73,28 @@
* @author Kohsuke Kawaguchi
*/
public class SCMTrigger extends Trigger<SCMedItem> {
@DataBoundConstructor

private boolean ignorePostCommitHooks;

public SCMTrigger(String scmpoll_spec) throws ANTLRException {
this(scmpoll_spec, false);
}

@DataBoundConstructor
public SCMTrigger(String scmpoll_spec, boolean ignorePostCommitHooks) throws ANTLRException {
super(scmpoll_spec);
this.ignorePostCommitHooks = ignorePostCommitHooks;
}

/**
* This trigger wants to ignore post-commit hooks.
* <p>
* SCM plugins must respect this and not run this trigger for post-commit notifications.
*
* @since 1.493
*/
public boolean isIgnorePostCommitHooks() {
return this.ignorePostCommitHooks;
}

@Override
Expand Down
Expand Up @@ -27,4 +27,7 @@ THE SOFTWARE.
<f:entry title="${%Schedule}" help="/descriptor/hudson.triggers.TimerTrigger/help/spec">
<f:textarea name="scmpoll_spec" checkUrl="'${rootURL}/trigger/TimerTrigger/check?value='+encodeURIComponent(this.value)" value="${instance.spec}"/>
</f:entry>
<f:entry field="ignorePostCommitHooks" title="${%Ignore post-commit hooks}">
<f:checkbox />
</f:entry>
</j:jelly>
@@ -0,0 +1,8 @@
<div>
Ignore changes notified by SCM post-commit hooks.
<p>
This can be useful if you want to prevent some long-running jobs (e.g. reports) starting because of every commit, but still want to
run them periodic if SCM changes have occurred.
<p>
Note that this option needs to be supported by the SCM plugin, too! The subversion-plugin supports this since version 1.44.
</div>

0 comments on commit b65c30c

Please sign in to comment.