aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger.java
diff options
context:
space:
mode:
authorNicholas Blair <nicholas.blair@wisc.edu>2015-05-29 13:53:07 -0500
committerNicholas Blair <nicholas.blair@gmail.com>2017-02-18 15:18:14 -0600
commit564b6681dffd561facc63be256e88514f52c9e1b (patch)
treef37b03564da0efc253b6fa76519a3caf61d46304 /src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger.java
parent325f247ceb7b0f60df6e061343cda89758f9ef19 (diff)
downloadbbprb-564b6681dffd561facc63be256e88514f52c9e1b.tar.gz
Parameterize comment phrase to trigger a build
Defaults to prior "test this please", can be overridden in the job configuration.
Diffstat (limited to 'src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger.java')
-rw-r--r--src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger.java104
1 files changed, 71 insertions, 33 deletions
diff --git a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger.java b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger.java
index aedfb91..10d6c98 100644
--- a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger.java
+++ b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger.java
@@ -28,6 +28,11 @@ import static com.cloudbees.plugins.credentials.CredentialsMatchers.instanceOf;
* Created by nishio
*/
public class BitbucketBuildTrigger extends Trigger<AbstractProject<?, ?>> {
+ /**
+ * Default value for {@link #getCommentTrigger()}.
+ */
+ public static final String DEFAULT_COMMENT_TRIGGER = "test this please";
+
private static final Logger logger = Logger.getLogger(BitbucketBuildTrigger.class.getName());
private final String projectPath;
private final String cron;
@@ -43,44 +48,71 @@ public class BitbucketBuildTrigger extends Trigger<AbstractProject<?, ?>> {
private final String ciSkipPhrases;
private final boolean checkDestinationCommit;
private final boolean approveIfSuccess;
+ private final String commentTrigger;
transient private BitbucketPullRequestsBuilder bitbucketPullRequestsBuilder;
@Extension
- public static final BitbucketBuildTriggerDescriptor descriptor = new BitbucketBuildTriggerDescriptor();
+ public static final BitbucketBuildTriggerDescriptor descriptor = new BitbucketBuildTriggerDescriptor();
+ /**
+ * Sets {@link #getCommentTrigger()} to {@link #DEFAULT_COMMENT_TRIGGER}.
+ */
+ @DataBoundConstructor
+ public BitbucketBuildTrigger(
+ String projectPath,
+ String cron,
+ String credentialsId,
+ String username,
+ String password,
+ String repositoryOwner,
+ String repositoryName,
+ String branchesFilter,
+ boolean branchesFilterBySCMIncludes,
+ String ciKey,
+ String ciName,
+ String ciSkipPhrases,
+ boolean checkDestinationCommit,
+ boolean approveIfSuccess
+ ) throws ANTLRException {
+ this(projectPath, cron, credentialsId, username, password, repositoryOwner, repositoryName,
+ branchesFilter, branchesFilterBySCMIncludes, ciKey, ciName, ciSkipPhrases,
+ checkDestinationCommit, approveIfSuccess, DEFAULT_COMMENT_TRIGGER);
+ }
@DataBoundConstructor
public BitbucketBuildTrigger(
- String projectPath,
- String cron,
- String credentialsId,
- String username,
- String password,
- String repositoryOwner,
- String repositoryName,
- String branchesFilter,
- boolean branchesFilterBySCMIncludes,
- String ciKey,
- String ciName,
- String ciSkipPhrases,
- boolean checkDestinationCommit,
- boolean approveIfSuccess
- ) throws ANTLRException {
- super(cron);
- this.projectPath = projectPath;
- this.cron = cron;
- this.credentialsId = credentialsId;
- this.username = username;
- this.password = password;
- this.repositoryOwner = repositoryOwner;
- this.repositoryName = repositoryName;
- this.branchesFilter = branchesFilter;
- this.branchesFilterBySCMIncludes = branchesFilterBySCMIncludes;
- this.ciKey = ciKey;
- this.ciName = ciName;
- this.ciSkipPhrases = ciSkipPhrases;
- this.checkDestinationCommit = checkDestinationCommit;
- this.approveIfSuccess = approveIfSuccess;
+ String projectPath,
+ String cron,
+ String credentialsId,
+ String username,
+ String password,
+ String repositoryOwner,
+ String repositoryName,
+ String branchesFilter,
+ boolean branchesFilterBySCMIncludes,
+ String ciKey,
+ String ciName,
+ String ciSkipPhrases,
+ boolean checkDestinationCommit,
+ boolean approveIfSuccess,
+ String commentTrigger
+ ) throws ANTLRException {
+ super(cron);
+ this.projectPath = projectPath;
+ this.cron = cron;
+ this.credentialsId = credentialsId;
+ this.username = username;
+ this.password = password;
+ this.repositoryOwner = repositoryOwner;
+ this.repositoryName = repositoryName;
+ this.branchesFilter = branchesFilter;
+ this.branchesFilterBySCMIncludes = branchesFilterBySCMIncludes;
+ this.ciKey = ciKey;
+ this.ciName = ciName;
+ this.ciSkipPhrases = ciSkipPhrases;
+ this.checkDestinationCommit = checkDestinationCommit;
+ this.approveIfSuccess = approveIfSuccess;
+ this.commentTrigger = commentTrigger;
}
public String getProjectPath() {
@@ -114,7 +146,7 @@ public class BitbucketBuildTrigger extends Trigger<AbstractProject<?, ?>> {
public String getBranchesFilter() {
return branchesFilter;
}
-
+
public boolean getBranchesFilterBySCMIncludes() {
return branchesFilterBySCMIncludes;
}
@@ -136,7 +168,13 @@ public class BitbucketBuildTrigger extends Trigger<AbstractProject<?, ?>> {
}
public boolean getApproveIfSuccess() {
- return approveIfSuccess;
+ return approveIfSuccess;
+ }
+ /**
+ * @return a phrase that when entered in a comment will trigger a new build
+ */
+ public String getCommentTrigger() {
+ return commentTrigger;
}
@Override