Skip to content

Commit cc5ba8b

Browse files
authored
Merge pull request #177 from drew222/support_pulling_multiple_repos
Specify repo url in RevisionParameterAction
2 parents dd260d5 + bd6bc54 commit cc5ba8b

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
<dependency>
6565
<groupId>org.jenkins-ci.plugins</groupId>
6666
<artifactId>git</artifactId>
67-
<version>2.2.4</version>
67+
<version>2.4.1</version>
6868
</dependency>
6969
<dependency>
7070
<groupId>org.jenkins-ci</groupId>

src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@
1717
import jenkins.model.ParameterizedJobMixIn;
1818
import net.sf.json.JSONObject;
1919
import org.apache.commons.lang.StringUtils;
20+
import org.eclipse.jgit.transport.URIish;
2021
import org.jenkinsci.Symbol;
2122
import org.kohsuke.stapler.DataBoundConstructor;
2223
import org.kohsuke.stapler.StaplerRequest;
2324

2425
import java.io.IOException;
26+
import java.net.URISyntaxException;
2527
import java.util.ArrayList;
2628
import java.util.HashMap;
2729
import java.util.List;
@@ -214,7 +216,16 @@ public QueueTaskFuture<?> startJob(BitbucketCause cause) {
214216
return retrieveScheduleJob(this.job).scheduleBuild2(0,
215217
new CauseAction(cause),
216218
new ParametersAction(new ArrayList(values.values())),
217-
new RevisionParameterAction(cause.getSourceCommitHash()));
219+
new RevisionParameterAction(cause.getSourceCommitHash(), getBitbucketRepoUrl(cause.getRepositoryOwner(), cause.getRepositoryName())));
220+
}
221+
222+
private URIish getBitbucketRepoUrl(String repoOwner, String repoName) {
223+
try{
224+
return new URIish(String.format("[email protected]:%s/%s.git", repoOwner, repoName));
225+
} catch (URISyntaxException e) {
226+
logger.log(Level.SEVERE, "Unable to create URIish for bitbucket url, checking out the pull request branch may fail.", e);
227+
return null;
228+
}
218229
}
219230

220231
private void cancelPreviousJobsInQueueThatMatch(@Nonnull BitbucketCause bitbucketCause) {

0 commit comments

Comments
 (0)