Package jenkins.plugins.git
Class GitSCMTelescope
java.lang.Object
jenkins.scm.api.SCMFileSystem.Builder
jenkins.plugins.git.GitSCMTelescope
- All Implemented Interfaces:
ExtensionPoint
public abstract class GitSCMTelescope
extends jenkins.scm.api.SCMFileSystem.Builder
An implementation of this extension point allows
AbstractGitSCMSource to examine a repository from a distance
without requiring a local checkout.- Since:
- 3.6.1
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe potential types of reference supported by aGitSCMTelescope.Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal jenkins.scm.api.SCMFileSystemprotected abstract jenkins.scm.api.SCMFileSystembuild(String remote, com.cloudbees.plugins.credentials.common.StandardCredentials credentials, jenkins.scm.api.SCMHead head, jenkins.scm.api.SCMRevision rev) Given aSCMthis should try to build a correspondingSCMFileSysteminstance that reflects the content at the specifiedSCMRevision.final jenkins.scm.api.SCMFileSystembuild(jenkins.scm.api.SCMSource source, jenkins.scm.api.SCMHead head, jenkins.scm.api.SCMRevision rev) abstract StringgetDefaultTarget(String remote, com.cloudbees.plugins.credentials.common.StandardCredentials credentials) Retrieves the default target of the specified repository.abstract jenkins.scm.api.SCMRevisiongetRevision(String remote, com.cloudbees.plugins.credentials.common.StandardCredentials credentials, String refOrHash) Retrieves the current revision of the specified reference or object hash.jenkins.scm.api.SCMRevisiongetRevision(String remote, com.cloudbees.plugins.credentials.common.StandardCredentials credentials, jenkins.scm.api.SCMHead head) Retrieves the current revision of the specified head.final Iterable<jenkins.scm.api.SCMRevision>getRevisions(String remote, com.cloudbees.plugins.credentials.common.StandardCredentials credentials) Retrieves the current revisions of the specified repository.abstract Iterable<jenkins.scm.api.SCMRevision>getRevisions(String remote, com.cloudbees.plugins.credentials.common.StandardCredentials credentials, Set<GitSCMTelescope.ReferenceType> referenceTypes) Retrieves the current revisions of the specified repository.abstract longgetTimestamp(String remote, com.cloudbees.plugins.credentials.common.StandardCredentials credentials, String refOrHash) Retrieves the timestamp of the specified reference or object hash.longgetTimestamp(String remote, com.cloudbees.plugins.credentials.common.StandardCredentials credentials, jenkins.scm.api.SCMHead head) Retrieves the timestamp of the specified reference or object hash.static GitSCMTelescopestatic GitSCMTelescopeof(AbstractGitSCMSource source) final booleanabstract booleanChecks if thisSCMFileSystem.Buildersupports the repository at the supplied remote URL.final booleansupports(jenkins.scm.api.SCMSource source) abstract voidChecks if the supplied credentials are valid against the specified repository URL.Methods inherited from class jenkins.scm.api.SCMFileSystem.Builder
build, supports, supports, supportsDescriptor, supportsDescriptor
-
Constructor Details
-
GitSCMTelescope
public GitSCMTelescope()
-
-
Method Details
-
of
- Parameters:
source- theGitSCM.- Returns:
- the
GitSCMTelescopeto use for the specifiedGitSCMornull
-
of
- Parameters:
source- theAbstractGitSCMSource.- Returns:
- the
GitSCMTelescopeto use for the specifiedAbstractGitSCMSourceornull
-
supports
Checks if thisSCMFileSystem.Buildersupports the repository at the supplied remote URL. NOTE: returningtruemandates thatbuild(Item, SCM, SCMRevision)andbuild(SCMSource, SCMHead, SCMRevision)must return non-nullwhen they are configured with the corresponding repository URL.- Parameters:
remote- the repository URL.- Returns:
trueif and only if the remote URL is supported by thisGitSCMTelescope.
-
validate
public abstract void validate(@NonNull String remote, @CheckForNull com.cloudbees.plugins.credentials.common.StandardCredentials credentials) throws IOException, InterruptedException Checks if the supplied credentials are valid against the specified repository URL.- Parameters:
remote- the repository URL.credentials- the credentials ornullto validate anonymous connection.- Throws:
IOException- if the operation failed due to an IO error or invalid credentials.InterruptedException- if the operation was interrupted.
-
supports
- Specified by:
supportsin classjenkins.scm.api.SCMFileSystem.Builder
-
supports
public final boolean supports(@NonNull jenkins.scm.api.SCMSource source) - Specified by:
supportsin classjenkins.scm.api.SCMFileSystem.Builder
-
build
public final jenkins.scm.api.SCMFileSystem build(@NonNull jenkins.scm.api.SCMSource source, @NonNull jenkins.scm.api.SCMHead head, @CheckForNull jenkins.scm.api.SCMRevision rev) throws IOException, InterruptedException - Overrides:
buildin classjenkins.scm.api.SCMFileSystem.Builder- Throws:
IOExceptionInterruptedException
-
build
public final jenkins.scm.api.SCMFileSystem build(@NonNull Item owner, @NonNull SCM scm, jenkins.scm.api.SCMRevision rev) throws IOException, InterruptedException - Overrides:
buildin classjenkins.scm.api.SCMFileSystem.Builder- Throws:
IOExceptionInterruptedException
-
build
@CheckForNull protected abstract jenkins.scm.api.SCMFileSystem build(@NonNull String remote, @CheckForNull com.cloudbees.plugins.credentials.common.StandardCredentials credentials, @NonNull jenkins.scm.api.SCMHead head, @CheckForNull jenkins.scm.api.SCMRevision rev) throws IOException, InterruptedException Given aSCMthis should try to build a correspondingSCMFileSysteminstance that reflects the content at the specifiedSCMRevision. If theSCMis supported but not for a fixed revision, best effort is acceptable as the most capableSCMFileSystemwill be returned to the caller.- Parameters:
remote- the repository URLcredentials- the credentials ornullfor an anonymous connection.head- the specifiedSCMHeadrev- the specifiedSCMRevision.- Returns:
- the corresponding
SCMFileSystemornullif this builder cannot create aSCMFileSystemfor the specified repository URL. - Throws:
IOException- if the attempt to create aSCMFileSystemfailed due to an IO error (such as the remote system being unavailable)InterruptedException- if the attempt to create aSCMFileSystemwas interrupted.
-
getTimestamp
public abstract long getTimestamp(@NonNull String remote, @CheckForNull com.cloudbees.plugins.credentials.common.StandardCredentials credentials, @NonNull String refOrHash) throws IOException, InterruptedException Retrieves the timestamp of the specified reference or object hash.- Parameters:
remote- the repository URL.credentials- the credentials ornullfor an anonymous connection.refOrHash- the reference or hash. If this is a reference then it will start withConstants.R_REFSIf this is a hash, it may be a full hash or a short hash.- Returns:
- the timestamp.
- Throws:
IOException- if the operation failed due to an IO error.InterruptedException- if the operation was interrupted.
-
getRevision
@CheckForNull public abstract jenkins.scm.api.SCMRevision getRevision(@NonNull String remote, @CheckForNull com.cloudbees.plugins.credentials.common.StandardCredentials credentials, @NonNull String refOrHash) throws IOException, InterruptedException Retrieves the current revision of the specified reference or object hash.- Parameters:
remote- the repository URL.credentials- the credentials ornullfor an anonymous connection.refOrHash- the reference or hash. If this is a reference then it will start withConstants.R_REFSIf this is a hash, it may be a full hash or a short hash.- Returns:
- the revision or
nullif the reference or hash does not exist. - Throws:
IOException- if the operation failed due to an IO error.InterruptedException- if the operation was interrupted.
-
getTimestamp
public long getTimestamp(@NonNull String remote, @CheckForNull com.cloudbees.plugins.credentials.common.StandardCredentials credentials, @NonNull jenkins.scm.api.SCMHead head) throws IOException, InterruptedException Retrieves the timestamp of the specified reference or object hash.- Parameters:
remote- the repository URL.credentials- the credentials ornullfor an anonymous connection.head- the head.- Returns:
- the timestamp.
- Throws:
IOException- if the operation failed due to an IO error.InterruptedException- if the operation was interrupted.
-
getRevision
@CheckForNull public jenkins.scm.api.SCMRevision getRevision(@NonNull String remote, @CheckForNull com.cloudbees.plugins.credentials.common.StandardCredentials credentials, @NonNull jenkins.scm.api.SCMHead head) throws IOException, InterruptedException Retrieves the current revision of the specified head.- Parameters:
remote- the repository URL.credentials- the credentials ornullfor an anonymous connection.head- the head.- Returns:
- the revision or
nullif the head does not exist. - Throws:
IOException- if the operation failed due to an IO error.InterruptedException- if the operation was interrupted.
-
getRevisions
public final Iterable<jenkins.scm.api.SCMRevision> getRevisions(@NonNull String remote, @CheckForNull com.cloudbees.plugins.credentials.common.StandardCredentials credentials) throws IOException, InterruptedException Retrieves the current revisions of the specified repository.- Parameters:
remote- the repository URL.credentials- the credentials ornullfor an anonymous connection.- Returns:
- the revisions.
- Throws:
IOException- if the operation failed due to an IO error.InterruptedException- if the operation was interrupted.
-
getRevisions
public abstract Iterable<jenkins.scm.api.SCMRevision> getRevisions(@NonNull String remote, @CheckForNull com.cloudbees.plugins.credentials.common.StandardCredentials credentials, @NonNull Set<GitSCMTelescope.ReferenceType> referenceTypes) throws IOException, InterruptedException Retrieves the current revisions of the specified repository.- Parameters:
remote- the repository URL.credentials- the credentials ornullfor an anonymous connection.referenceTypes- the types of reference to retrieve revisions of.- Returns:
- the revisions.
- Throws:
IOException- if the operation failed due to an IO error.InterruptedException- if the operation was interrupted.
-
getDefaultTarget
public abstract String getDefaultTarget(@NonNull String remote, @CheckForNull com.cloudbees.plugins.credentials.common.StandardCredentials credentials) throws IOException, InterruptedException Retrieves the default target of the specified repository.- Parameters:
remote- the repository URL.credentials- the credentials ornullfor an anonymous connection.- Returns:
- the default target of the repository.
- Throws:
IOException- if the operation failed due to an IO error.InterruptedException- if the operation was interrupted.
-