B - the concrete type of GitSCMBuilder so that subclasses can chain correctly in their
SCMBuilder.withHead(SCMHead) etc methods.public class GitSCMBuilder<B extends GitSCMBuilder<B>> extends jenkins.scm.api.trait.SCMBuilder<B,GitSCM>
SCMBuilder base class for AbstractGitSCMSource.| Constructor and Description |
|---|
GitSCMBuilder(jenkins.scm.api.SCMHead head,
jenkins.scm.api.SCMRevision revision,
String remote,
String credentialsId)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
String |
additionalRemote(String remoteName)
Gets the remote URL of the git repository for the specified remote name.
|
Set<String> |
additionalRemoteNames()
Gets the (possibly empty) additional remote names.
|
List<String> |
additionalRemoteRefSpecs(String remoteName)
Gets the ref specs to use for the git repository of the specified remote name.
|
List<org.eclipse.jgit.transport.RefSpec> |
asRefSpecs()
Converts the ref spec templates into
RefSpec instances. |
List<UserRemoteConfig> |
asRemoteConfigs()
Converts the
asRefSpecs() into UserRemoteConfig instances. |
GitRepositoryBrowser |
browser()
Returns the
GitRepositoryBrowser or null to use the "auto" browser. |
GitSCM |
build() |
String |
credentialsId()
Returns the
IdCredentials.getId() of the Credentials to use when connecting to
the remote or null to let the git client choose between providing its own
credentials or connecting anonymously. |
List<GitSCMExtension> |
extensions()
Returns the
GitSCMExtension instances to apply to the GitSCM. |
String |
gitTool()
Returns the name of the
GitTool to use or null to use the default. |
List<String> |
refSpecs()
Returns the list of ref specs to use.
|
String |
remote()
Returns the remote URL of the git repository.
|
String |
remoteName()
Returns the name to give the remote.
|
B |
withAdditionalRemote(String remoteName,
String remote,
List<String> refSpecs)
Configures an additional remote.
|
B |
withAdditionalRemote(String remoteName,
String remote,
String... refSpecs)
Configures an additional remote.
|
B |
withBrowser(GitRepositoryBrowser browser)
Configures the
GitRepositoryBrowser to use. |
B |
withCredentials(String credentialsId)
|
B |
withExtension(GitSCMExtension extension)
Adds (or redefines) the supplied
GitSCMExtension. |
B |
withExtensions(GitSCMExtension... extensions)
Adds (or redefines) the supplied
GitSCMExtensions. |
B |
withExtensions(List<GitSCMExtension> extensions)
Adds (or redefines) the supplied
GitSCMExtensions. |
B |
withGitTool(String gitTool)
Configures the
ToolInstallation.getName() to use. |
B |
withoutRefSpecs()
Clears the specified ref specs.
|
B |
withRefSpec(String refSpec)
Adds the specified ref spec.
|
B |
withRefSpecs(List<String> refSpecs)
Adds the specified ref specs.
|
B |
withRemote(String remote)
Replaces the URL of the git repository.
|
B |
withRemoteName(String remoteName)
Configures the remote name to use for the git repository.
|
head, revision, scmClass, withHead, withRevision, withTrait, withTraits, withTraitspublic GitSCMBuilder(@NonNull
jenkins.scm.api.SCMHead head,
@CheckForNull
jenkins.scm.api.SCMRevision revision,
@NonNull
String remote,
@CheckForNull
String credentialsId)
head - The SCMHead to produce the SCM for.revision - The SCMRevision to produce the SCM for or null to produce the
SCM for the head revision.remote - The remote URL of the git server.credentialsId - The IdCredentials.getId() of the Credentials to use when connecting to
the remote or null to let the git client choose between providing its own
credentials or connecting anonymously.@CheckForNull public final GitRepositoryBrowser browser()
GitRepositoryBrowser or null to use the "auto" browser.GitRepositoryBrowser or null to use the "auto" browser.@CheckForNull public final String credentialsId()
IdCredentials.getId() of the Credentials to use when connecting to
the remote or null to let the git client choose between providing its own
credentials or connecting anonymously.IdCredentials.getId() of the Credentials to use when connecting to
the remote or null to let the git client choose between providing its own
credentials or connecting anonymously.@NonNull public final List<GitSCMExtension> extensions()
GitSCMExtension instances to apply to the GitSCM.GitSCMExtension instances to apply to the GitSCM.@CheckForNull public final String gitTool()
GitTool to use or null to use the default.GitTool to use or null to use the default.@NonNull public final List<String> refSpecs()
@NonNull public final String remote()
@NonNull public final String remoteName()
@NonNull public final Set<String> additionalRemoteNames()
@CheckForNull public final String additionalRemote(String remoteName)
remoteName - the additional remote name.null if the supplied name is not in
additionalRemoteNames()@CheckForNull public final List<String> additionalRemoteRefSpecs(String remoteName)
remoteName - the additional remote name.null if the supplied name is not in
additionalRemoteNames()@NonNull public final B withBrowser(@CheckForNull GitRepositoryBrowser browser)
GitRepositoryBrowser to use.browser - the GitRepositoryBrowser or null to use the default "auto" browser.this for method chaining.@NonNull public final B withCredentials(@CheckForNull String credentialsId)
credentialsId - the IdCredentials.getId() of the Credentials to use when connecting to
the remote() or null to let the git client choose between providing its own
credentials or connecting anonymously.this for method chaining.@NonNull public final B withExtension(@CheckForNull GitSCMExtension extension)
GitSCMExtension.extension - the GitSCMExtension (null values are safely ignored).this for method chaining.@NonNull public final B withExtensions(GitSCMExtension... extensions)
GitSCMExtensions.extensions - the GitSCMExtensions.this for method chaining.@NonNull public final B withExtensions(@NonNull List<GitSCMExtension> extensions)
GitSCMExtensions.extensions - the GitSCMExtensions.this for method chaining.@NonNull public final B withGitTool(@CheckForNull String gitTool)
ToolInstallation.getName() to use.gitTool - the ToolInstallation.getName() or null to use the system default.this for method chaining.@NonNull public final B withRefSpec(@NonNull String refSpec)
AbstractGitSCMSource.REF_SPEC_DEFAULT. The ref spec is expected to be processed for substitution of
AbstractGitSCMSource.REF_SPEC_REMOTE_NAME_PLACEHOLDER_STR by remote() before use.refSpec - the ref spec template to add.this for method chaining.withoutRefSpecs()@NonNull public final B withRefSpecs(@NonNull List<String> refSpecs)
AbstractGitSCMSource.REF_SPEC_DEFAULT. The ref spec is expected to be processed for substitution of
AbstractGitSCMSource.REF_SPEC_REMOTE_NAME_PLACEHOLDER_STR by remote() before use.refSpecs - the ref spec templates to add.this for method chaining.withoutRefSpecs()@NonNull public final B withoutRefSpecs()
AbstractGitSCMSource.REF_SPEC_DEFAULT will be used as the ref spec template.this for method chaining.@NonNull public final B withRemote(@NonNull String remote)
remote - the new URL to use for the git repository.this for method chaining.@NonNull public final B withRemoteName(@CheckForNull String remoteName)
remoteName - the remote name to use for the git repository (null or the empty string are
equivalent to passing AbstractGitSCMSource.DEFAULT_REMOTE_NAME).this for method chaining.@NonNull public final B withAdditionalRemote(@NonNull String remoteName, @NonNull String remote, String... refSpecs)
remote() name.remoteName - the name of the additional remote.remote - the url of the additional remote.refSpecs - the ref specs of the additional remote, if empty will default to
AbstractGitSCMSource.REF_SPEC_DEFAULTthis for method chaining.@NonNull public final B withAdditionalRemote(@NonNull String remoteName, @NonNull String remote, List<String> refSpecs)
remote() name.remoteName - the name of the additional remote.remote - the url of the additional remote.refSpecs - the ref specs of the additional remote, if empty will default to
AbstractGitSCMSource.REF_SPEC_DEFAULTthis for method chaining.@NonNull public final List<org.eclipse.jgit.transport.RefSpec> asRefSpecs()
RefSpec instances.RefSpec instances.@NonNull public final List<UserRemoteConfig> asRemoteConfigs()
asRefSpecs() into UserRemoteConfig instances.UserRemoteConfig instances.@NonNull public GitSCM build()
build in class jenkins.scm.api.trait.SCMBuilder<B extends GitSCMBuilder<B>,GitSCM>Copyright © 2007–2021. All rights reserved.