diff --git a/src/main/java/io/jenkins/plugins/bitbucketpushandpullrequest/BitBucketPPRTrigger.java b/src/main/java/io/jenkins/plugins/bitbucketpushandpullrequest/BitBucketPPRTrigger.java index 3cd401e..6115785 100644 --- a/src/main/java/io/jenkins/plugins/bitbucketpushandpullrequest/BitBucketPPRTrigger.java +++ b/src/main/java/io/jenkins/plugins/bitbucketpushandpullrequest/BitBucketPPRTrigger.java @@ -33,7 +33,6 @@ import java.util.logging.Logger; import javax.annotation.CheckForNull; -import hudson.plugins.git.GitSCM; import io.jenkins.plugins.bitbucketpushandpullrequest.action.BitBucketPPRActionAbstract; import io.jenkins.plugins.bitbucketpushandpullrequest.action.BitBucketPPRPullRequestServerAction; import io.jenkins.plugins.bitbucketpushandpullrequest.action.BitBucketPPRServerRepositoryAction; @@ -163,8 +162,7 @@ public void onPollSuccess(PollingResult pollingResult) { BitBucketPPRTriggerCause cause = filter.getCause(getLogFile(), bitbucketAction, bitbucketEvent); if (shouldScheduleJob(filter, pollingResult, bitbucketAction)) { - scheduleJobs( - cause, bitbucketAction, scmTrigger, observable, filter); + scheduleJob(cause, bitbucketAction, scmTrigger, observable, filter); } } catch (Throwable e) { logger.warning( @@ -198,34 +196,6 @@ public void onPollError(Throwable e) { } } - private void scheduleJobs( - BitBucketPPRTriggerCause cause, - BitBucketPPRAction bitbucketAction, - SCM scmTrigger, - BitBucketPPRObservable observable, - BitBucketPPRTriggerFilter filter) { - ((GitSCM) scmTrigger) - .getRepositories() - .forEach( - repository -> { - // for each url call schedulejob - repository - .getURIs() - .forEach( - uri -> { - try { - scheduleJob(cause, uri, bitbucketAction, observable, filter, scmTrigger); - } catch (URISyntaxException e) { - logger.warning( - String.format( - "Error: cannot schedule the job for the repository %s: %s", - uri.toPrivateString(), e.getMessage())); - e.printStackTrace(); - } - }); - }); - } - private void checkLocalPropagationUrl(BitBucketPPRAction bitBucketPPRAction) { if (bitBucketPPRAction == null) { @@ -256,11 +226,10 @@ private boolean shouldScheduleJob( private void scheduleJob( BitBucketPPRTriggerCause cause, - URIish uri, BitBucketPPRAction bitbucketAction, + SCM scmTrigger, BitBucketPPRObservable observable, - BitBucketPPRTriggerFilter filter, - SCM scmTrigger) + BitBucketPPRTriggerFilter filter) throws URISyntaxException { // Jenkins will take all instances of QueueAction from this job and will try to compare these @@ -276,7 +245,7 @@ private void scheduleJob( 5, new CauseAction(cause), bitbucketAction, - new RevisionParameterAction(bitbucketAction.getLatestCommit(), uri)); + new RevisionParameterAction(bitbucketAction.getLatestCommit())); QueueTaskFuture> f = item != null ? (QueueTaskFuture) item.getFuture() : null;