Class GitHubSCMBuilder
java.lang.Object
jenkins.scm.api.trait.SCMBuilder<B,hudson.plugins.git.GitSCM>
jenkins.plugins.git.GitSCMBuilder<GitHubSCMBuilder>
org.jenkinsci.plugins.github_branch_source.GitHubSCMBuilder
Builds a
GitSCM for GitHubSCMSource.- Since:
- 2.2.0
-
Constructor Summary
ConstructorsConstructorDescriptionGitHubSCMBuilder(GitHubSCMSource source, jenkins.scm.api.SCMHead head, jenkins.scm.api.SCMRevision revision) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionhudson.plugins.git.GitSCMbuild()final StringrepositoryUrl(String owner, String repo) Tries as best as possible to guess the repository HTML url to use withGithubWeb.final RepositoryUriResolverReturns aRepositoryUriResolveraccording to credentials configuration.static RepositoryUriResolveruriResolver(Item context, String apiUri, String credentialsId) Returns aRepositoryUriResolveraccording to credentials configuration.withCredentials(String credentialsId, RepositoryUriResolver uriResolver) Deprecated.final GitHubSCMBuilderUpdates theGitSCMBuilder.withRemote(String)based on the currentSCMBuilder.head()andSCMBuilder.revision().withResolver(RepositoryUriResolver uriResolver) Methods inherited from class jenkins.plugins.git.GitSCMBuilder
additionalRemote, additionalRemoteNames, additionalRemoteRefSpecs, asRefSpecs, asRemoteConfigs, browser, credentialsId, extensions, gitTool, refSpecs, remote, remoteName, withAdditionalRemote, withAdditionalRemote, withBrowser, withCredentials, withExtension, withExtensions, withExtensions, withGitTool, withoutRefSpecs, withRefSpec, withRefSpecs, withRemote, withRemoteNameMethods inherited from class jenkins.scm.api.trait.SCMBuilder
head, revision, scmClass, withHead, withRevision, withTrait, withTraits, withTraits
-
Constructor Details
-
GitHubSCMBuilder
public GitHubSCMBuilder(@NonNull GitHubSCMSource source, @NonNull jenkins.scm.api.SCMHead head, @CheckForNull jenkins.scm.api.SCMRevision revision) Constructor.- Parameters:
source- theGitHubSCMSource.head- theSCMHeadrevision- the (optional)SCMRevision
-
-
Method Details
-
repositoryUrl
Tries as best as possible to guess the repository HTML url to use withGithubWeb.- Parameters:
owner- the owner.repo- the repository.- Returns:
- the HTML url of the repository or
nullif we could not determine the answer.
-
uriResolver
Returns aRepositoryUriResolveraccording to credentials configuration.- Returns:
- a
RepositoryUriResolver
-
withCredentials
@Deprecated @NonNull public GitHubSCMBuilder withCredentials(String credentialsId, RepositoryUriResolver uriResolver) Deprecated.UseGitSCMBuilder.withCredentials(String)andwithResolver(RepositoryUriResolver)Configures theIdCredentials.getId()of theCredentialsto use when connecting to theGitSCMBuilder.remote()- Parameters:
credentialsId- theIdCredentials.getId()of theCredentialsto use when connecting to theGitSCMBuilder.remote()ornullto let the git client choose between providing its own credentials or connecting anonymously.uriResolver- theRepositoryUriResolverof theCredentialsto use ornullto detect the the protocol based on the credentialsId. Defaults to HTTP if credentials arenull. Enables support for blank SSH credentials.- Returns:
thisfor method chaining.
-
withResolver
-
uriResolver
@NonNull public static RepositoryUriResolver uriResolver(@CheckForNull Item context, @NonNull String apiUri, @CheckForNull String credentialsId) Returns aRepositoryUriResolveraccording to credentials configuration.- Parameters:
context- the context within which to resolve the credentials.apiUri- the API urlcredentialsId- the credentials.- Returns:
- a
RepositoryUriResolver
-
withGitHubRemote
Updates theGitSCMBuilder.withRemote(String)based on the currentSCMBuilder.head()andSCMBuilder.revision().Will be called automatically by
build()but exposed in case the correct remote is required after changing theGitSCMBuilder.withCredentials(String).- Returns:
thisfor method chaining.
-
build
@NonNull public hudson.plugins.git.GitSCM build()- Overrides:
buildin classjenkins.plugins.git.GitSCMBuilder<GitHubSCMBuilder>
-
GitSCMBuilder.withCredentials(String)andwithResolver(RepositoryUriResolver)