public class GitHubSCMBuilder extends jenkins.plugins.git.GitSCMBuilder<GitHubSCMBuilder>
GitSCM
for GitHubSCMSource
.Constructor and Description |
---|
GitHubSCMBuilder(GitHubSCMSource source,
jenkins.scm.api.SCMHead head,
jenkins.scm.api.SCMRevision revision)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
hudson.plugins.git.GitSCM |
build() |
String |
repositoryUrl(String owner,
String repo)
Tries as best as possible to guess the repository HTML url to use with
GithubWeb . |
RepositoryUriResolver |
uriResolver()
Returns a
RepositoryUriResolver according to credentials configuration. |
static RepositoryUriResolver |
uriResolver(hudson.model.Item context,
String apiUri,
String credentialsId)
Returns a
RepositoryUriResolver according to credentials configuration. |
GitHubSCMBuilder |
withCredentials(String credentialsId,
RepositoryUriResolver uriResolver)
Configures the
IdCredentials.getId() of the Credentials to use when connecting to the
GitSCMBuilder.remote() |
GitHubSCMBuilder |
withGitHubRemote()
Updates the
GitSCMBuilder.withRemote(String) based on the current SCMBuilder.head() and
SCMBuilder.revision() . |
additionalRemote, additionalRemoteNames, additionalRemoteRefSpecs, asRefSpecs, asRemoteConfigs, browser, credentialsId, extensions, gitTool, refSpecs, remote, remoteName, withAdditionalRemote, withAdditionalRemote, withBrowser, withCredentials, withExtension, withExtensions, withExtensions, withGitTool, withoutRefSpecs, withRefSpec, withRefSpecs, withRemote, withRemoteName
public GitHubSCMBuilder(@NonNull GitHubSCMSource source, @NonNull jenkins.scm.api.SCMHead head, @CheckForNull jenkins.scm.api.SCMRevision revision)
source
- the GitHubSCMSource
.head
- the SCMHead
revision
- the (optional) SCMRevision
@CheckForNull public final String repositoryUrl(String owner, String repo)
GithubWeb
.owner
- the owner.repo
- the repository.null
if we could not determine the answer.@NonNull public final RepositoryUriResolver uriResolver()
RepositoryUriResolver
according to credentials configuration.RepositoryUriResolver
@NonNull public GitHubSCMBuilder withCredentials(String credentialsId, RepositoryUriResolver uriResolver)
IdCredentials.getId()
of the Credentials
to use when connecting to the
GitSCMBuilder.remote()
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.uriResolver
- the RepositoryUriResolver
of the Credentials
to use or null
to detect the the protocol based on the credentialsId. Defaults to HTTP if credentials are
null
. Enables support for blank SSH credentials.this
for method chaining.@NonNull public static RepositoryUriResolver uriResolver(@CheckForNull hudson.model.Item context, @NonNull String apiUri, @CheckForNull String credentialsId)
RepositoryUriResolver
according to credentials configuration.context
- the context within which to resolve the credentials.apiUri
- the API urlcredentialsId
- the credentials.RepositoryUriResolver
@NonNull public final GitHubSCMBuilder withGitHubRemote()
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)
.this
for method chaining.@NonNull public hudson.plugins.git.GitSCM build()
build
in class jenkins.plugins.git.GitSCMBuilder<GitHubSCMBuilder>
Copyright © 2016–2020. All rights reserved.