aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger.java9
-rw-r--r--src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java16
-rw-r--r--src/main/resources/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger/config.jelly5
3 files changed, 28 insertions, 2 deletions
diff --git a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger.java b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger.java
index 47d94dc..65777a3 100644
--- a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger.java
+++ b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger.java
@@ -27,6 +27,7 @@ public class BitbucketBuildTrigger extends Trigger<AbstractProject<?, ?>> {
private final String password;
private final String repositoryOwner;
private final String repositoryName;
+ private final String ciSkipPhrases;
transient private BitbucketPullRequestsBuilder bitbucketPullRequestsBuilder;
@Extension
@@ -39,7 +40,8 @@ public class BitbucketBuildTrigger extends Trigger<AbstractProject<?, ?>> {
String username,
String password,
String repositoryOwner,
- String repositoryName) throws ANTLRException {
+ String repositoryName,
+ String ciSkipPhrases) throws ANTLRException {
super(cron);
this.projectPath = projectPath;
this.cron = cron;
@@ -47,6 +49,7 @@ public class BitbucketBuildTrigger extends Trigger<AbstractProject<?, ?>> {
this.password = password;
this.repositoryOwner = repositoryOwner;
this.repositoryName = repositoryName;
+ this.ciSkipPhrases = ciSkipPhrases;
}
public String getProjectPath() {
@@ -73,6 +76,10 @@ public class BitbucketBuildTrigger extends Trigger<AbstractProject<?, ?>> {
return repositoryName;
}
+ public String getCiSkipPhrases() {
+ return ciSkipPhrases;
+ }
+
@Override
public void start(AbstractProject<?, ?> project, boolean newInstance) {
try {
diff --git a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java
index ec13f38..4889dcf 100644
--- a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java
+++ b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java
@@ -89,6 +89,9 @@ public class BitbucketRepository {
private boolean isBuildTarget(BitbucketPullRequestResponseValue pullRequest) {
boolean shouldBuild = true;
if (pullRequest.getState() != null && pullRequest.getState().equals("OPEN")) {
+ if (isSkipBuild(pullRequest.getTitle())) {
+ return false;
+ }
BitbucketPullRequestResponseValueRepository destination = pullRequest.getDestination();
String owner = destination.getRepository().getOwnerName();
String repositoryName = destination.getRepository().getRepositoryName();
@@ -116,4 +119,17 @@ public class BitbucketRepository {
}
return shouldBuild;
}
+
+ private boolean isSkipBuild(String pullRequestTitle) {
+ String skipPhrases = this.trigger.getCiSkipPhrases();
+ if (skipPhrases != null) {
+ String[] phrases = skipPhrases.split(",");
+ for(String phrase : phrases) {
+ if (pullRequestTitle.toLowerCase().contains(phrase.trim().toLowerCase())) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
}
diff --git a/src/main/resources/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger/config.jelly b/src/main/resources/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger/config.jelly
index 964cc85..5117011 100644
--- a/src/main/resources/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger/config.jelly
+++ b/src/main/resources/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger/config.jelly
@@ -11,7 +11,10 @@
<f:entry title="RepositoryOwner" field="repositoryOwner">
<f:textbox />
</f:entry>
- <f:entry title="RespositoryName" field="repositoryName">
+ <f:entry title="RespositoryName" field="repositoryName">
+ <f:textbox />
+ </f:entry>
+ <f:entry title="CI Skip Phrases" field="ciSkipPhrases">
<f:textbox />
</f:entry>
</j:jelly> \ No newline at end of file