aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorS.Nishio <nishio@densan-labs.net>2014-04-19 19:10:42 +0900
committerS.Nishio <nishio@densan-labs.net>2014-04-19 19:10:42 +0900
commit68bf998f6ebf61dcd5b2d9aad765369aeabf714f (patch)
tree19d78a56c8aba1de872b8abc693039637bef0fc2 /src/main
parentc526bc44e9da96e89c0b6cc3a38dcc3dcb99f328 (diff)
parent66c0756daf276f214061667ce2b47d036eb3fa8a (diff)
downloadbbprb-68bf998f6ebf61dcd5b2d9aad765369aeabf714f.tar.gz
Merge pull request #4 from nishio-dens/feature/issue-3
[Issue-3] Ci Skip
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