Class ActiveGitBranchesParameterDefinition

java.lang.Object
hudson.model.ParameterDefinition
io.jenkins.plugins.activegitbranches.ActiveGitBranchesParameterDefinition
All Implemented Interfaces:
ExtensionPoint, Describable<ParameterDefinition>, Serializable

public class ActiveGitBranchesParameterDefinition extends ParameterDefinition
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:
  • Constructor Details

    • ActiveGitBranchesParameterDefinition

      @DataBoundConstructor public ActiveGitBranchesParameterDefinition(String name, String repositoryUrl, int maxBranchCount, String description)
  • Method Details

    • getRepositoryUrl

      public String getRepositoryUrl()
    • getCredentialsId

      public String getCredentialsId()
    • setCredentialsId

      @DataBoundSetter public void setCredentialsId(String credentialsId)
    • getMaxBranchCount

      public int getMaxBranchCount()
    • getBranchFilter

      public String getBranchFilter()
    • setBranchFilter

      @DataBoundSetter public void setBranchFilter(String branchFilter)
    • getAlwaysIncludeBranches

      public String getAlwaysIncludeBranches()
    • setAlwaysIncludeBranches

      @DataBoundSetter public void setAlwaysIncludeBranches(String alwaysIncludeBranches)
    • getExcludeBranches

      public String getExcludeBranches()
    • setExcludeBranches

      @DataBoundSetter public void setExcludeBranches(String excludeBranches)
    • getDefaultValue

      public String getDefaultValue()
    • setDefaultValue

      @DataBoundSetter public void setDefaultValue(String defaultValue)
    • 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:
      createValue in class ParameterDefinition
    • createValue

      public ParameterValue createValue(org.kohsuke.stapler.StaplerRequest2 req)
      Overrides:
      createValue in class ParameterDefinition
    • getDefaultParameterValue

      public ParameterValue getDefaultParameterValue()
      Overrides:
      getDefaultParameterValue in class ParameterDefinition
    • getEffectiveDefaultValue

      public String 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.
      Background refresh failures keep the existing cached snapshot intact and only flip lastRefreshFailed so the UI can warn the user.
    • getCacheFetchedAgoText

      public String getCacheFetchedAgoText()
      Human-readable age of the cached branch list (e.g. "5 seconds ago", "2 minutes ago"), or null if 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

      public boolean matchesExcludeBranches(String branchName)