Package com.atlassian.bamboo.plan
Class PlanExecutionManagerImpl
java.lang.Object
com.atlassian.bamboo.plan.PlanExecutionManagerImpl
- All Implemented Interfaces:
ExecutionStatusProvider,PlanExecutionManager
We have 3 (yes, three) ways to handle
BuildDetectionAction, it all depends which interface is implemented:
UnconditionalBuildDetectionAction- meaning: if this action is created we know we want to start a build. (example: scheduled build, dependant build...)DelayedChangeDetectionAction- special case of 1) with added feature of calling thread not being blocked by change detection (manual builds, restarted builds...)ConditionalBuildDetectionAction- we don't know a priori if we want to start a build (trigger by vcs change)
-
inChangeDetectionLock { inBuildCountLock { checkIfCountNotExceeded createResultWithoutChanges } doChangeDetection } -
inBuildCountLock { checkIfCountNotExceeded createResultWithoutChanges; inNewThread { inChangeDetectionLock { doChangeDetection } } } -
inChangeDetectionLock { inBuildCountLock { checkIfCountNotExceeded } doChangeDetection inBuildCountLock { checkIfCountNotExceeded createResultWithChanges } }
-
Constructor Summary
ConstructorsConstructorDescriptionPlanExecutionManagerImpl(BuildExecutionManager buildExecutionManager, PlanExecutionPermitter planExecutionPermitter, ExecutionStatusProvider executionStatusProvider, CachedPlanManager cachedPlanManager, StopBuildManager stopBuildManager, TriggerManager triggerManager, PlanExecutionLockService planExecutionLockService, com.atlassian.event.api.EventPublisher eventPublisher, ErrorHandler errorHandler, DeploymentPermitter deploymentPermitter, com.atlassian.bamboo.plan.PlanExecutionManagerCallWatcher planExecutionManagerCallWatcher) -
Method Summary
Modifier and TypeMethodDescription@NotNull List<CurrentlyBuilding>getCurrentlyBuildingForPlan(PlanKey planKey) @NotNull List<CurrentlyBuilding>getCurrentlyBuildingForPlanResult(PlanResultKey planResultKey) Returns allCurrentlyBuildingfor specifiedPlanResultKeyIn case plan is aChaininstance, all currently running jobs will be returned, however, chain itself will be not included in the list (effectivelyCurrentlyBuildingfor all chain's children jobs will be returned)@NotNull Collection<? extends ExecutionStatus>getExecutionStatus(@NotNull PlanKey planKey) Returns a collection of currentExecutionStatuss forPlanKey@Nullable ExecutionStatusgetExecutionStatus(@NotNull PlanResultKey planResultKey) Returns aExecutionStatusfor the givenPlanResultKeygetJobExecution(@NotNull PlanResultKey planResultKey) Get the state of a single Job being executedbooleanisBuildingAllowed(@NotNull ImmutableChain chain) Checks if a particular build is allowed to be built.booleanisBusy()booleanintnumberOfExecutions(@NotNull PlanKey planKey) Returns the number of currentExecutionStatuss available forPlanKeyshutdown()start(@NotNull ImmutableChain chain, @NotNull BuildDetectionAction buildDetectionAction, @NotNull AcquisitionPolicy acquisitionPolicy) @NotNull ExecutionRequestResultstart(@NotNull ImmutableChain chain, @NotNull BuildDetectionAction buildDetectionAction, @NotNull AcquisitionPolicy acquisitionPolicy, PlanExecutionLaunchControl.ReleaseLocksActions releaseLocksActions) @NotNull ExecutionRequestResultstart(@NotNull ImmutableChain chain, @Nullable PlanExecutionConfig planExecutionConfig, @NotNull String triggerReasonPluginKey, @NotNull String planTriggerPluginKey, @NotNull Map<String, String> params, @NotNull Map<String, String> variables, @NotNull AcquisitionPolicy acquisitionPolicy) @NotNull ExecutionRequestResultstart(@NotNull Triggerable triggerable, @NotNull BuildDetectionAction buildDetectionAction, @NotNull AcquisitionPolicy acquisitionPolicy) @NotNull ExecutionRequestResultstart(@NotNull Triggerable triggerable, @NotNull BuildDetectionAction buildDetectionAction, @NotNull AcquisitionPolicy acquisitionPolicy, PlanExecutionLaunchControl.ReleaseLocksActions releaseLocksActions) @NotNull ExecutionRequestResultstartManualExecution(@NotNull ImmutableChain chain, @NotNull com.atlassian.user.User user, @NotNull Map<String, String> params, @NotNull Map<String, String> variables) Attempts to start a manual execution of the givenPlan@NotNull ExecutionRequestResultstartManualExecution(@NotNull ImmutableChain chain, @Nullable PlanExecutionConfig planExecutionConfig, @NotNull com.atlassian.user.User user, @NotNull String triggerReasonPluginKey, @Nullable String planTriggerPluginKey, @NotNull Map<String, String> params, @NotNull Map<String, String> variables) Attempts to start a manual execution of a givenPlancontrolled byPlanExecutionConfigPlanExecutionConfigallows to control manual stages execution as well as enforcing execution of manual stages@NotNull ExecutionRequestResultstartManualExecution(@NotNull ImmutableChain chain, @Nullable PlanExecutionConfig planExecutionConfig, @NotNull com.atlassian.user.User user, @NotNull Map<String, String> params, @NotNull Map<String, String> variables) Attempts to start a manual execution of a givenPlancontrolled byPlanExecutionConfigPlanExecutionConfigallows to control manual stages execution as well as enforcing execution of manual stagesvoidvoidstopPlan(@NotNull PlanResultKey planResultKey, boolean abandonResult, String userName) voidstopRequest(@NotNull PlanKey planKey) Stops a build requests for the givenPlanKey
-
Constructor Details
-
PlanExecutionManagerImpl
public PlanExecutionManagerImpl(BuildExecutionManager buildExecutionManager, PlanExecutionPermitter planExecutionPermitter, ExecutionStatusProvider executionStatusProvider, CachedPlanManager cachedPlanManager, StopBuildManager stopBuildManager, TriggerManager triggerManager, PlanExecutionLockService planExecutionLockService, com.atlassian.event.api.EventPublisher eventPublisher, ErrorHandler errorHandler, DeploymentPermitter deploymentPermitter, com.atlassian.bamboo.plan.PlanExecutionManagerCallWatcher planExecutionManagerCallWatcher)
-
-
Method Details
-
numberOfExecutions
Description copied from interface:ExecutionStatusProviderReturns the number of currentExecutionStatuss available forPlanKey- Specified by:
numberOfExecutionsin interfaceExecutionStatusProvider- Returns:
- noOfExecutions
-
getExecutionStatus
@NotNull public @NotNull Collection<? extends ExecutionStatus> getExecutionStatus(@NotNull @NotNull PlanKey planKey) Description copied from interface:ExecutionStatusProviderReturns a collection of currentExecutionStatuss forPlanKey- Specified by:
getExecutionStatusin interfaceExecutionStatusProvider- Returns:
- executionStatuses
-
getExecutionStatus
@Nullable public @Nullable ExecutionStatus getExecutionStatus(@NotNull @NotNull PlanResultKey planResultKey) Description copied from interface:ExecutionStatusProviderReturns aExecutionStatusfor the givenPlanResultKey- Specified by:
getExecutionStatusin interfaceExecutionStatusProvider- Returns:
- executionStatus
-
getJobExecution
Description copied from interface:ExecutionStatusProviderGet the state of a single Job being executed- Specified by:
getJobExecutionin interfaceExecutionStatusProvider- Returns:
-
startManualExecution
@NotNull public @NotNull ExecutionRequestResult startManualExecution(@NotNull @NotNull ImmutableChain chain, @NotNull @NotNull com.atlassian.user.User user, @NotNull @NotNull Map<String, String> params, @NotNull @NotNull Map<String, String> variables) Description copied from interface:PlanExecutionManagerAttempts to start a manual execution of the givenPlan- Specified by:
startManualExecutionin interfacePlanExecutionManagerparams- - additional execution parameters set in code to parametrized build - not exposed to uservariables- - user defined variables that could be parametrized in manual execution - contain only values changed by user in UI- Returns:
- executionRequestResult
-
startManualExecution
@NotNull public @NotNull ExecutionRequestResult startManualExecution(@NotNull @NotNull ImmutableChain chain, @Nullable @Nullable PlanExecutionConfig planExecutionConfig, @NotNull @NotNull com.atlassian.user.User user, @NotNull @NotNull Map<String, String> params, @NotNull @NotNull Map<String, String> variables) Description copied from interface:PlanExecutionManagerAttempts to start a manual execution of a givenPlancontrolled byPlanExecutionConfigPlanExecutionConfigallows to control manual stages execution as well as enforcing execution of manual stages- Specified by:
startManualExecutionin interfacePlanExecutionManager- Returns:
-
startManualExecution
@NotNull public @NotNull ExecutionRequestResult startManualExecution(@NotNull @NotNull ImmutableChain chain, @Nullable @Nullable PlanExecutionConfig planExecutionConfig, @NotNull @NotNull com.atlassian.user.User user, @NotNull @NotNull String triggerReasonPluginKey, @Nullable @Nullable String planTriggerPluginKey, @NotNull @NotNull Map<String, String> params, @NotNull @NotNull Map<String, String> variables) Description copied from interface:PlanExecutionManagerAttempts to start a manual execution of a givenPlancontrolled byPlanExecutionConfigPlanExecutionConfigallows to control manual stages execution as well as enforcing execution of manual stages- Specified by:
startManualExecutionin interfacePlanExecutionManager- Returns:
-
isBusy
Description copied from interface:PlanExecutionManager- Specified by:
isBusyin interfacePlanExecutionManager- Returns:
- busy
-
isBusy
public boolean isBusy()- Specified by:
isBusyin interfacePlanExecutionManager- Returns:
- if the server is busy building
-
start
@NotNull public @NotNull ExecutionRequestResult start(@NotNull @NotNull ImmutableChain chain, @Nullable @Nullable PlanExecutionConfig planExecutionConfig, @NotNull @NotNull String triggerReasonPluginKey, @NotNull @NotNull String planTriggerPluginKey, @NotNull @NotNull Map<String, String> params, @NotNull @NotNull Map<String, String> variables, @NotNull @NotNull AcquisitionPolicy acquisitionPolicy) Description copied from interface:PlanExecutionManager- Specified by:
startin interfacePlanExecutionManagerplanExecutionConfig- extended configuration for executiontriggerReasonPluginKey- full plugin key for aTriggerReasonplanTriggerPluginKey- full plugin key for aPlanTriggerparams- custom paramsvariables- overriden variablesacquisitionPolicy- to aquire the lock- Returns:
- planExecutionResult
-
start
public ExecutionRequestResult start(@NotNull @NotNull ImmutableChain chain, @NotNull @NotNull BuildDetectionAction buildDetectionAction, @NotNull @NotNull AcquisitionPolicy acquisitionPolicy) Description copied from interface:PlanExecutionManagerExecute theImmutableChainwith the providedBuildDetectionActionandAcquisitionPolicyCalls to this method will acquire a lock according to the
AcquisitionPolicyon a perPlangranularity- Specified by:
startin interfacePlanExecutionManager- Returns:
- planExecutionResult
-
start
@NotNull public @NotNull ExecutionRequestResult start(@NotNull @NotNull ImmutableChain chain, @NotNull @NotNull BuildDetectionAction buildDetectionAction, @NotNull @NotNull AcquisitionPolicy acquisitionPolicy, @NotNull PlanExecutionLaunchControl.ReleaseLocksActions releaseLocksActions) Description copied from interface:PlanExecutionManagerExecute theImmutableChainwith the providedBuildDetectionActionandAcquisitionPolicyCalls to this method will acquire a lock according to the
AcquisitionPolicyon a perPlangranularity- Specified by:
startin interfacePlanExecutionManagerreleaseLocksActions- actions used for releasing repositories caches locks- Returns:
- planExecutionResult
-
start
@NotNull public @NotNull ExecutionRequestResult start(@NotNull @NotNull Triggerable triggerable, @NotNull @NotNull BuildDetectionAction buildDetectionAction, @NotNull @NotNull AcquisitionPolicy acquisitionPolicy) Description copied from interface:PlanExecutionManagerExecute theTriggerablewith the providedBuildDetectionActionandAcquisitionPolicyCalls to this method will acquire a lock according to the
AcquisitionPolicyon a perPlangranularity- Specified by:
startin interfacePlanExecutionManager- Returns:
- planExecutionResult
-
start
@NotNull public @NotNull ExecutionRequestResult start(@NotNull @NotNull Triggerable triggerable, @NotNull @NotNull BuildDetectionAction buildDetectionAction, @NotNull @NotNull AcquisitionPolicy acquisitionPolicy, @NotNull PlanExecutionLaunchControl.ReleaseLocksActions releaseLocksActions) Description copied from interface:PlanExecutionManagerExecute theTriggerablewith the providedBuildDetectionActionandAcquisitionPolicyCalls to this method will acquire a lock according to the
AcquisitionPolicyon a perPlangranularity- Specified by:
startin interfacePlanExecutionManagerreleaseLocksActions- actions used for releasing repositories caches locks- Returns:
- planExecutionResult
-
isBuildingAllowed
Description copied from interface:PlanExecutionManagerChecks if a particular build is allowed to be built. It checks if it exists, not suspened, and that there is no global flag that has stopped building- Specified by:
isBuildingAllowedin interfacePlanExecutionManager- Returns:
- true if plan is allowed to be built
-
getCurrentlyBuildingForPlan
Description copied from interface:PlanExecutionManagerReturns all for specifiedPlanKeyIn case plan is aChaininstance, all currently running jobs will be returned- Specified by:
getCurrentlyBuildingForPlanin interfacePlanExecutionManager- Returns:
-
getCurrentlyBuildingForPlanResult
@NotNull public @NotNull List<CurrentlyBuilding> getCurrentlyBuildingForPlanResult(PlanResultKey planResultKey) Description copied from interface:PlanExecutionManagerReturns allCurrentlyBuildingfor specifiedPlanResultKeyIn case plan is aChaininstance, all currently running jobs will be returned, however, chain itself will be not included in the list (effectivelyCurrentlyBuildingfor all chain's children jobs will be returned)- Specified by:
getCurrentlyBuildingForPlanResultin interfacePlanExecutionManager- Returns:
-
stopPlan
public void stopPlan(@NotNull @NotNull PlanResultKey planResultKey, boolean abandonResult, String userName) - Specified by:
stopPlanin interfacePlanExecutionManager
-
stopPlan
public void stopPlan(@NotNull @NotNull PlanKey planKey, boolean abandonResult, String userName) throws InterruptedException - Specified by:
stopPlanin interfacePlanExecutionManager- Throws:
InterruptedException
-
stopRequest
Description copied from interface:PlanExecutionManagerStops a build requests for the givenPlanKey- Specified by:
stopRequestin interfacePlanExecutionManager
-
shutdown
- Specified by:
shutdownin interfacePlanExecutionManager
-