Package jenkins.plugins.git
Class AbstractGitSCMSource
- java.lang.Object
-
- hudson.model.AbstractDescribableImpl<jenkins.scm.api.SCMSource>
-
- jenkins.scm.api.SCMSource
-
- jenkins.plugins.git.AbstractGitSCMSource
-
- All Implemented Interfaces:
ExtensionPoint,Describable<jenkins.scm.api.SCMSource>
- Direct Known Subclasses:
GitSCMSource
public abstract class AbstractGitSCMSource extends jenkins.scm.api.SCMSourceBase class forSCMSourceimplementations that produceGitSCMimplementations.- Since:
- 2.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractGitSCMSource.SCMRevisionImplOur implementation.static classAbstractGitSCMSource.SpecificRevisionBuildChooser-
Nested classes/interfaces inherited from class jenkins.scm.api.SCMSource
jenkins.scm.api.SCMSource.SourceByItem
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_REMOTE_NAMEThe default remote name to use when configuring the ref specs to use with fetch operations.static StringREF_SPEC_DEFAULTThe default ref spec template.static StringREF_SPEC_REMOTE_NAME_PLACEHOLDERThe regex forREF_SPEC_REMOTE_NAME_PLACEHOLDER_STR.static StringREF_SPEC_REMOTE_NAME_PLACEHOLDER_STRThe placeholder to use in ref spec templates in order to correctly ensure that the ref spec remote name matches the remote name.
-
Constructor Summary
Constructors Constructor Description AbstractGitSCMSource()AbstractGitSCMSource(String id)Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description SCMbuild(jenkins.scm.api.SCMHead head, jenkins.scm.api.SCMRevision revision)protected voiddecorate(GitSCMBuilder<?> builder)Performs final decoration of theGitSCMBuilder.GitRepositoryBrowsergetBrowser()Deprecated.protected static FilegetCacheDir(String cacheEntry)protected static FilegetCacheDir(String cacheEntry, boolean createDirectory)protected StringgetCacheEntry()protected static LockgetCacheLock(String cacheEntry)protected com.cloudbees.plugins.credentials.common.StandardUsernameCredentialsgetCredentials()abstract StringgetCredentialsId()StringgetExcludes()Deprecated.useWildcardSCMSourceFilterTraitList<GitSCMExtension>getExtensions()Deprecated.use correspondingGitSCMExtensionTrait(and if there isn't one then likely theGitSCMExtensionis not appropriate to use in the context of aSCMSource)StringgetGitTool()Deprecated.StringgetIncludes()Deprecated.useWildcardSCMSourceFilterTraitprotected List<org.eclipse.jgit.transport.RefSpec>getRefSpecs()Deprecated.abstract StringgetRemote()protected List<UserRemoteConfig>getRemoteConfigs()Deprecated.StringgetRemoteName()Deprecated.List<jenkins.scm.api.trait.SCMSourceTrait>getTraits()Returns theSCMSourceTraitinstances for thisAbstractGitSCMSource.protected booleanisCategoryEnabled(jenkins.scm.api.SCMHeadCategory category)protected booleanisExcluded(String branchName)Deprecated.useWildcardSCMSourceFilterTraitstatic booleanisFIPSCompliantTLS(String credentialsId, String remoteUrl)Returns false if a non-TLS protocol is used when FIPS mode is enabled.protected GitSCMBuilder<?>newBuilder(jenkins.scm.api.SCMHead head, jenkins.scm.api.SCMRevision revision)Instantiates a newGitSCMBuilder.protected hudson.plugins.git.GitToolresolveGitTool()Deprecated.protected hudson.plugins.git.GitToolresolveGitTool(String gitTool)Deprecated.UseresolveGitTool(String, TaskListener)insteadprotected hudson.plugins.git.GitToolresolveGitTool(String gitTool, TaskListener listener)protected jenkins.scm.api.SCMRevisionretrieve(String revision, TaskListener listener, Item retrieveContext)protected jenkins.scm.api.SCMRevisionretrieve(jenkins.scm.api.SCMHead head, TaskListener listener)protected voidretrieve(jenkins.scm.api.SCMSourceCriteria criteria, jenkins.scm.api.SCMHeadObserver observer, jenkins.scm.api.SCMHeadEvent<?> event, TaskListener listener)protected List<Action>retrieveActions(jenkins.scm.api.SCMHead head, jenkins.scm.api.SCMHeadEvent event, TaskListener listener)protected List<Action>retrieveActions(jenkins.scm.api.SCMSourceEvent event, TaskListener listener)protected Set<String>retrieveRevisions(TaskListener listener, Item retrieveContext)-
Methods inherited from class jenkins.scm.api.SCMSource
afterSave, build, canProbe, checkInterrupt, createProbe, defaultListener, equals, fetch, fetch, fetch, fetch, fetch, fetch, fetch, fetch, fetchActions, fetchActions, fetchActions, fetchRevisions, fetchRevisions, fromSCMFileSystem, getCategories, getCriteria, getDescriptor, getId, getOwner, getPronoun, getTrustedRevision, hashCode, hasId, newProbe, parentHeads, parentRevisions, retrieve, retrieve, retrieve, retrieve, retrieve, retrieveActions, retrieveRevisions, setId, setOwner, setTraits, toString, withId
-
-
-
-
Field Detail
-
DEFAULT_REMOTE_NAME
public static final String DEFAULT_REMOTE_NAME
The default remote name to use when configuring the ref specs to use with fetch operations.- Since:
- 3.4.0
- See Also:
- Constant Field Values
-
REF_SPEC_REMOTE_NAME_PLACEHOLDER_STR
public static final String REF_SPEC_REMOTE_NAME_PLACEHOLDER_STR
The placeholder to use in ref spec templates in order to correctly ensure that the ref spec remote name matches the remote name.The template uses
@{...}as that is an illegal sequence in a remote name- Since:
- 3.4.0
- See Also:
- git source code rules on ref spec names, Constant Field Values
-
REF_SPEC_REMOTE_NAME_PLACEHOLDER
public static final String REF_SPEC_REMOTE_NAME_PLACEHOLDER
The regex forREF_SPEC_REMOTE_NAME_PLACEHOLDER_STR.- Since:
- 3.4.0
-
REF_SPEC_DEFAULT
public static final String REF_SPEC_DEFAULT
The default ref spec template.- Since:
- 3.4.0
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractGitSCMSource
public AbstractGitSCMSource()
-
AbstractGitSCMSource
@Deprecated public AbstractGitSCMSource(String id)
Deprecated.
-
-
Method Detail
-
getCredentialsId
@CheckForNull public abstract String getCredentialsId()
-
getRemote
public abstract String getRemote()
- Returns:
- Git remote URL
-
getIncludes
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @RestrictedSince("3.4.0") public String getIncludes()
Deprecated.useWildcardSCMSourceFilterTrait- Returns:
- the includes.
-
getExcludes
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @RestrictedSince("3.4.0") public String getExcludes()
Deprecated.useWildcardSCMSourceFilterTrait- Returns:
- the excludes.
-
getBrowser
@CheckForNull @Deprecated @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @RestrictedSince("3.4.0") public GitRepositoryBrowser getBrowser()
Deprecated.GetsGitRepositoryBrowserto be used with this SCMSource.- Returns:
- Repository browser or
nullif the default tool should be used. - Since:
- 2.5.1
-
getGitTool
@CheckForNull @Deprecated @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @RestrictedSince("3.4.0") public String getGitTool()
Deprecated.Gets Git tool to be used for this SCM Source.- Returns:
- Git Tool or
nullif the default tool should be used. - Since:
- 2.5.1
-
getExtensions
@NonNull @Deprecated @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @RestrictedSince("3.4.0") public List<GitSCMExtension> getExtensions()
Deprecated.use correspondingGitSCMExtensionTrait(and if there isn't one then likely theGitSCMExtensionis not appropriate to use in the context of aSCMSource)Gets list of extensions, which should be used with this branch source.- Returns:
- List of Extensions to be used. May be empty
- Since:
- 2.5.1
-
getTraits
@NonNull public List<jenkins.scm.api.trait.SCMSourceTrait> getTraits()
Returns theSCMSourceTraitinstances for thisAbstractGitSCMSource.- Overrides:
getTraitsin classjenkins.scm.api.SCMSource- Returns:
- the
SCMSourceTraitinstances - Since:
- 3.4.0
-
getRemoteName
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @RestrictedSince("3.4.0") public String getRemoteName()
Deprecated.- Returns:
- the remote name.
-
resolveGitTool
@CheckForNull @Deprecated @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @RestrictedSince("3.4.0") protected hudson.plugins.git.GitTool resolveGitTool()
Deprecated.Resolves theGitTool.- Returns:
- the
GitTool.
-
resolveGitTool
@CheckForNull @Deprecated protected hudson.plugins.git.GitTool resolveGitTool(String gitTool)
Deprecated.UseresolveGitTool(String, TaskListener)insteadResolves theGitTool.- Parameters:
gitTool- theToolInstallation.getName()to resolve.- Returns:
- the
GitTool - Since:
- 3.4.0
-
resolveGitTool
protected hudson.plugins.git.GitTool resolveGitTool(String gitTool, TaskListener listener)
-
isFIPSCompliantTLS
public static boolean isFIPSCompliantTLS(String credentialsId, String remoteUrl)
Returns false if a non-TLS protocol is used when FIPS mode is enabled.- Parameters:
credentialsId- any credentials (can benull)remoteUrl- the git remote url- Returns:
falseif using any credentials with a non TLS protocol with FIPS mode activated- See Also:
FIPS140.useCompliantAlgorithms()
-
retrieve
@CheckForNull protected jenkins.scm.api.SCMRevision retrieve(@NonNull jenkins.scm.api.SCMHead head, @NonNull TaskListener listener) throws IOException, InterruptedException- Overrides:
retrievein classjenkins.scm.api.SCMSource- Throws:
IOExceptionInterruptedException
-
retrieve
protected void retrieve(@CheckForNull jenkins.scm.api.SCMSourceCriteria criteria, @NonNull jenkins.scm.api.SCMHeadObserver observer, @CheckForNull jenkins.scm.api.SCMHeadEvent<?> event, @NonNull TaskListener listener) throws IOException, InterruptedException- Specified by:
retrievein classjenkins.scm.api.SCMSource- Throws:
IOExceptionInterruptedException
-
retrieve
@CheckForNull protected jenkins.scm.api.SCMRevision retrieve(@NonNull String revision, @NonNull TaskListener listener, @CheckForNull Item retrieveContext) throws IOException, InterruptedException- Overrides:
retrievein classjenkins.scm.api.SCMSource- Throws:
IOExceptionInterruptedException
-
retrieveRevisions
@NonNull protected Set<String> retrieveRevisions(@NonNull TaskListener listener, @CheckForNull Item retrieveContext) throws IOException, InterruptedException
- Overrides:
retrieveRevisionsin classjenkins.scm.api.SCMSource- Throws:
IOExceptionInterruptedException
-
retrieveActions
@NonNull protected List<Action> retrieveActions(@CheckForNull jenkins.scm.api.SCMSourceEvent event, @NonNull TaskListener listener) throws IOException, InterruptedException
- Overrides:
retrieveActionsin classjenkins.scm.api.SCMSource- Throws:
IOExceptionInterruptedException
-
retrieveActions
@NonNull protected List<Action> retrieveActions(@NonNull jenkins.scm.api.SCMHead head, @CheckForNull jenkins.scm.api.SCMHeadEvent event, @NonNull TaskListener listener) throws IOException, InterruptedException
- Overrides:
retrieveActionsin classjenkins.scm.api.SCMSource- Throws:
IOExceptionInterruptedException
-
isCategoryEnabled
protected boolean isCategoryEnabled(@NonNull jenkins.scm.api.SCMHeadCategory category)- Overrides:
isCategoryEnabledin classjenkins.scm.api.SCMSource
-
getCacheEntry
protected String getCacheEntry()
-
getCredentials
@CheckForNull protected com.cloudbees.plugins.credentials.common.StandardUsernameCredentials getCredentials()
-
getRefSpecs
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @RestrictedSince("3.4.0") protected List<org.eclipse.jgit.transport.RefSpec> getRefSpecs()
Deprecated.- Returns:
- the ref specs.
-
newBuilder
protected GitSCMBuilder<?> newBuilder(@NonNull jenkins.scm.api.SCMHead head, @CheckForNull jenkins.scm.api.SCMRevision revision)
Instantiates a newGitSCMBuilder. Subclasses should override this method if they want to use a customGitSCMBuilderor if they need to pre-decorate the builder.- Parameters:
head- theSCMHead.revision- theSCMRevision.- Returns:
- the
GitSCMBuilder - See Also:
for post-decoration.
-
decorate
protected void decorate(GitSCMBuilder<?> builder)
Performs final decoration of theGitSCMBuilder. This method is called bybuild(SCMHead, SCMRevision)immediately prior to returningGitSCMBuilder.build(). Subclasses should override this method if they need to overrule builder behaviours defined by traits.- Parameters:
builder- the builder to decorate.
-
build
@NonNull public SCM build(@NonNull jenkins.scm.api.SCMHead head, @CheckForNull jenkins.scm.api.SCMRevision revision)
- Specified by:
buildin classjenkins.scm.api.SCMSource
-
getRemoteConfigs
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @RestrictedSince("3.4.0") protected List<UserRemoteConfig> getRemoteConfigs()
Deprecated.- Returns:
- the
UserRemoteConfiginstances.
-
isExcluded
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @RestrictedSince("3.4.0") protected boolean isExcluded(String branchName)
Deprecated.useWildcardSCMSourceFilterTraitReturns true if the branchName isn't matched by includes or is matched by excludes.- Parameters:
branchName- name of branch to be tested- Returns:
- true if branchName is excluded or is not included
-
-