Package com.atlassian.bamboo.plan.branch
Class BranchDetectionServiceImpl
- java.lang.Object
-
- com.atlassian.bamboo.plan.branch.BranchDetectionServiceImpl
-
- All Implemented Interfaces:
BranchDetectionService
public class BranchDetectionServiceImpl extends Object implements BranchDetectionService
-
-
Field Summary
Fields Modifier and Type Field Description static String
BANDANA_ENFORCE_POLLING
-
Constructor Summary
Constructors Constructor Description BranchDetectionServiceImpl(com.atlassian.bandana.BandanaManager bandanaManager, CachedPlanManager cachedPlanManager, CachedRepositoryDefinitionManager cachedRepositoryDefinitionManager, ChainBranchManager chainBranchManager, CustomVariableContext customVariableContext, ErrorHandler errorHandler, org.springframework.orm.hibernate5.HibernateTemplate hibernateTemplate, LightweightBranchCreationService lightweightBranchCreationService, RepositoryCachingFacade repositoryCachingFacade, ScopedExclusionService scopedExclusionService, VcsBranchManager vcsBranchManager, VcsRepositoryManager vcsRepositoryManager, PlanBranchPullRequestService planBranchPullRequestService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PlanKey
createChainBranch(@NotNull ImmutableChain chain, @NotNull String branchName, @Nullable VcsBranch vcsBranch, @Nullable BuildConfiguration buildConfiguration, PlanCreationService.EnablePlan enablePlan, boolean enableExpiry)
Temporary workaround for branchinator to work.void
detectBranchesForRepository(long repositoryId, boolean ignoreChainsConfig)
Immediately executes branch detection for a given repository and creates new plan branches for chains using this repository as default.@NotNull Optional<List<VcsBranch>>
getOpenBranches(@NotNull VariableSubstitutor variableSubstitutor, @NotNull VcsRepositoryData vcsRepositoryData, @NotNull VcsBranchDetector branchDetector, @Nullable ErrorCollection errorCollection, @NotNull Iterable<ImmutableChain> chains)
Returns a list of currently open branches for given repository.boolean
scheduleBranchDetectionForRepository(long repositoryId)
Schedules branch detection for given repositoryboolean
scheduleBranchListInitialisation(@NotNull Chain chain)
Schedules initialisation of existing vcs branch list.
-
-
-
Field Detail
-
BANDANA_ENFORCE_POLLING
public static final String BANDANA_ENFORCE_POLLING
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BranchDetectionServiceImpl
public BranchDetectionServiceImpl(com.atlassian.bandana.BandanaManager bandanaManager, CachedPlanManager cachedPlanManager, CachedRepositoryDefinitionManager cachedRepositoryDefinitionManager, ChainBranchManager chainBranchManager, CustomVariableContext customVariableContext, ErrorHandler errorHandler, org.springframework.orm.hibernate5.HibernateTemplate hibernateTemplate, LightweightBranchCreationService lightweightBranchCreationService, RepositoryCachingFacade repositoryCachingFacade, ScopedExclusionService scopedExclusionService, VcsBranchManager vcsBranchManager, VcsRepositoryManager vcsRepositoryManager, PlanBranchPullRequestService planBranchPullRequestService)
-
-
Method Detail
-
createChainBranch
public PlanKey createChainBranch(@NotNull @NotNull ImmutableChain chain, @NotNull @NotNull String branchName, @Nullable @Nullable VcsBranch vcsBranch, @Nullable @Nullable BuildConfiguration buildConfiguration, @NotNull PlanCreationService.EnablePlan enablePlan, boolean enableExpiry) throws PlanCreationDeniedException
Description copied from interface:BranchDetectionService
Temporary workaround for branchinator to work. Don't use! TODO jmajkutewicz BDEV-15595: remove after branchinator is adapted to new api- Specified by:
createChainBranch
in interfaceBranchDetectionService
- Throws:
PlanCreationDeniedException
-
scheduleBranchListInitialisation
public boolean scheduleBranchListInitialisation(@NotNull @NotNull Chain chain)
Description copied from interface:BranchDetectionService
Schedules initialisation of existing vcs branch list. The next branch detection for the chain will only seek for existing branches but will not create any ChainBranches.- Specified by:
scheduleBranchListInitialisation
in interfaceBranchDetectionService
- Parameters:
chain
- chain which vcs branches list should be initialized- Returns:
- false if another detection for this chain is already in progress or in queue
-
scheduleBranchDetectionForRepository
public boolean scheduleBranchDetectionForRepository(long repositoryId)
Description copied from interface:BranchDetectionService
Schedules branch detection for given repository- Specified by:
scheduleBranchDetectionForRepository
in interfaceBranchDetectionService
-
detectBranchesForRepository
public void detectBranchesForRepository(long repositoryId, boolean ignoreChainsConfig)
Description copied from interface:BranchDetectionService
Immediately executes branch detection for a given repository and creates new plan branches for chains using this repository as default. This method blocks until the detection is finished.- Specified by:
detectBranchesForRepository
in interfaceBranchDetectionService
- Parameters:
repositoryId
- id of the repositoryignoreChainsConfig
- allows to force branch creation and cleanup for all related chains. If true branch detection will be executed even if a chain is not configured to automatically manage branches.
-
getOpenBranches
@NotNull public @NotNull Optional<List<VcsBranch>> getOpenBranches(@NotNull @NotNull VariableSubstitutor variableSubstitutor, @NotNull @NotNull VcsRepositoryData vcsRepositoryData, @NotNull @NotNull VcsBranchDetector branchDetector, @Nullable @Nullable ErrorCollection errorCollection, @NotNull @NotNull Iterable<ImmutableChain> chains)
Description copied from interface:BranchDetectionService
Returns a list of currently open branches for given repository. List ordering determined by underlying repository (preference is for native ordering e.g. last updated first for hg)- Specified by:
getOpenBranches
in interfaceBranchDetectionService
- Parameters:
variableSubstitutor
- variable substitutor to use for substituting repository configurationvcsRepositoryData
- the repositorybranchDetector
- executor responsible for branch detectionerrorCollection
- errors collection to add errors tochains
- list of chains against which errors will be recorded- Returns:
- list of branches open in VCS or nothing if there's been an error fetching branches
-
-