Skip to content

Commit

Permalink
Fix for JENKINS-16669 and JENKINS-16617.
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreTurgeon committed Apr 5, 2013
1 parent 431f7d9 commit db1c059
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/main/java/com/base2services/jenkins/SqsBuildTrigger.java
Expand Up @@ -7,10 +7,7 @@
import hudson.Extension;
import hudson.Util;
import hudson.console.AnnotatedLargeText;
import hudson.model.AbstractProject;
import hudson.model.Action;
import hudson.model.Hudson;
import hudson.model.Item;
import hudson.model.*;
import hudson.plugins.git.GitSCM;
import hudson.scm.SCM;
import hudson.triggers.Trigger;
Expand Down Expand Up @@ -89,7 +86,17 @@ public void run() {
logger.println("Done. Took "+ Util.getTimeSpanString(System.currentTimeMillis() - start));
if(result) {
logger.println("Changes found");
job.scheduleBuild(new GitHubPushCause());
// Fix for JENKINS-16617, JENKINS-16669
// The Cause instance needs to have a unique identity (when equals() is called), otherwise
// scheduleBuild() returns false - indicating that this job is already in the queue or
// has already been processed.
if (job.scheduleBuild(new Cause.RemoteCause("GitHub via SQS", "SQS poll initiated on " +
DateFormat.getDateTimeInstance().format(new Date(start))))) {
logger.println("Job queued");
}
else {
logger.println("Job NOT queued - it was determined that this job has been queued already.");
}
} else {
logger.println("No changes");
}
Expand Down

0 comments on commit db1c059

Please sign in to comment.