Class BitbucketGitSCMBuilder

java.lang.Object
jenkins.scm.api.trait.SCMBuilder<B,hudson.plugins.git.GitSCM>
jenkins.plugins.git.GitSCMBuilder<BitbucketGitSCMBuilder>
com.cloudbees.jenkins.plugins.bitbucket.BitbucketGitSCMBuilder

public class BitbucketGitSCMBuilder extends jenkins.plugins.git.GitSCMBuilder<BitbucketGitSCMBuilder>
A GitSCMBuilder specialized for bitbucket.
Since:
2.2.0
  • Constructor Details

    • BitbucketGitSCMBuilder

      public BitbucketGitSCMBuilder(@NonNull BitbucketSCMSource scmSource, @NonNull jenkins.scm.api.SCMHead head, @CheckForNull jenkins.scm.api.SCMRevision revision, @CheckForNull String credentialsId)
      Constructor.
      Parameters:
      scmSource - the BitbucketSCMSource.
      head - the SCMHead
      revision - the (optional) SCMRevision
      credentialsId - The IdCredentials.getId() of the Credentials to use when connecting to the GitSCMBuilder.remote() or null to let the git client choose between providing its own credentials or connecting anonymously.
  • Method Details

    • withCloneLinks

      public BitbucketGitSCMBuilder withCloneLinks(@CheckForNull List<BitbucketHref> primaryCloneLinks, @CheckForNull List<BitbucketHref> mirrorCloneLinks)
      Provides the clone links from the BitbucketRepository to allow inference of ports for different protocols.
      Parameters:
      primaryCloneLinks - the clone links for primary repository.
      mirrorCloneLinks - the clone links for mirror repository if it's configured.
      Returns:
      this for method chaining.
    • scmSource

      @NonNull public BitbucketSCMSource scmSource()
      Returns the BitbucketSCMSource that this request is against (primarily to allow resolving credentials against SCMSource.getOwner()).
      Returns:
      the BitbucketSCMSource that this request is against
    • withCredentials

      @NonNull public BitbucketGitSCMBuilder withCredentials(String credentialsId, BitbucketRepositoryProtocol protocol)
      Configures the IdCredentials.getId() of the Credentials to use when connecting to the GitSCMBuilder.remote()
      Parameters:
      credentialsId - the IdCredentials.getId() of the Credentials to use when connecting to the GitSCMBuilder.remote() or null to let the git client choose between providing its own credentials or connecting anonymously.
      protocol - the BitbucketRepositoryProtocol of the Credentials to use or null to detect the protocol based on the credentialsId. Defaults to HTTP if credentials are null. Enables support for blank SSH credentials.
      Returns:
      this for method chaining.
    • withBitbucketRemote

      @NonNull public BitbucketGitSCMBuilder withBitbucketRemote()
      Updates the GitSCMBuilder.withRemote(String) based on the current SCMBuilder.head() and SCMBuilder.revision(). Will be called automatically by build() but exposed in case the correct remote is required after changing the GitSCMBuilder.withCredentials(String).
      Returns:
      this for method chaining.
    • getCloudRepositoryUri

      @NonNull public String getCloudRepositoryUri(@NonNull String owner, @NonNull String repository)
    • build

      @NonNull public hudson.plugins.git.GitSCM build()
      Overrides:
      build in class jenkins.plugins.git.GitSCMBuilder<BitbucketGitSCMBuilder>