Class GitHubSCMSource
java.lang.Object
hudson.model.AbstractDescribableImpl<jenkins.scm.api.SCMSource>
jenkins.scm.api.SCMSource
jenkins.plugins.git.AbstractGitSCMSource
org.jenkinsci.plugins.github_branch_source.GitHubSCMSource
- All Implemented Interfaces:
ExtensionPoint,Describable<jenkins.scm.api.SCMSource>
public class GitHubSCMSource
extends jenkins.plugins.git.AbstractGitSCMSource
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class jenkins.plugins.git.AbstractGitSCMSource
jenkins.plugins.git.AbstractGitSCMSource.SCMRevisionImpl, jenkins.plugins.git.AbstractGitSCMSource.SpecificRevisionBuildChooserNested classes/interfaces inherited from class jenkins.scm.api.SCMSource
jenkins.scm.api.SCMSource.SourceByItemNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class jenkins.plugins.git.AbstractGitSCMSource
DEFAULT_REMOTE_NAME, REF_SPEC_DEFAULT, REF_SPEC_REMOTE_NAME_PLACEHOLDER, REF_SPEC_REMOTE_NAME_PLACEHOLDER_STRFields inherited from class jenkins.scm.api.SCMSource
PRONOUN -
Constructor Summary
ConstructorsConstructorDescriptionGitHubSCMSource(String repoOwner, String repository) Deprecated.GitHubSCMSource(String repoOwner, String repository, String repositoryUrl, boolean configuredByUrl) Constructor, defaults toGITHUB_URLas the end-point, and anonymous access, does not default anySCMSourceTraitbehaviours.GitHubSCMSource(String id, String apiUri, String checkoutCredentialsId, String scanCredentialsId, String repoOwner, String repository) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoidbuild(jenkins.scm.api.SCMHead head, jenkins.scm.api.SCMRevision revision) booleancheckObserverIncludesType(jenkins.scm.api.SCMHeadObserver observer, Class t) Simple method to iterate a set ofSCMHeadObserver.getIncludes()branches/tags/pr that will be possible observed and to check if at least one element is an instance of a provided class.protected jenkins.scm.api.SCMProbecreateProbe(jenkins.scm.api.SCMHead head, jenkins.scm.api.SCMRevision revision) Returns the GitHub API end-point.booleanDeprecated.booleanDeprecated.booleanDeprecated.booleanDeprecated.booleanDeprecated.booleanDeprecated.static intReturns how many megabytes of on-disk cache to maintain per GitHub API URL per credentials.Deprecated.Gets the credentials used to access the GitHub REST API (also used as the default credentials for checking out sources.static intReturns how long to delay events received from GitHub in order to allow the API caches to sync.Gets the repository owner.Gets the repository name.Gets the repository URL as specified by the user.Deprecated.List<jenkins.scm.api.trait.SCMSourceTrait>jenkins.scm.api.SCMRevisiongetTrustedRevision(jenkins.scm.api.SCMRevision revision, TaskListener listener) Deprecated.protected booleanisCategoryEnabled(jenkins.scm.api.SCMHeadCategory category) booleanprotected jenkins.scm.api.SCMRevisionretrieve(String headName, TaskListener listener, Item retrieveContext) protected jenkins.scm.api.SCMRevisionretrieve(jenkins.scm.api.SCMHead head, TaskListener listener) protected final voidretrieve(jenkins.scm.api.SCMSourceCriteria criteria, jenkins.scm.api.SCMHeadObserver observer, jenkins.scm.api.SCMHeadEvent<?> event, TaskListener listener) retrieveActions(jenkins.scm.api.SCMHead head, jenkins.scm.api.SCMHeadEvent event, TaskListener listener) retrieveActions(jenkins.scm.api.SCMSourceEvent event, TaskListener listener) retrieveRevisions(TaskListener listener, Item retrieveContext) voidSets the GitHub API end-point.voidsetBuildForkPRHead(boolean buildForkPRHead) Deprecated.voidsetBuildForkPRMerge(boolean buildForkPRMerge) Deprecated.voidsetBuildOriginBranch(boolean buildOriginBranch) Deprecated.voidsetBuildOriginBranchWithPR(boolean buildOriginBranchWithPR) Deprecated.voidsetBuildOriginPRHead(boolean buildOriginPRHead) Deprecated.voidsetBuildOriginPRMerge(boolean buildOriginPRMerge) Deprecated.static voidsetCacheSize(int cacheSize) Sets how long to delay events received from GitHub in order to allow the API caches to sync.voidsetCredentialsId(String credentialsId) Sets the credentials used to access the GitHub REST API (also used as the default credentials for checking out sources.static voidsetEventDelaySeconds(int eventDelaySeconds) Sets how long to delay events received from GitHub in order to allow the API caches to sync.voidsetExcludes(String excludes) Deprecated.voidsetIncludes(String includes) Deprecated.voidsetScanCredentialsId(String credentialsId) Deprecated.voidSets the behaviours that are applied to thisGitHubSCMSource.booleanshouldRetrieve(jenkins.scm.api.SCMHeadObserver observer, jenkins.scm.api.SCMHeadEvent<?> event, Class t) Method to verify if the conditions to retrieve information regarding a SCMHead class are met.Methods inherited from class jenkins.plugins.git.AbstractGitSCMSource
decorate, getBrowser, getCacheDir, getCacheDir, getCacheEntry, getCacheLock, getCredentials, getExcludes, getExtensions, getGitTool, getIncludes, getRefSpecs, getRemoteConfigs, getRemoteName, isExcluded, isFIPSCompliantTLS, newBuilder, resolveGitTool, resolveGitTool, resolveGitToolMethods inherited from class jenkins.scm.api.SCMSource
build, canProbe, checkInterrupt, defaultListener, equals, fetch, fetch, fetch, fetch, fetch, fetch, fetch, fetch, fetchActions, fetchActions, fetchActions, fetchRevisions, fetchRevisions, fromSCMFileSystem, getCategories, getCriteria, getDescriptor, getId, getOwner, hashCode, hasId, newProbe, parentHeads, parentRevisions, retrieve, retrieve, retrieve, retrieve, retrieve, retrieveActions, retrieveRevisions, setId, setOwner, toString, withId
-
Field Details
-
VALID_GITHUB_REPO_NAME
- See Also:
-
VALID_GITHUB_USER_NAME
- See Also:
-
VALID_GIT_SHA1
- See Also:
-
GITHUB_URL
- See Also:
-
GITHUB_COM
- See Also:
-
-
Constructor Details
-
GitHubSCMSource
@DataBoundConstructor public GitHubSCMSource(String repoOwner, String repository, String repositoryUrl, boolean configuredByUrl) Constructor, defaults toGITHUB_URLas the end-point, and anonymous access, does not default anySCMSourceTraitbehaviours.- Parameters:
repoOwner- the repository owner.repository- the repository name.repositoryUrl- HTML URL for the repository. If specified, takes precedence over repoOwner and repository.configuredByUrl- Whether to use repositoryUrl or repoOwner/repository for configuration.- Throws:
IllegalArgumentException- if repositoryUrl is specified but invalid.- Since:
- 2.2.0
-
GitHubSCMSource
Deprecated.Legacy constructor.- Parameters:
repoOwner- the repository owner.repository- the repository name.- Since:
- 2.2.0
-
GitHubSCMSource
@Deprecated public GitHubSCMSource(@CheckForNull String id, @CheckForNull String apiUri, @NonNull String checkoutCredentialsId, @CheckForNull String scanCredentialsId, @NonNull String repoOwner, @NonNull String repository) Deprecated.Legacy constructor.- Parameters:
id- the source id.apiUri- the GitHub endpoint.checkoutCredentialsId- the checkout credentials id orGitHubSCMSource.DescriptorImpl.SAMEorGitHubSCMSource.DescriptorImpl.ANONYMOUS.scanCredentialsId- the scan credentials id ornull.repoOwner- the repository owner.repository- the repository name.
-
-
Method Details
-
isConfiguredByUrl
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public boolean isConfiguredByUrl() -
getApiUri
Returns the GitHub API end-point.- Returns:
- the GitHub API end-point.
-
setApiUri
Sets the GitHub API end-point.- Parameters:
apiUri- the GitHub API end-point ornullifGITHUB_URL.- Since:
- 2.2.0
-
getCredentialsId
Gets the credentials used to access the GitHub REST API (also used as the default credentials for checking out sources.- Specified by:
getCredentialsIdin classjenkins.plugins.git.AbstractGitSCMSource- Returns:
- the credentials used to access the GitHub REST API or
nullto access anonymously
-
setCredentialsId
Sets the credentials used to access the GitHub REST API (also used as the default credentials for checking out sources.- Parameters:
credentialsId- the credentials used to access the GitHub REST API ornullto access anonymously- Since:
- 2.2.0
-
getRepoOwner
Gets the repository owner.- Returns:
- the repository owner.
-
getRepository
Gets the repository name.- Returns:
- the repository name.
-
getRepositoryUrl
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @NonNull public String getRepositoryUrl()Gets the repository URL as specified by the user.- Returns:
- the repository URL as specified by the user.
-
getTraits
- Overrides:
getTraitsin classjenkins.plugins.git.AbstractGitSCMSource- Since:
- 2.2.0
-
setTraits
@DataBoundSetter public void setTraits(@CheckForNull List<jenkins.scm.api.trait.SCMSourceTrait> traits) Sets the behaviours that are applied to thisGitHubSCMSource.- Overrides:
setTraitsin classjenkins.scm.api.SCMSource- Parameters:
traits- the behaviours that are to be applied.
-
getEventDelaySeconds
public static int getEventDelaySeconds()Returns how long to delay events received from GitHub in order to allow the API caches to sync.- Returns:
- how long to delay events received from GitHub in order to allow the API caches to sync.
-
setEventDelaySeconds
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static void setEventDelaySeconds(int eventDelaySeconds) Sets how long to delay events received from GitHub in order to allow the API caches to sync.- Parameters:
eventDelaySeconds- number of seconds to delay, will be restricted into a value within the range[0,300]inclusive
-
getCacheSize
public static int getCacheSize()Returns how many megabytes of on-disk cache to maintain per GitHub API URL per credentials.- Returns:
- how many megabytes of on-disk cache to maintain per GitHub API URL per credentials.
-
setCacheSize
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static void setCacheSize(int cacheSize) Sets how long to delay events received from GitHub in order to allow the API caches to sync.- Parameters:
cacheSize- how many megabytes of on-disk cache to maintain per GitHub API URL per credentials, will be restricted into a value within the range[0,1024]inclusive.
-
getRemote
- Specified by:
getRemotein classjenkins.plugins.git.AbstractGitSCMSource
-
getPronoun
- Overrides:
getPronounin classjenkins.scm.api.SCMSource
-
getUriResolver
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @RestrictedSince("2.2.0") public RepositoryUriResolver getUriResolver()Deprecated.Returns aRepositoryUriResolveraccording to credentials configuration.- Returns:
- a
RepositoryUriResolver
-
getScanCredentialsId
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @RestrictedSince("2.2.0") @Deprecated @CheckForNull public String getScanCredentialsId()Deprecated. -
setScanCredentialsId
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @RestrictedSince("2.2.0") @Deprecated public void setScanCredentialsId(@CheckForNull String credentialsId) Deprecated. -
getCheckoutCredentialsId
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @RestrictedSince("2.2.0") @Deprecated @CheckForNull public String getCheckoutCredentialsId()Deprecated. -
setIncludes
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @RestrictedSince("2.2.0") @DataBoundSetter public void setIncludes(@NonNull String includes) Deprecated. -
setExcludes
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @RestrictedSince("2.2.0") @DataBoundSetter public void setExcludes(@NonNull String excludes) Deprecated. -
getBuildOriginBranch
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @RestrictedSince("2.2.0") public boolean getBuildOriginBranch()Deprecated. -
setBuildOriginBranch
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @RestrictedSince("2.2.0") @DataBoundSetter public void setBuildOriginBranch(boolean buildOriginBranch) Deprecated. -
getBuildOriginBranchWithPR
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @RestrictedSince("2.2.0") public boolean getBuildOriginBranchWithPR()Deprecated. -
setBuildOriginBranchWithPR
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @RestrictedSince("2.2.0") @DataBoundSetter public void setBuildOriginBranchWithPR(boolean buildOriginBranchWithPR) Deprecated. -
getBuildOriginPRMerge
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @RestrictedSince("2.2.0") public boolean getBuildOriginPRMerge()Deprecated. -
setBuildOriginPRMerge
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @RestrictedSince("2.2.0") @DataBoundSetter public void setBuildOriginPRMerge(boolean buildOriginPRMerge) Deprecated. -
getBuildOriginPRHead
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @RestrictedSince("2.2.0") public boolean getBuildOriginPRHead()Deprecated. -
setBuildOriginPRHead
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @RestrictedSince("2.2.0") @DataBoundSetter public void setBuildOriginPRHead(boolean buildOriginPRHead) Deprecated. -
getBuildForkPRMerge
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @RestrictedSince("2.2.0") public boolean getBuildForkPRMerge()Deprecated. -
setBuildForkPRMerge
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @RestrictedSince("2.2.0") @DataBoundSetter public void setBuildForkPRMerge(boolean buildForkPRMerge) Deprecated. -
getBuildForkPRHead
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @RestrictedSince("2.2.0") public boolean getBuildForkPRHead()Deprecated. -
setBuildForkPRHead
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @RestrictedSince("2.2.0") @DataBoundSetter public void setBuildForkPRHead(boolean buildForkPRHead) Deprecated. -
checkObserverIncludesType
public boolean checkObserverIncludesType(@NonNull jenkins.scm.api.SCMHeadObserver observer, @NonNull Class t) Simple method to iterate a set ofSCMHeadObserver.getIncludes()branches/tags/pr that will be possible observed and to check if at least one element is an instance of a provided class.- Parameters:
observer-SCMHeadObserverwith an include list that are possible going to be observed.t- Class type to compare the set elements to.- Returns:
- true if the observer includes list contains at least one element with the provided class type.
-
shouldRetrieve
public boolean shouldRetrieve(@NonNull jenkins.scm.api.SCMHeadObserver observer, @CheckForNull jenkins.scm.api.SCMHeadEvent<?> event, @NonNull Class t) Method to verify if the conditions to retrieve information regarding a SCMHead class are met.- Parameters:
observer-SCMHeadObserverwith the events to be observed.event-SCMHeadEventwith the event triggered.t- Class type of analyzed SCMHead.- Returns:
- true if a retrieve should be executed form a given SCMHead Class.
-
retrieve
protected final 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 - Overrides:
retrievein classjenkins.plugins.git.AbstractGitSCMSource- Throws:
IOExceptionInterruptedException
-
retrieveRevisions
@NonNull protected Set<String> retrieveRevisions(@NonNull TaskListener listener, Item retrieveContext) throws IOException, InterruptedException - Overrides:
retrieveRevisionsin classjenkins.plugins.git.AbstractGitSCMSource- Throws:
IOExceptionInterruptedException
-
retrieve
protected jenkins.scm.api.SCMRevision retrieve(@NonNull String headName, @NonNull TaskListener listener, Item retrieveContext) throws IOException, InterruptedException - Overrides:
retrievein classjenkins.plugins.git.AbstractGitSCMSource- Throws:
IOExceptionInterruptedException
-
createProbe
@NonNull protected jenkins.scm.api.SCMProbe createProbe(@NonNull jenkins.scm.api.SCMHead head, @CheckForNull jenkins.scm.api.SCMRevision revision) throws IOException - Overrides:
createProbein classjenkins.scm.api.SCMSource- Throws:
IOException
-
retrieve
@CheckForNull protected jenkins.scm.api.SCMRevision retrieve(jenkins.scm.api.SCMHead head, TaskListener listener) throws IOException, InterruptedException - Overrides:
retrievein classjenkins.plugins.git.AbstractGitSCMSource- Throws:
IOExceptionInterruptedException
-
build
- Overrides:
buildin classjenkins.plugins.git.AbstractGitSCMSource
-
getTrustedRevision
public jenkins.scm.api.SCMRevision getTrustedRevision(jenkins.scm.api.SCMRevision revision, TaskListener listener) throws IOException, InterruptedException - Overrides:
getTrustedRevisionin classjenkins.scm.api.SCMSource- Throws:
IOExceptionInterruptedException
-
isCategoryEnabled
protected boolean isCategoryEnabled(@NonNull jenkins.scm.api.SCMHeadCategory category) - Overrides:
isCategoryEnabledin classjenkins.plugins.git.AbstractGitSCMSource
-
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.plugins.git.AbstractGitSCMSource- Throws:
IOExceptionInterruptedException
-
retrieveActions
@NonNull protected List<Action> retrieveActions(@CheckForNull jenkins.scm.api.SCMSourceEvent event, @NonNull TaskListener listener) throws IOException - Overrides:
retrieveActionsin classjenkins.plugins.git.AbstractGitSCMSource- Throws:
IOException
-
afterSave
public void afterSave()- Overrides:
afterSavein classjenkins.scm.api.SCMSource
-
GitHubSCMBuilder.uriResolver()orGitHubSCMBuilder.uriResolver(Item, String, String).