Class ActiveGitBranchesParameterDefinition
java.lang.Object
hudson.model.ParameterDefinition
io.jenkins.plugins.activegitbranches.ActiveGitBranchesParameterDefinition
- All Implemented Interfaces:
ExtensionPoint,Describable<ParameterDefinition>,Serializable
Active Git Branches Parameter Definition.
This parameter plugin dynamically fetches Git branches from a remote repository,
sorts them by commit date (descending), and limits the display to the top N branches.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBranch information holder.static classNested classes/interfaces inherited from class hudson.model.ParameterDefinition
ParameterDefinition.ParameterDescriptorNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Field Summary
Fields inherited from class hudson.model.ParameterDefinition
LIST -
Constructor Summary
ConstructorsConstructorDescriptionActiveGitBranchesParameterDefinition(String name, String repositoryUrl, int maxBranchCount, String description) -
Method Summary
Modifier and TypeMethodDescriptioncreateValue(org.kohsuke.stapler.StaplerRequest2 req) createValue(org.kohsuke.stapler.StaplerRequest2 req, net.sf.json.JSONObject jo) Returns the branch list shown to the user, filtered and limited according to this parameter's configuration.Human-readable age of the cached branch list (e.g.Resolves the effective default branch name to be pre-selected in the UI.intbooleanbooleanWhether the most recent background refresh failed; used by the Jelly view to show a small warning next to the freshness hint.booleanbooleanmatchesExcludeBranches(String branchName) voidsetAllowCustomBranch(boolean allowCustomBranch) voidsetAlwaysIncludeBranches(String alwaysIncludeBranches) voidsetBranchFilter(String branchFilter) voidsetCredentialsId(String credentialsId) voidsetDefaultValue(String defaultValue) voidsetExcludeBranches(String excludeBranches) voidsetUseQuickFetch(boolean useQuickFetch) Methods inherited from class hudson.model.ParameterDefinition
all, copyWithDefaultValue, createValue, createValue, createValue, equals, getDescription, getDescriptor, getFormattedDescription, getName, getType, hashCode, isValid, setDescription
-
Constructor Details
-
ActiveGitBranchesParameterDefinition
-
-
Method Details
-
getRepositoryUrl
-
getCredentialsId
-
setCredentialsId
-
getMaxBranchCount
public int getMaxBranchCount() -
getBranchFilter
-
setBranchFilter
-
getAlwaysIncludeBranches
-
setAlwaysIncludeBranches
-
getExcludeBranches
-
setExcludeBranches
-
getDefaultValue
-
setDefaultValue
-
isUseQuickFetch
public boolean isUseQuickFetch() -
setUseQuickFetch
@DataBoundSetter public void setUseQuickFetch(boolean useQuickFetch) -
isAllowCustomBranch
public boolean isAllowCustomBranch() -
setAllowCustomBranch
@DataBoundSetter public void setAllowCustomBranch(boolean allowCustomBranch) -
createValue
public ParameterValue createValue(org.kohsuke.stapler.StaplerRequest2 req, net.sf.json.JSONObject jo) - Overrides:
createValuein classParameterDefinition
-
createValue
- Overrides:
createValuein classParameterDefinition
-
getDefaultParameterValue
- Overrides:
getDefaultParameterValuein classParameterDefinition
-
getEffectiveDefaultValue
Resolves the effective default branch name to be pre-selected in the UI. Skips any excluded/disabled branch and falls back to the first available active branch. -
fetchBranches
Returns the branch list shown to the user, filtered and limited according to this parameter's configuration. Uses a stale-while-revalidate cache:- Cache hit: return the cached snapshot immediately; if it is
older than
REFRESH_INTERVAL_SECONDS, reload it in the background so subsequent calls see fresher data. - Cache miss (cold start / first call after restart): fetch synchronously; on failure return an empty list and leave the cache empty so the next call retries.
lastRefreshFailedso the UI can warn the user. - Cache hit: return the cached snapshot immediately; if it is
older than
-
getCacheFetchedAgoText
Human-readable age of the cached branch list (e.g. "5 seconds ago", "2 minutes ago"), ornullif the cache is empty. Exposed for the Jelly view to render a "fetched X ago" hint under the dropdown. -
isLastRefreshFailed
public boolean isLastRefreshFailed()Whether the most recent background refresh failed; used by the Jelly view to show a small warning next to the freshness hint. -
matchesExcludeBranches
-