Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,17 @@
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.jenkins-ci.tools</groupId>
<artifactId>maven-hpi-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<showDeprecation>true</showDeprecation>
<contextPath>/jenkins</contextPath>
<disabledTestInjection>true</disabledTestInjection>
<!-- TODO specify ${java.level} when JENKINS-20679 implemented -->
</configuration>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ private boolean isBuildTarget(StashPullRequestResponseValue pullRequest) {

boolean shouldBuild = true;

logger.info("Processing PR: " + pullRequest.getId());

if (pullRequest.getState() != null && pullRequest.getState().equals("OPEN")) {
if (isSkipBuild(pullRequest.getTitle())) {
logger.info("Skipping PR: " + pullRequest.getId() + " as title contained skip phrase");
Expand Down Expand Up @@ -285,6 +287,7 @@ private boolean isBuildTarget(StashPullRequestResponseValue pullRequest) {
Collections.sort(comments);
Collections.reverse(comments);
for (StashPullRequestComment comment : comments) {
logger.fine(comment.toString());
String content = comment.getText();
if (content == null || content.isEmpty()) {
continue;
Expand Down Expand Up @@ -341,6 +344,8 @@ private boolean isBuildTarget(StashPullRequestResponseValue pullRequest) {
}
if (shouldBuild) {
logger.info("Building PR: " + pullRequest.getId());
} else {
logger.fine("Skipping PR: " + pullRequest.getId());
}
return shouldBuild;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package stashpullrequestbuilder.stashpullrequestbuilder.stash;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.apache.commons.lang.builder.CompareToBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonProperty;
import org.joda.time.DateTime;

/**
* Created by Nathan McCarthy
Expand All @@ -13,7 +17,7 @@ public class StashPullRequestComment implements Comparable<StashPullRequestComme

private Integer commentId;//
private String text;

private DateTime createdDate;

@JsonProperty("id")
public Integer getCommentId() {
Expand All @@ -33,14 +37,27 @@ public void setText(String text) {
this.text = text;
}

public DateTime getCreatedDate() {
return createdDate;
}

public void setCreatedDate(DateTime createdDate) {
this.createdDate = createdDate;
}

public int compareTo(StashPullRequestComment target) {
if (this.getCommentId() > target.getCommentId()) {
return 1;
} else if (this.getCommentId().equals(target.getCommentId())) {
return 0;
} else {
return -1;
}
return new CompareToBuilder()
.append(this.createdDate, target.createdDate)
.append(this.commentId, target.commentId)
.toComparison();
}

@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
.append("createdDate", createdDate)
.append("commentId", commentId)
.append("text", text)
.toString();
}
}