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 void
detachBuildFromAgent(long agentId)
Detaches runnin build (if any) from an agent that was assigned to it.void
execute(@NotNull BuildContext buildContext)
Executes the givenBuildContext
At this point aBuildResultsSummary
exists that matches the givenBuildContext
void
finishBuild(@NotNull PlanResultKey planResultKey, boolean updateFollowingBuilds)
Calls removeCurrentlyBuilding and finishProcessvoid
finishBuildWithCleanState(@NotNull PlanResultKey planResultKey, @NotNull BuildContext buildContext)
Calls removeCurrentlyBuilding and finishProcess.@Nullable CurrentlyBuilding
getBuildRunningOnAgent(@NotNull Long buildAgentId)
@NotNull List<CurrentlyBuilding>
getCurrentlyBuilding(@NotNull Key key)
@Nullable CurrentlyBuilding
getCurrentlyBuildingByBuildResult(@NotNull BuildIdentifier buildIdentifier)
ReturnsCurrentlyBuilding
instance for build identifier (orBuildContext
).@Nullable CurrentlyBuilding
getCurrentlyBuildingByPlanResultKey(@NotNull ResultKey resultKey)
ReturnsCurrentlyBuilding
instance 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)
void
onExecutionCancelledTimingPoint(BuildTimingPoints.ExecutionCancelled event)
void
onExecutionFinishedTimingPoint(BuildTimingPoints.ExecutionFinished event)
void
onQueuedTimingPoint(BuildTimingPoints.Queued event)
void
onSentToAgentTimingPoint(BuildTimingPoints.SentToAgent event)
@Nullable CurrentlyBuilding
removeCurrentlyBuilding(@NotNull ResultKey resultKey)
void
setAgentManager(AgentManager agentManager)
void
setAuthorCreatorService(AuthorCreatorService authorCreatorService)
void
setBuildLoggerManager(BuildLoggerManager buildLoggerManager)
void
setCachedPlanManager(CachedPlanManager cachedPlanManager)
void
setCurrentlyBuilding(@NotNull BuildContext buildContext, @NotNull Collection<BuildAgent> executableAgents, @NotNull Collection<ElasticImageConfiguration> executableImages)
Denotes that the passed build context is beginning the build process.void
setEventPublisher(com.atlassian.event.api.EventPublisher eventPublisher)
void
setPlanStatePersisterService(PlanStatePersisterService planStatePersisterService)
void
setResultsSummaryManager(ResultsSummaryManager resultsSummaryManager)
-
-
-
Method Detail
-
execute
public void execute(@NotNull @NotNull BuildContext buildContext)
Description copied from interface:BuildExecutionManager
Executes the givenBuildContext
At this point aBuildResultsSummary
exists that matches the givenBuildContext
- Specified by:
execute
in interfaceBuildExecutionManager
-
getCurrentlyExecuting
@NotNull public @NotNull Iterable<CurrentlyBuilding> getCurrentlyExecuting()
Description copied from interface:BuildExecutionManager
Retrieves a all builds being executed (i.e not just queued).- Specified by:
getCurrentlyExecuting
in interfaceBuildExecutionManager
- Returns:
-
getCurrentlyExecuting
public Iterable<CurrentlyBuilding> getCurrentlyExecuting(PlanKey planKey)
- Specified by:
getCurrentlyExecuting
in interfaceBuildExecutionManager
-
getCurrentlyBuilding
@NotNull public @NotNull List<CurrentlyBuilding> getCurrentlyBuilding(@NotNull @NotNull Key key)
- Specified by:
getCurrentlyBuilding
in interfaceBuildExecutionManager
-
getCurrentlyBuildingByPlanResultKey
@Nullable public @Nullable CurrentlyBuilding getCurrentlyBuildingByPlanResultKey(@NotNull @NotNull ResultKey resultKey)
Description copied from interface:BuildExecutionManager
ReturnsCurrentlyBuilding
instance for build identified by buildResultKey. Should be used only ifBuildIdentifier
is not available - basically in actions- Specified by:
getCurrentlyBuildingByPlanResultKey
in interfaceBuildExecutionManager
- Returns:
-
getCurrentlyBuildingByBuildResult
@Nullable public @Nullable CurrentlyBuilding getCurrentlyBuildingByBuildResult(@NotNull @NotNull BuildIdentifier buildIdentifier)
Description copied from interface:BuildExecutionManager
ReturnsCurrentlyBuilding
instance for build identifier (orBuildContext
).- Specified by:
getCurrentlyBuildingByBuildResult
in 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:
setCurrentlyBuilding
in 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:
getBuildRunningOnAgent
in interfaceBuildExecutionManager
-
detachBuildFromAgent
public void detachBuildFromAgent(long agentId)
Description copied from interface:BuildExecutionManager
Detaches 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:
detachBuildFromAgent
in interfaceBuildExecutionManager
-
finishBuildWithCleanState
public void finishBuildWithCleanState(@NotNull @NotNull PlanResultKey planResultKey, @NotNull @NotNull BuildContext buildContext)
Description copied from interface:BuildExecutionManager
Calls 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:
finishBuildWithCleanState
in interfaceBuildExecutionManager
- Parameters:
planResultKey
- identifies plan result
-
finishBuild
public void finishBuild(@NotNull @NotNull PlanResultKey planResultKey, boolean updateFollowingBuilds)
Description copied from interface:BuildExecutionManager
Calls removeCurrentlyBuilding and finishProcess- Specified by:
finishBuild
in interfaceBuildExecutionManager
- Parameters:
planResultKey
- identifies plan result
-
removeCurrentlyBuilding
@Nullable public @Nullable CurrentlyBuilding removeCurrentlyBuilding(@NotNull @NotNull ResultKey resultKey)
- Specified by:
removeCurrentlyBuilding
in 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)
-
-