aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger.java14
-rw-r--r--src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java11
-rw-r--r--src/main/resources/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger/config.jelly6
3 files changed, 29 insertions, 2 deletions
diff --git a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger.java b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger.java
index 974d3eb..09802af 100644
--- a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger.java
+++ b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger.java
@@ -32,6 +32,8 @@ public class BitbucketBuildTrigger extends Trigger<AbstractProject<?, ?>> {
private final String projectPath;
private final String cron;
private final String credentialsId;
+ private final String username;
+ private final String password;
private final String repositoryOwner;
private final String repositoryName;
private final String ciSkipPhrases;
@@ -48,6 +50,8 @@ public class BitbucketBuildTrigger extends Trigger<AbstractProject<?, ?>> {
String projectPath,
String cron,
String credentialsId,
+ String username,
+ String password,
String repositoryOwner,
String repositoryName,
String ciSkipPhrases,
@@ -58,6 +62,8 @@ public class BitbucketBuildTrigger extends Trigger<AbstractProject<?, ?>> {
this.projectPath = projectPath;
this.cron = cron;
this.credentialsId = credentialsId;
+ this.username = username;
+ this.password = password;
this.repositoryOwner = repositoryOwner;
this.repositoryName = repositoryName;
this.ciSkipPhrases = ciSkipPhrases;
@@ -77,6 +83,14 @@ public class BitbucketBuildTrigger extends Trigger<AbstractProject<?, ?>> {
return credentialsId;
}
+ public String getUsername() {
+ return username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
public String getRepositoryOwner() {
return repositoryOwner;
}
diff --git a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java
index 8606c45..fb43f12 100644
--- a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java
+++ b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java
@@ -45,10 +45,17 @@ public class BitbucketRepository {
public void init() {
trigger = this.builder.getTrigger();
+ String username = trigger.getUsername();
+ String password = trigger.getPassword();
StandardUsernamePasswordCredentials credentials = getCredentials(trigger.getCredentialsId());
+ if (credentials != null) {
+ username = credentials.getUsername();
+ password = credentials.getPassword().getPlainText();
+ }
+
client = new ApiClient(
- credentials.getUsername(),
- credentials.getPassword().getPlainText(),
+ username,
+ password,
trigger.getRepositoryOwner(),
trigger.getRepositoryName());
}
diff --git a/src/main/resources/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger/config.jelly b/src/main/resources/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger/config.jelly
index df43e5a..db5ca0f 100644
--- a/src/main/resources/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger/config.jelly
+++ b/src/main/resources/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger/config.jelly
@@ -5,6 +5,12 @@
<f:entry title="${%Credentials}" field="credentialsId">
<c:select/>
</f:entry>
+ <f:entry title="Bitbucket BasicAuth Username" field="username">
+ <f:textbox />
+ </f:entry>
+ <f:entry title="Bitbucket BasicAuth Password" field="password">
+ <f:password />
+ </f:entry>
<f:entry title="RepositoryOwner" field="repositoryOwner">
<f:textbox />
</f:entry>