Package com.atlassian.bamboo.build
Class DefaultBuildExecutionManager
- java.lang.Object
-
- com.atlassian.bamboo.build.DefaultBuildExecutionManager
-
- All Implemented Interfaces:
BuildExecutionManager
public class DefaultBuildExecutionManager extends Object implements BuildExecutionManager
This class is registered as event listenerpostConstruct()
-
-
Constructor Summary
Constructors Constructor Description DefaultBuildExecutionManager(org.quartz.Scheduler scheduler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddetachBuildFromAgent(long agentId)Detaches runnin build (if any) from an agent that was assigned to it.voidexecute(@NotNull BuildContext buildContext)Executes the givenBuildContextAt this point aBuildResultsSummaryexists that matches the givenBuildContextvoidfinishBuild(@NotNull PlanResultKey planResultKey, boolean updateFollowingBuilds)Calls removeCurrentlyBuilding and finishProcessvoidfinishBuildWithCleanState(@NotNull PlanResultKey planResultKey, @NotNull BuildContext buildContext)Calls removeCurrentlyBuilding and finishProcess.@Nullable CurrentlyBuildinggetBuildRunningOnAgent(@NotNull Long buildAgentId)@NotNull List<CurrentlyBuilding>getCurrentlyBuilding(@NotNull Key key)@Nullable CurrentlyBuildinggetCurrentlyBuildingByBuildResult(@NotNull BuildIdentifier buildIdentifier)ReturnsCurrentlyBuildinginstance for build identifier (orBuildContext).@Nullable CurrentlyBuildinggetCurrentlyBuildingByPlanResultKey(@NotNull ResultKey resultKey)ReturnsCurrentlyBuildinginstance for build identified by buildResultKey.@NotNull Iterable<CurrentlyBuilding>getCurrentlyExecuting()Retrieves a all builds being executed (i.e not just queued).Iterable<CurrentlyBuilding>getCurrentlyExecuting(PlanKey planKey)voidonExecutionCancelledTimingPoint(BuildTimingPoints.ExecutionCancelled event)voidonExecutionFinishedTimingPoint(BuildTimingPoints.ExecutionFinished event)voidonQueuedTimingPoint(BuildTimingPoints.Queued event)voidonSentToAgentTimingPoint(BuildTimingPoints.SentToAgent event)@Nullable CurrentlyBuildingremoveCurrentlyBuilding(@NotNull ResultKey resultKey)voidsetAgentManager(AgentManager agentManager)voidsetAuthorCreatorService(AuthorCreatorService authorCreatorService)voidsetBuildLoggerManager(BuildLoggerManager buildLoggerManager)voidsetCachedPlanManager(CachedPlanManager cachedPlanManager)voidsetCurrentlyBuilding(@NotNull BuildContext buildContext, @NotNull Collection<BuildAgent> executableAgents, @NotNull Collection<ElasticImageConfiguration> executableImages)Denotes that the passed build context is beginning the build process.voidsetEventPublisher(com.atlassian.event.api.EventPublisher eventPublisher)voidsetPlanStatePersisterService(PlanStatePersisterService planStatePersisterService)voidsetResultsSummaryManager(ResultsSummaryManager resultsSummaryManager)
-
-
-
Method Detail
-
execute
public void execute(@NotNull @NotNull BuildContext buildContext)Description copied from interface:BuildExecutionManagerExecutes the givenBuildContextAt this point aBuildResultsSummaryexists that matches the givenBuildContext- Specified by:
executein interfaceBuildExecutionManager
-
getCurrentlyExecuting
@NotNull public @NotNull Iterable<CurrentlyBuilding> getCurrentlyExecuting()
Description copied from interface:BuildExecutionManagerRetrieves a all builds being executed (i.e not just queued).- Specified by:
getCurrentlyExecutingin interfaceBuildExecutionManager- Returns:
-
getCurrentlyExecuting
public Iterable<CurrentlyBuilding> getCurrentlyExecuting(PlanKey planKey)
- Specified by:
getCurrentlyExecutingin interfaceBuildExecutionManager
-
getCurrentlyBuilding
@NotNull public @NotNull List<CurrentlyBuilding> getCurrentlyBuilding(@NotNull @NotNull Key key)
- Specified by:
getCurrentlyBuildingin interfaceBuildExecutionManager
-
getCurrentlyBuildingByPlanResultKey
@Nullable public @Nullable CurrentlyBuilding getCurrentlyBuildingByPlanResultKey(@NotNull @NotNull ResultKey resultKey)
Description copied from interface:BuildExecutionManagerReturnsCurrentlyBuildinginstance for build identified by buildResultKey. Should be used only ifBuildIdentifieris not available - basically in actions- Specified by:
getCurrentlyBuildingByPlanResultKeyin interfaceBuildExecutionManager- Returns:
-
getCurrentlyBuildingByBuildResult
@Nullable public @Nullable CurrentlyBuilding getCurrentlyBuildingByBuildResult(@NotNull @NotNull BuildIdentifier buildIdentifier)
Description copied from interface:BuildExecutionManagerReturnsCurrentlyBuildinginstance for build identifier (orBuildContext).- Specified by:
getCurrentlyBuildingByBuildResultin interfaceBuildExecutionManager- Returns:
-
setCurrentlyBuilding
public void setCurrentlyBuilding(@NotNull @NotNull BuildContext buildContext, @NotNull @NotNull Collection<BuildAgent> executableAgents, @NotNull @NotNull Collection<ElasticImageConfiguration> executableImages)Denotes that the passed build context is beginning the build process. (i.e. it's being queued). Executable build agent lists are considered to be up to date if this method is used.- Specified by:
setCurrentlyBuildingin interfaceBuildExecutionManager- Parameters:
buildContext-executableAgents- - a list of agents on which this build can be run.executableImages- - a list of images on which the build can be run.
-
getBuildRunningOnAgent
@Nullable public @Nullable CurrentlyBuilding getBuildRunningOnAgent(@NotNull @NotNull Long buildAgentId)
- Specified by:
getBuildRunningOnAgentin interfaceBuildExecutionManager
-
detachBuildFromAgent
public void detachBuildFromAgent(long agentId)
Description copied from interface:BuildExecutionManagerDetaches runnin build (if any) from an agent that was assigned to it. Makes it possible for orphaned build monitor to clean it up. On the other hand, if the build result is returned within grace period it can still be accepted.- Specified by:
detachBuildFromAgentin interfaceBuildExecutionManager
-
finishBuildWithCleanState
public void finishBuildWithCleanState(@NotNull @NotNull PlanResultKey planResultKey, @NotNull @NotNull BuildContext buildContext)Description copied from interface:BuildExecutionManagerCalls removeCurrentlyBuilding and finishProcess. This method assumes that result's life cycle state has been updated correctly. If in doubt use#finishBuild(PlanResultKey)instead.- Specified by:
finishBuildWithCleanStatein interfaceBuildExecutionManager- Parameters:
planResultKey- identifies plan result
-
finishBuild
public void finishBuild(@NotNull @NotNull PlanResultKey planResultKey, boolean updateFollowingBuilds)Description copied from interface:BuildExecutionManagerCalls removeCurrentlyBuilding and finishProcess- Specified by:
finishBuildin interfaceBuildExecutionManager- Parameters:
planResultKey- identifies plan result
-
removeCurrentlyBuilding
@Nullable public @Nullable CurrentlyBuilding removeCurrentlyBuilding(@NotNull @NotNull ResultKey resultKey)
- Specified by:
removeCurrentlyBuildingin interfaceBuildExecutionManager
-
onQueuedTimingPoint
@EventListener public void onQueuedTimingPoint(@NotNull BuildTimingPoints.Queued event)
-
onSentToAgentTimingPoint
@EventListener public void onSentToAgentTimingPoint(@NotNull BuildTimingPoints.SentToAgent event)
-
onExecutionCancelledTimingPoint
@EventListener public void onExecutionCancelledTimingPoint(@NotNull BuildTimingPoints.ExecutionCancelled event)
-
onExecutionFinishedTimingPoint
@EventListener public void onExecutionFinishedTimingPoint(@NotNull BuildTimingPoints.ExecutionFinished event)
-
setEventPublisher
public void setEventPublisher(com.atlassian.event.api.EventPublisher eventPublisher)
-
setResultsSummaryManager
public void setResultsSummaryManager(ResultsSummaryManager resultsSummaryManager)
-
setBuildLoggerManager
public void setBuildLoggerManager(BuildLoggerManager buildLoggerManager)
-
setAuthorCreatorService
public void setAuthorCreatorService(AuthorCreatorService authorCreatorService)
-
setPlanStatePersisterService
public void setPlanStatePersisterService(PlanStatePersisterService planStatePersisterService)
-
setAgentManager
public void setAgentManager(AgentManager agentManager)
-
setCachedPlanManager
public void setCachedPlanManager(CachedPlanManager cachedPlanManager)
-
-