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 classes/interfaces inherited from class jenkins.plugins.git.AbstractGitSCMSource
jenkins.plugins.git.AbstractGitSCMSource.SCMRevisionImpl, jenkins.plugins.git.AbstractGitSCMSource.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
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
Fields inherited from class jenkins.plugins.git.AbstractGitSCMSource
DEFAULT_REMOTE_NAME, REF_SPEC_DEFAULT, REF_SPEC_REMOTE_NAME_PLACEHOLDER, REF_SPEC_REMOTE_NAME_PLACEHOLDER_STR
Fields inherited from class jenkins.scm.api.SCMSource
PRONOUN
-
Constructor Summary
ConstructorDescriptionGitHubSCMSource
(String repoOwner, String repository) Deprecated.GitHubSCMSource
(String repoOwner, String repository, String repositoryUrl, boolean configuredByUrl) Constructor, defaults toGITHUB_URL
as the end-point, and anonymous access, does not default anySCMSourceTrait
behaviours.GitHubSCMSource
(String id, String apiUri, String checkoutCredentialsId, String scanCredentialsId, String repoOwner, String repository) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoid
build
(jenkins.scm.api.SCMHead head, jenkins.scm.api.SCMRevision revision) boolean
checkObserverIncludesType
(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.SCMProbe
createProbe
(jenkins.scm.api.SCMHead head, jenkins.scm.api.SCMRevision revision) Returns the GitHub API end-point.boolean
Deprecated.boolean
Deprecated.boolean
Deprecated.boolean
Deprecated.boolean
Deprecated.boolean
Deprecated.static int
Returns 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 int
Returns 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.SCMRevision
getTrustedRevision
(jenkins.scm.api.SCMRevision revision, TaskListener listener) Deprecated.protected boolean
isCategoryEnabled
(jenkins.scm.api.SCMHeadCategory category) boolean
protected jenkins.scm.api.SCMRevision
retrieve
(String headName, TaskListener listener, Item retrieveContext) protected jenkins.scm.api.SCMRevision
retrieve
(jenkins.scm.api.SCMHead head, TaskListener listener) protected final void
retrieve
(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) void
Sets the GitHub API end-point.void
setBuildForkPRHead
(boolean buildForkPRHead) Deprecated.void
setBuildForkPRMerge
(boolean buildForkPRMerge) Deprecated.void
setBuildOriginBranch
(boolean buildOriginBranch) Deprecated.void
setBuildOriginBranchWithPR
(boolean buildOriginBranchWithPR) Deprecated.void
setBuildOriginPRHead
(boolean buildOriginPRHead) Deprecated.void
setBuildOriginPRMerge
(boolean buildOriginPRMerge) Deprecated.static void
setCacheSize
(int cacheSize) Sets how long to delay events received from GitHub in order to allow the API caches to sync.void
setCredentialsId
(String credentialsId) Sets the credentials used to access the GitHub REST API (also used as the default credentials for checking out sources.static void
setEventDelaySeconds
(int eventDelaySeconds) Sets how long to delay events received from GitHub in order to allow the API caches to sync.void
setExcludes
(String excludes) Deprecated.void
setIncludes
(String includes) Deprecated.void
setScanCredentialsId
(String credentialsId) Deprecated.void
Sets the behaviours that are applied to thisGitHubSCMSource
.boolean
shouldRetrieve
(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, newBuilder, resolveGitTool, resolveGitTool, resolveGitTool
Methods 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_URL
as the end-point, and anonymous access, does not default anySCMSourceTrait
behaviours.- 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.SAME
orGitHubSCMSource.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 ornull
ifGITHUB_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:
getCredentialsId
in classjenkins.plugins.git.AbstractGitSCMSource
- Returns:
- the credentials used to access the GitHub REST API or
null
to 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 ornull
to 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:
getTraits
in 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:
setTraits
in 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:
getRemote
in classjenkins.plugins.git.AbstractGitSCMSource
-
getPronoun
- Overrides:
getPronoun
in classjenkins.scm.api.SCMSource
-
getUriResolver
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @RestrictedSince("2.2.0") public RepositoryUriResolver getUriResolver()Deprecated.Returns aRepositoryUriResolver
according 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
-SCMHeadObserver
with 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
-SCMHeadObserver
with the events to be observed.event
-SCMHeadEvent
with 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:
retrieve
in classjenkins.plugins.git.AbstractGitSCMSource
- Throws:
IOException
InterruptedException
-
retrieveRevisions
@NonNull protected Set<String> retrieveRevisions(@NonNull TaskListener listener, Item retrieveContext) throws IOException, InterruptedException - Overrides:
retrieveRevisions
in classjenkins.plugins.git.AbstractGitSCMSource
- Throws:
IOException
InterruptedException
-
retrieve
protected jenkins.scm.api.SCMRevision retrieve(@NonNull String headName, @NonNull TaskListener listener, Item retrieveContext) throws IOException, InterruptedException - Overrides:
retrieve
in classjenkins.plugins.git.AbstractGitSCMSource
- Throws:
IOException
InterruptedException
-
createProbe
@NonNull protected jenkins.scm.api.SCMProbe createProbe(@NonNull jenkins.scm.api.SCMHead head, @CheckForNull jenkins.scm.api.SCMRevision revision) throws IOException - Overrides:
createProbe
in 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:
retrieve
in classjenkins.plugins.git.AbstractGitSCMSource
- Throws:
IOException
InterruptedException
-
build
- Overrides:
build
in classjenkins.plugins.git.AbstractGitSCMSource
-
getTrustedRevision
public jenkins.scm.api.SCMRevision getTrustedRevision(jenkins.scm.api.SCMRevision revision, TaskListener listener) throws IOException, InterruptedException - Overrides:
getTrustedRevision
in classjenkins.scm.api.SCMSource
- Throws:
IOException
InterruptedException
-
isCategoryEnabled
protected boolean isCategoryEnabled(@NonNull jenkins.scm.api.SCMHeadCategory category) - Overrides:
isCategoryEnabled
in 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:
retrieveActions
in classjenkins.plugins.git.AbstractGitSCMSource
- Throws:
IOException
InterruptedException
-
retrieveActions
@NonNull protected List<Action> retrieveActions(@CheckForNull jenkins.scm.api.SCMSourceEvent event, @NonNull TaskListener listener) throws IOException - Overrides:
retrieveActions
in classjenkins.plugins.git.AbstractGitSCMSource
- Throws:
IOException
-
afterSave
public void afterSave()- Overrides:
afterSave
in classjenkins.scm.api.SCMSource
-
GitHubSCMBuilder.uriResolver()
orGitHubSCMBuilder.uriResolver(Item, String, String)
.