public class BuildResultsSummaryManagerImpl extends Object implements BuildResultsSummaryManager, ResultsSummaryManager
Constructor and Description |
---|
BuildResultsSummaryManagerImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addVariableContextSnapshotToResultSummary(ResultsSummary resultsSummary,
VariableContext variableContext)
Adds state of global and plan variables to result at the beginning of execution.
|
void |
calculateAndSetDeltaState(ResultsSummary resultsSummary)
Figures out the delta state for the provided results summary, if a 'fixing' build
will also calculate how long it took to fix.
|
Long |
calculateQueueDuration(ChainResultsSummary resultsSummary)
Calculates queueDuration value for a chain result as a maximum value of (vcsUpdateTime - queueTime) for all related job results.
|
Long |
calculateVcsUpdateDuration(ChainResultsSummary resultsSummary)
Calculates vcsUpdateDuration value for a chain result as a maximum value of (buildDate - vcsUpdateTime) for all related job results.
|
void |
clearVariablesOnRerunBuild(ResultsSummary resultsSummary)
Clear stored stage manual variables when build is fully rerun.
|
int |
countResultsWithState(PlanKey planKey,
int lowerBuildNumber,
int upperBuildNumber,
BuildState buildState)
Counts results with a given state in a given build number range for plan.
|
<T extends ResultsSummary> |
createResultsSummary(BuildContext buildContext,
Class<T> aClass)
Creates a
ResultsSummary of the given Class |
<T extends ResultsSummary> |
createResultsSummary(ChainResultsSummary chainResultsSummary,
BuildContext buildContext,
Class<T> aClass) |
List<Integer> |
findAllBuildResultsNumbers(PlanKey planKey) |
Range<Integer> |
findBuildResultNumbersRange(PlanKey planKey)
Finds minimum and maximum build number for a plan.
|
List<ChainResultsSummary> |
findChainResultsWithJobLabelled(ResultsSummaryCriteria criteria,
List<Label> labels)
Searches through all chains to find any that have jobs which match the given labels.
|
ResultsSummary |
findFirstFailedBuildResultAfter(String buildKey,
int buildNumber)
Finds the first failed
ResultsSummary after buildNumber |
ResultsSummary |
findFirstFailedBuildResultBetween(ImmutablePlan build,
int lowerBuildNumber,
int upperBuildNumber)
Finds the first failed build between the upper and lower build numbers inclusively.
|
<T extends ResultsSummary> |
findFirstResultAfter(PlanResultKey planResultKey,
Class<T> aClass)
Finds the first
ResultsSummary after a specified build which is either FINISHED or can be FINISHED, i.e. |
ResultsSummary |
findFirstSuccessfulBuildResultAfter(PlanResultKey planResultKey)
Finds the last successful
ResultsSummary after buildNumber |
List<LinkedJiraIssue> |
findJiraIssuesForPlanKey(PlanKey planKey)
Retrieves a list of
LinkedJiraIssue linked to the given plan key |
List<LinkedJiraIssue> |
findJiraIssuesForResults(List<ResultsSummary> buildResults)
Retrieves a list of
LinkedJiraIssue linked to the given build result summaries |
ResultsSummary |
findLastBuildResultBefore(String buildKey,
int buildNumber)
Finds the last successful or failing
BuildResultsSummary before buildNumber |
<T extends ResultsSummary> |
findLastBuildResultBeforeWithTests(PlanResultKey planResultKey,
Class<T> aClass,
boolean includeOnceOffBuilds)
Finds the last successful or failing
BuildResultsSummary before buildNumber |
ResultsSummary |
findLastFailingBuildResultBefore(ImmutablePlan build,
int buildNumber)
Finds the last failing
ResultsSummary before buildNumber |
<T extends ResultsSummary> |
findLastResultBefore(PlanResultKey planResultKey,
Class<T> aClass)
Finds the last successful or failing
ResultsSummary before planResultKey.getBuildNumber |
<T extends ResultsSummary> |
findLastResultBefore(PlanResultKey planResultKey,
Class<T> aClass,
boolean includeOnceOffBuilds)
Finds the last
ResultsSummary before planResultKey.getBuildNumber |
<T extends ResultsSummary> |
findLastResultSummaryWithState(PlanKey planKey,
BuildState buildState,
Class<T> aClass) |
ResultsSummary |
findLastSuccessfulBuildResultBefore(PlanResultKey planResultKey)
Finds the last successful
ResultsSummary before build |
List<? extends ResultsSummary> |
findResultsSummariesByJiraIssues(List<String> issueKeys)
Finds a list of results which are linked to the given issue keys
|
List<? extends ResultsSummary> |
findResultsSummariesByProjectKey(String projectKey)
Provide a list of results which are linked to any issues under the given jira project key
|
List<ResultsSummary> |
getAfterSummaries(ImmutablePlan plan,
int buildNumber,
int maxCount)
Returns all the
ResultsSummary objects that represent build results strictly after the given build number. |
<T extends ResultsSummary> |
getAllActiveResultSummariesForPlan(PlanKey planKey,
Class<T> aClass)
Returns all the
ResultsSummary in a LifeCycleState.IN_PROGRESS state |
<T extends ResultsSummary> |
getAllBuildResultSummariesInUnknownState(Class<T> aClass)
Returns all the
BuildResultsSummary in a BuildState.UNKNOWN
state |
<T extends ResultsSummary> |
getAllInProgressResultSummaries(Class<T> aClass)
Returns all the
ResultsSummary in a LifeCycleState.IN_PROGRESS state |
<T extends ResultsSummary> |
getAllPendingResultSummaries(Class<T> aClass)
Returns all the
ResultsSummary in a LifeCycleState.PENDING state |
<T extends ResultsSummary> |
getAllQueuedResultSummaries(Class<T> aClass)
Returns all the
ResultsSummary in a LifeCycleState.QUEUED state |
<T extends ResultsSummary> |
getAnyResultSummary(ResultsSummaryCriteria criteria,
ResultDataRead dataRead)
Generic search to find any result summary basing on the criteria provided.
|
long |
getAverageBuildTime(ImmutableBuildable plan,
int numberOfResults)
Returns average build duration for given number of builds
|
long |
getAveragePlanExecutionDuration(ImmutablePlan plan,
int numberOfResults)
Get average duration from n last results summaries in finished state for a plan.
|
List<ResultsSummary> |
getBeforeSummaries(ImmutablePlan plan,
int buildNumber,
int maxCount)
Returns all the
ResultsSummary objects that represent build results strictly before the given build number. |
ResultsSummary |
getBreakingBuild(ResultsSummary buildResultsSummary)
Returns the first failing build after the last successful build.
|
ChainStageResult |
getChainStageResultById(Long id)
Returns a
ChainStageResult by its id |
List<UnassociatedCommit> |
getCommitsForUser(String username,
int max)
Retrieve a list of recent Commits for the given user.
|
<T extends ResultsSummary> |
getFinalizedResultSummariesForPlan(PlanKey planKey,
Class<T> aClass,
int firstResult,
int maxResults)
Returns all the
ResultsSummary in a LifeCycleState.FINISHED or LifeCycleState.NOT_BUILT state with the given Class . |
ResultsSummary |
getFixingBuild(ResultsSummary buildResultsSummary)
Returns the first successful
ResultsSummary for given ResultsSummary . |
List<ResultsSummary> |
getLastNFailedResultsSummaries(Plan plan,
int numberOfResults)
Returns the most recent n failed build results.
|
List<ResultsSummary> |
getLastNResultsSummaries(ImmutablePlan plan,
int numberOfResults)
Provides a list of the latest N results summaries for the given plan, newest first.
|
<T extends ResultsSummary> |
getLastResultsSummary(String planKey,
Class<T> aClass)
Get the last
ResultsSummary for planKey and Class |
ResultsSummary |
getLastSuccessfulResultSummary(PlanKey planKey)
Get the last successful
ResultsSummary for planKey |
List<ResultsSummary> |
getLatestFailedResultSummaries()
Retrieve list of failed build results (for all builds) in the last few days (number of days is specified in the
DAO) This method is filtered to remove results that user doesn't have permission to see
|
List<ResultsSummary> |
getLatestResultSummaries()
Retrieve list of build results (for all builds) in the last few days (number of days is specified in the DAO)
This method is filtered to remove results that user doesn't have permission to see
|
List<ResultsSummary> |
getNeighbouringSummaries(ImmutablePlan plan,
int buildNumber,
int maxCount)
Returns all the
ResultsSummary objects that represent build results "around" the given build number. |
List<ResultsSummary> |
getNeighbouringSummaries(Plan plan,
int buildNumber)
Returns all the
ResultsSummary objects that matches the passed build numbers |
int |
getNumberOfConcurrentlyRunningBuilds(PlanKey planKey)
Gets the number of concurrently running builds
|
long |
getNumberOfFinalizedResults(ImmutablePlan plan)
Get number of the
ResultsSummary s in a LifeCycleState.FINISHED or LifeCycleState.NOT_BUILT state for the given Plan |
long |
getNumberOfFinishedResults(Plan plan)
|
long |
getNumberOfResults()
Get number of all
ResultsSummary s |
ChainResultsSummary |
getParentResultSummary(ResultsSummary resultsSummary)
Get (@link ChainResultsSummary} containing given
ResultsSummary |
List<PlanKey> |
getPlanKeysSortedByNumberOfFinalizedResultSummaries() |
ResultsSummary |
getResultsSummary(long id)
Lookup the ResultsSummary by id
|
ResultsSummary |
getResultsSummary(PlanResultKey planResultKey)
Lookup the ResultsSummary by
PlanResultKey |
<T extends ResultsSummary> |
getResultsSummary(PlanResultKey planResultKey,
Class<T> aClass)
Lookup
ResultsSummary by PlanResultKey and expected type |
<T extends ResultsSummary> |
getResultsSummary(PlanResultKey planResultKey,
Class<T> aClass,
ResultDataRead dataRead)
Lookup
ResultsSummary by PlanResultKey and expected type. |
ResultsSummary |
getResultsSummary(PlanResultKey planResultKey,
ResultDataRead dataRead)
Lookup the ResultsSummary by
PlanResultKey . |
<T extends ResultsSummary> |
getResultSummaries(ResultsSummaryCriteria resultsSummaryCriteria)
Generic search to find any result summaries basing on the criteria provided.
|
<T extends ResultsSummary> |
getResultSummariesByChangeSetId(String changeSetId,
Class<T> discriminator)
Get a list of all build results containing a commit with the given changeset ID.
|
<T extends ResultsSummary> |
getResultSummariesByChangeSetIdAndRepository(long repositoryId,
String changeSetId,
Class<T> discriminator)
Get a list of all build results containing a commit with the given changeset ID that are in the given repository.
|
<T extends ResultsSummary> |
getResultSummariesByChangeSetIds(Iterable<Pair<String,RepositoryData>> changeSetIds,
Class<T> discriminator)
Get a list of all build results containing a commit with any of the given changeset IDs and which are in the supplied list of repository datas.
|
<T extends ResultsSummary> |
getResultSummariesByChangeSetIds(List<String> changeSetIds,
Class<T> discriminator)
Get a list of all build results containing a commit with any of the given changeset IDs.
|
<T extends ResultsSummary> |
getResultSummariesByCheckoutChangesetId(String changeSetId,
Class<T> discriminator)
Get a list of all build results containing repositories checked out with the given changeset ID.
|
<T extends ResultsSummary> |
getResultSummariesForExpiry(ExpiryCriteria expiryCriteria)
Searches for
result summaries according to the given criteria for
use in build expiry. |
<T extends ResultsSummary> |
getResultSummariesForPlan(ImmutablePlan plan,
int firstResult,
int maxResults)
|
<T extends ResultsSummary> |
getResultSummariesForPlanByLifeCycleState(Plan plan,
LifeCycleState lifeCycleState,
int firstResult,
int maxResults)
Get the
ResultsSummary s for the given Plan in give LifeCycleState that are Results are sorted by build number (descending). |
ChainStageResult |
getStageForResult(ResultsSummary resultsSummary)
Get (@link ChainStageResult} containing given
ResultsSummary |
void |
invalidateLogSize(PlanResultKey planResultKey)
Invalidates the log size of a
ResultsSummary with the given PlanResultKey . |
void |
logSubstitutedVariables(BuildContext buildContext,
ResultsSummary resultsSummary) |
void |
logVariablesForSubstitution(BuildContext buildContext,
ResultsSummary resultsSummary) |
int |
markResultSummariesForDeletion(PlanKey planKey)
Mass update of all
ResultsSummary records in the database related to a Plan identified by planKey. |
void |
moveResultSummaries(Plan newParentPlan,
PlanKey oldPlanKey,
PlanKey newPlanKey)
Reassigns plan key ResultsSummaries associated with selected plan key.
|
void |
postBuildVariableSnapshotUpdate(ResultsSummary resultsSummary,
VariableContext variableContext)
Saves result variables produced in a job.
|
int |
removeAllOrphanedResultSummaries()
Removes all the
ResultsSummary objects in the database that do not have a matching Plan |
void |
removeArtifacts(ImmutablePlan plan,
int buildNumber)
Remove any artifacts stored for this plan result
|
void |
removeArtifacts(ResultsSummary resultsSummary)
Remove any artifacts stored for this plan result
|
void |
removeBuildLogs(ImmutablePlan plan,
int buildNumber)
Remove any build logs stored for this plan result
|
void |
removeBuildLogs(ImmutablePlan plan,
int buildNumber,
long maxIgnoredSize)
Remove build logs stored for this plan result that are greater than given size (in bytes).
|
void |
removeBuildLogs(ResultsSummary resultsSummary)
Remove any build logs stored for this plan result
|
void |
removeBuildLogs(ResultsSummary resultsSummary,
long maxIgnoredSize)
Remove build logs stored for this plan result that are greater than given size (in bytes).
|
void |
removeMatchingArtifacts(ResultsSummary resultsSummary,
com.google.common.base.Predicate<ArtifactLink> predicate)
Remove artifacts from results summary that match a predicate.
|
void |
removeMergeResultSummary(MergeResultSummary mergeResult)
Removes merge result.
|
int |
removeResultsSummariesForPlan(Plan plan)
Remove all resultSummary objects for the given plan.
|
void |
removeResultSummary(ImmutablePlan plan,
int buildNumber)
Remove plan result summary and all associated objects.
|
void |
removeResultSummary(ImmutablePlan plan,
ResultsSummary resultsSummary)
Remove plan result summary and all associated objects.
|
ResultsSummary |
resetResultSummary(BuildResultsSummary resultsSummary)
Prepare result summry to be reuse for plan rerun
|
void |
saveResultSummary(ResultsSummary resultsSummary)
Saves the
ResultsSummary |
long |
scrollResultSummaries(String buildKey,
com.google.common.base.Function<ResultsSummary,Void> function)
Scroll through and execute function for each of BuildResultsSummary
Objects passed to function are not fully initialized.
|
long |
scrollResultSummaries(String buildKey,
ResultDataRead resultDataRead,
com.google.common.base.Function<ResultsSummary,Void> function)
Scroll through and execute function for each of ResultsSummary (Build and Chain)
Objects passed to function are not fully initialized.
|
void |
setArtifactLinkManager(ArtifactLinkManager artifactLinkManager) |
void |
setBranchIntegrationService(BranchIntegrationService branchIntegrationService) |
void |
setBuildExecutionManager(BuildExecutionManager buildExecutionManager) |
void |
setBuildResultsIndexer(BuildResultsIndexer buildResultsIndexer) |
void |
setBuildResultsSummaryDao(BuildResultsSummaryDao buildResultsSummaryDao) |
void |
setCommentManager(CommentManager commentManager) |
void |
setCommitDao(CommitDao commitDao) |
void |
setEventPublisher(com.atlassian.event.api.EventPublisher eventPublisher) |
void |
setExtendedAuthorManager(ExtendedAuthorManager extendedAuthorManager) |
void |
setJiraIssueUtils(JiraIssueUtils jiraIssueUtils) |
void |
setMergeResultSummaryDao(MergeResultSummaryDao mergeResultSummaryDao) |
void |
setPlanManager(PlanManager planManager) |
void |
setRepositoryDefinitionManager(RepositoryDefinitionManager repositoryDefinitionManager) |
void |
setTestsManager(TestsManager testsManager) |
void |
setVariableContextBaselineDao(VariableContextBaselineDao variableContextBaselineDao) |
void |
setVcsRepositoryManager(VcsRepositoryManager vcsRepositoryManager) |
BuildResultsSummary |
updateBuildSummaryFromBuildResults(BuildContext buildContext,
CurrentlyBuilding currentlyBuilding,
BuildResults buildResults)
Updates BuildResultsSummary after build is completed.
|
void |
updateLifeCycleState(BuildIdentifier buildIdentifier,
LifeCycleState lifeCycleState,
BuildState buildState)
Update LifeCycleState and saves the
ResultsSummary for given BuildContext
Updates also timing information |
void |
updateLifeCycleState(ResultsSummary resultsSummary,
LifeCycleState lifeCycleState,
BuildState buildState)
Update LifeCycleState and saves the given
ResultsSummary |
void |
updatePlanCompletedDate(ChainResultsSummary resultSummary,
Date completionDate)
Update completed date and duration of
ChainResultsSummary |
void |
updateProcessingDuration(ChainResultsSummary resultSummary)
Updates
ImmutableResultsSummary.getProcessingDuration() and ChainStageResult.getProcessingDuration()
based on chain execution. |
void |
updateResultSummaryWithBuildChanges(BuildContext buildContext) |
void |
updateVariablesOnContinuedBuild(ResultsSummary resultsSummary,
VariableContext variableContext)
Add manual variables added when starting manual stage or restarting failed stage.
|
@NotNull public <T extends ResultsSummary> List<T> getResultSummariesForPlanByLifeCycleState(@NotNull Plan plan, @NotNull LifeCycleState lifeCycleState, int firstResult, int maxResults)
ResultsSummaryManager
ResultsSummary
s for the given Plan
in give LifeCycleState
that are Results are sorted by build number (descending). User
can skip first n result and request maximum number of results.getResultSummariesForPlanByLifeCycleState
in interface ResultsSummaryManager
firstResult
- specifies the first item to be return (0 base index). Negative values treated as 0.maxResults
- specifies amount of the results to be returned. Value <= 0 returns everything.@NotNull public <T extends ResultsSummary> List<T> getResultSummariesForPlan(@NotNull ImmutablePlan plan, int firstResult, int maxResults)
ResultsSummaryManager
ResultsSummary
s for the given Plan
in any LifeCycleState
. Results are sorted by build number (descending). User can skip first n result
and request maximum number of results.getResultSummariesForPlan
in interface ResultsSummaryManager
firstResult
- specifies the first item to be return (0 base index). Negative values treated as 0.maxResults
- specifies amount of the results to be returned. Value <= 0 returns everything.@Nullable public ChainStageResult getChainStageResultById(@NotNull Long id)
ResultsSummaryManager
ChainStageResult
by its idgetChainStageResultById
in interface ResultsSummaryManager
@Nullable public ResultsSummary getResultsSummary(@NotNull PlanResultKey planResultKey)
ResultsSummaryManager
PlanResultKey
getResultsSummary
in interface ResultsSummaryManager
@Nullable public ResultsSummary getResultsSummary(@NotNull PlanResultKey planResultKey, ResultDataRead dataRead)
ResultsSummaryManager
PlanResultKey
. All lazy initialized collections can be eagerly fetched to avoid session problems.
Use with caution - expensive callgetResultsSummary
in interface ResultsSummaryManager
@Nullable public <T extends ResultsSummary> T getResultsSummary(@NotNull PlanResultKey planResultKey, @NotNull Class<T> aClass)
ResultsSummaryManager
ResultsSummary
by PlanResultKey
and expected typegetResultsSummary
in interface ResultsSummaryManager
@Nullable public <T extends ResultsSummary> T getResultsSummary(@NotNull PlanResultKey planResultKey, @NotNull Class<T> aClass, ResultDataRead dataRead)
ResultsSummaryManager
ResultsSummary
by PlanResultKey
and expected type. All lazy initialized collections can be eagerly fetched to avoid session problems.
Use with caution - expensive callgetResultsSummary
in interface ResultsSummaryManager
public ResultsSummary getResultsSummary(long id)
ResultsSummaryManager
getResultsSummary
in interface ResultsSummaryManager
id
- - database idpublic ResultsSummary resetResultSummary(@NotNull BuildResultsSummary resultsSummary) throws IOException
ResultsSummaryManager
resetResultSummary
in interface ResultsSummaryManager
IOException
public void addVariableContextSnapshotToResultSummary(@NotNull ResultsSummary resultsSummary, @NotNull VariableContext variableContext)
ResultsSummaryManager
addVariableContextSnapshotToResultSummary
in interface ResultsSummaryManager
public void updateVariablesOnContinuedBuild(@NotNull ResultsSummary resultsSummary, @NotNull VariableContext variableContext)
ResultsSummaryManager
updateVariablesOnContinuedBuild
in interface ResultsSummaryManager
public void clearVariablesOnRerunBuild(@NotNull ResultsSummary resultsSummary)
ResultsSummaryManager
clearVariablesOnRerunBuild
in interface ResultsSummaryManager
public void postBuildVariableSnapshotUpdate(@NotNull ResultsSummary resultsSummary, @NotNull VariableContext variableContext)
ResultsSummaryManager
postBuildVariableSnapshotUpdate
in interface ResultsSummaryManager
@NotNull public <T extends ResultsSummary> Collection<T> getAllPendingResultSummaries(Class<T> aClass)
ResultsSummaryManager
ResultsSummary
in a LifeCycleState.PENDING
stategetAllPendingResultSummaries
in interface ResultsSummaryManager
@NotNull public <T extends ResultsSummary> Collection<T> getAllQueuedResultSummaries(Class<T> aClass)
ResultsSummaryManager
ResultsSummary
in a LifeCycleState.QUEUED
stategetAllQueuedResultSummaries
in interface ResultsSummaryManager
@NotNull public <T extends ResultsSummary> Collection<T> getAllInProgressResultSummaries(Class<T> aClass)
ResultsSummaryManager
ResultsSummary
in a LifeCycleState.IN_PROGRESS
stategetAllInProgressResultSummaries
in interface ResultsSummaryManager
@NotNull public <T extends ResultsSummary> Collection<T> getAllActiveResultSummariesForPlan(PlanKey planKey, Class<T> aClass)
ResultsSummaryManager
ResultsSummary
in a LifeCycleState.IN_PROGRESS
stategetAllActiveResultSummariesForPlan
in interface ResultsSummaryManager
@NotNull public <T extends ResultsSummary> List<T> getFinalizedResultSummariesForPlan(PlanKey planKey, Class<T> aClass, int firstResult, int maxResults)
ResultsSummaryManager
ResultsSummary
in a LifeCycleState.FINISHED
or LifeCycleState.NOT_BUILT
state with the given Class
.
Results are sorted descending by build number.getFinalizedResultSummariesForPlan
in interface ResultsSummaryManager
firstResult
- - specifies the first result to be included in the list.maxResults
- - specifies the length of the result; 0 for all results;public int getNumberOfConcurrentlyRunningBuilds(PlanKey planKey)
ResultsSummaryManager
getNumberOfConcurrentlyRunningBuilds
in interface ResultsSummaryManager
@NotNull public <T extends ResultsSummary> Collection<T> getAllBuildResultSummariesInUnknownState(Class<T> aClass)
ResultsSummaryManager
BuildResultsSummary
in a BuildState.UNKNOWN
stategetAllBuildResultSummariesInUnknownState
in interface ResultsSummaryManager
public <T extends ResultsSummary> T createResultsSummary(@NotNull BuildContext buildContext, @NotNull Class<T> aClass) throws ResultsSummaryCreationException
ResultsSummaryManager
ResultsSummary
of the given Class
createResultsSummary
in interface ResultsSummaryManager
ResultsSummaryCreationException
public <T extends ResultsSummary> T createResultsSummary(@Nullable ChainResultsSummary chainResultsSummary, @NotNull BuildContext buildContext, @NotNull Class<T> aClass) throws ResultsSummaryCreationException
createResultsSummary
in interface BuildResultsSummaryManager
ResultsSummaryCreationException
public void updateResultSummaryWithBuildChanges(@NotNull BuildContext buildContext) throws ResultsSummaryCreationException
updateResultSummaryWithBuildChanges
in interface ResultsSummaryManager
ResultsSummaryCreationException
@NotNull public BuildResultsSummary updateBuildSummaryFromBuildResults(BuildContext buildContext, @NotNull CurrentlyBuilding currentlyBuilding, BuildResults buildResults)
BuildResultsSummaryManager
updateBuildSummaryFromBuildResults
in interface BuildResultsSummaryManager
public void calculateAndSetDeltaState(ResultsSummary resultsSummary)
ResultsSummaryManager
calculateAndSetDeltaState
in interface ResultsSummaryManager
resultsSummary
- to updatepublic void updateLifeCycleState(@NotNull ResultsSummary resultsSummary, @NotNull LifeCycleState lifeCycleState, @NotNull BuildState buildState)
ResultsSummaryManager
ResultsSummary
updateLifeCycleState
in interface ResultsSummaryManager
resultsSummary
- ResultsSummary to be updated and savedlifeCycleState
- LifeCycleState to be setbuildState
- BuildState to be setpublic void updateLifeCycleState(@NotNull BuildIdentifier buildIdentifier, @NotNull LifeCycleState lifeCycleState, @NotNull BuildState buildState)
ResultsSummaryManager
ResultsSummary
for given BuildContext
Updates also timing informationupdateLifeCycleState
in interface ResultsSummaryManager
buildIdentifier
- BuildIdentifier used to get information on ResultsSummarylifeCycleState
- LifeCycleState to be setbuildState
- BuildState to be setpublic void updatePlanCompletedDate(@NotNull ChainResultsSummary resultSummary, @NotNull Date completionDate)
ResultsSummaryManager
ChainResultsSummary
updatePlanCompletedDate
in interface ResultsSummaryManager
public void updateProcessingDuration(ChainResultsSummary resultSummary)
ResultsSummaryManager
ImmutableResultsSummary.getProcessingDuration()
and ChainStageResult.getProcessingDuration()
based on chain execution.updateProcessingDuration
in interface ResultsSummaryManager
public int markResultSummariesForDeletion(@NotNull PlanKey planKey)
ResultsSummaryManager
ResultsSummary
records in the database related to a Plan identified by planKey.markResultSummariesForDeletion
in interface ResultsSummaryManager
planKey
- key of a plan@Nullable public ResultsSummary getBreakingBuild(ResultsSummary buildResultsSummary)
ResultsSummaryManager
getBreakingBuild
in interface ResultsSummaryManager
buildResultsSummary
- of the current build@Nullable public ResultsSummary getFixingBuild(ResultsSummary buildResultsSummary)
ResultsSummaryManager
ResultsSummary
for given ResultsSummary
. The input build
is returned if it is successful.getFixingBuild
in interface ResultsSummaryManager
@NotNull public <T extends ResultsSummary> T getAnyResultSummary(@NotNull ResultsSummaryCriteria criteria, ResultDataRead dataRead)
ResultsSummaryManager
getAnyResultSummary
in interface ResultsSummaryManager
criteria
- containing all the search constraints@NotNull public <T extends ResultsSummary> List<T> getResultSummaries(@NotNull ResultsSummaryCriteria resultsSummaryCriteria)
ResultsSummaryManager
getResultSummaries
in interface ResultsSummaryManager
resultsSummaryCriteria
- containing all the search constraints@NotNull public <T extends ResultsSummary> List<T> getResultSummariesForExpiry(@NotNull ExpiryCriteria expiryCriteria)
ResultsSummaryManager
result summaries
according to the given criteria
for
use in build expiry.getResultSummariesForExpiry
in interface ResultsSummaryManager
T
- type of returned results (determined by the criteria)expiryCriteria
- search constraintsresults summaries
matching the criteria@NotNull public List<ResultsSummary> getLastNResultsSummaries(@NotNull ImmutablePlan plan, int numberOfResults)
ResultsSummaryManager
getLastNResultsSummaries
in interface ResultsSummaryManager
plan
- - to get the results fornumberOfResults
- - number of summaries you would like@NotNull public List<ResultsSummary> getLastNFailedResultsSummaries(@NotNull Plan plan, int numberOfResults)
ResultsSummaryManager
getLastNFailedResultsSummaries
in interface ResultsSummaryManager
numberOfResults
- must be > 0@NotNull public List<? extends ResultsSummary> findResultsSummariesByJiraIssues(@Nullable List<String> issueKeys)
ResultsSummaryManager
findResultsSummariesByJiraIssues
in interface ResultsSummaryManager
issueKeys
- to search for@NotNull public List<? extends ResultsSummary> findResultsSummariesByProjectKey(@Nullable String projectKey)
ResultsSummaryManager
findResultsSummariesByProjectKey
in interface ResultsSummaryManager
projectKey
- - jira project key@NotNull public List<LinkedJiraIssue> findJiraIssuesForResults(@NotNull List<ResultsSummary> buildResults)
ResultsSummaryManager
LinkedJiraIssue
linked to the given build result summariesfindJiraIssuesForResults
in interface ResultsSummaryManager
buildResults
- to look for issues attached toLinkedJiraIssue
linked to the given build result summaries@NotNull public List<LinkedJiraIssue> findJiraIssuesForPlanKey(@NotNull PlanKey planKey)
ResultsSummaryManager
LinkedJiraIssue
linked to the given plan keyfindJiraIssuesForPlanKey
in interface ResultsSummaryManager
planKey
- to look for issues associated with plan of this keyLinkedJiraIssue
linked to the given Plan
public void removeResultSummary(@NotNull ImmutablePlan plan, int buildNumber)
ResultsSummaryManager
removeResultSummary
in interface ResultsSummaryManager
public void removeResultSummary(@NotNull ImmutablePlan plan, @NotNull ResultsSummary resultsSummary)
ResultsSummaryManager
removeResultSummary
in interface ResultsSummaryManager
public void removeBuildLogs(ImmutablePlan plan, int buildNumber)
ResultsSummaryManager
removeBuildLogs
in interface ResultsSummaryManager
public void removeBuildLogs(ImmutablePlan plan, int buildNumber, long maxIgnoredSize)
ResultsSummaryManager
removeBuildLogs
in interface ResultsSummaryManager
public void removeBuildLogs(@NotNull ResultsSummary resultsSummary)
ResultsSummaryManager
removeBuildLogs
in interface ResultsSummaryManager
public void removeBuildLogs(@NotNull ResultsSummary resultsSummary, long maxIgnoredSize)
ResultsSummaryManager
removeBuildLogs
in interface ResultsSummaryManager
public void removeMatchingArtifacts(@NotNull ResultsSummary resultsSummary, @NotNull com.google.common.base.Predicate<ArtifactLink> predicate) throws IOException
ResultsSummaryManager
removeMatchingArtifacts
in interface ResultsSummaryManager
IOException
public void removeArtifacts(@NotNull ImmutablePlan plan, int buildNumber) throws IOException
ResultsSummaryManager
removeArtifacts
in interface ResultsSummaryManager
IOException
public void removeArtifacts(@NotNull ResultsSummary resultsSummary) throws IOException
ResultsSummaryManager
removeArtifacts
in interface ResultsSummaryManager
IOException
public List<ChainResultsSummary> findChainResultsWithJobLabelled(ResultsSummaryCriteria criteria, List<Label> labels)
ResultsSummaryManager
findChainResultsWithJobLabelled
in interface ResultsSummaryManager
criteria
- containing the restrictions for the chains to be returnedlabels
- that the jobs can be associated with@NotNull public List<ResultsSummary> getNeighbouringSummaries(Plan plan, int buildNumber)
ResultsSummaryManager
ResultsSummary
objects that matches the passed build numbersgetNeighbouringSummaries
in interface ResultsSummaryManager
List
of BuildResultsSummary
@NotNull public List<ResultsSummary> getNeighbouringSummaries(@NotNull ImmutablePlan plan, int buildNumber, int maxCount)
ResultsSummaryManager
ResultsSummary
objects that represent build results "around" the given build number.getNeighbouringSummaries
in interface ResultsSummaryManager
plan
- the plan to return results forbuildNumber
- the build number to search aroundmaxCount
- the maximum number of builds to returnList
of BuildResultsSummary
in ascending order. At most there will be maxCount
items in the list, inclusive of the result for buildNumber
(if present).@NotNull public List<ResultsSummary> getBeforeSummaries(@NotNull ImmutablePlan plan, int buildNumber, int maxCount)
ResultsSummaryManager
ResultsSummary
objects that represent build results strictly before the given build number.getBeforeSummaries
in interface ResultsSummaryManager
plan
- the plan to return results forbuildNumber
- the build number to search beforemaxCount
- the maximum number of builds to returnList
of BuildResultsSummary
in ascending order. At most there will be maxCount
items in the list, exclusive of the result for buildNumber
(if present).@NotNull public List<ResultsSummary> getAfterSummaries(@NotNull ImmutablePlan plan, int buildNumber, int maxCount)
ResultsSummaryManager
ResultsSummary
objects that represent build results strictly after the given build number.getAfterSummaries
in interface ResultsSummaryManager
plan
- the plan to return results forbuildNumber
- the build number to search aftermaxCount
- the maximum number of builds to returnList
of BuildResultsSummary
in ascending order. At most there will be maxCount
items in the list, exclusive of the result for buildNumber
(if present).public int removeResultsSummariesForPlan(@NotNull Plan plan)
ResultsSummaryManager
ResultsSummary
objects to be deleted
in such case #scheduleResultsSummariesForDelayedDeletion(Plan)
should be considered.removeResultsSummariesForPlan
in interface ResultsSummaryManager
plan
- to remove results for.ResultsSummary
s removedpublic int removeAllOrphanedResultSummaries()
ResultsSummaryManager
ResultsSummary
objects in the database that do not have a matching Plan
removeAllOrphanedResultSummaries
in interface ResultsSummaryManager
ResultsSummary
s removedpublic void saveResultSummary(@NotNull ResultsSummary resultsSummary)
ResultsSummaryManager
ResultsSummary
saveResultSummary
in interface ResultsSummaryManager
public ResultsSummary getLastSuccessfulResultSummary(@NotNull PlanKey planKey)
ResultsSummaryManager
ResultsSummary
for planKeygetLastSuccessfulResultSummary
in interface ResultsSummaryManager
@Nullable public ResultsSummary findLastSuccessfulBuildResultBefore(@NotNull PlanResultKey planResultKey)
ResultsSummaryManager
ResultsSummary
before buildfindLastSuccessfulBuildResultBefore
in interface ResultsSummaryManager
@Nullable public <T extends ResultsSummary> T findFirstResultAfter(@NotNull PlanResultKey planResultKey, Class<T> aClass)
ResultsSummaryManager
ResultsSummary
after a specified build which is either FINISHED or can be FINISHED, i.e. is not
in NOT_BUILT state.findFirstResultAfter
in interface ResultsSummaryManager
@Nullable public <T extends ResultsSummary> T findLastResultBefore(@NotNull PlanResultKey planResultKey, Class<T> aClass)
ResultsSummaryManager
ResultsSummary
before planResultKey.getBuildNumberfindLastResultBefore
in interface ResultsSummaryManager
@Nullable public <T extends ResultsSummary> T findLastResultBefore(@NotNull PlanResultKey planResultKey, Class<T> aClass, boolean includeOnceOffBuilds)
ResultsSummaryManager
ResultsSummary
before planResultKey.getBuildNumberfindLastResultBefore
in interface ResultsSummaryManager
includeOnceOffBuilds
- - should we skip once-off builds or include them in the searchpublic <T extends ResultsSummary> T findLastResultSummaryWithState(@NotNull PlanKey planKey, @NotNull BuildState buildState, @NotNull Class<T> aClass)
findLastResultSummaryWithState
in interface ResultsSummaryManager
ResultsSummary
with the provided BuildState
@NotNull public <T extends ResultsSummary> List<T> getResultSummariesByChangeSetId(@NotNull String changeSetId, @NotNull Class<T> discriminator)
ResultsSummaryManager
Get a list of all build results containing a commit with the given changeset ID.
Please note that a build result summary contains list of commits which were added in a given build (compared to a previous one). It means that a list of commits may be empty if there were no repository changes. A list of commits is also empty in case of a first build in a plan or a first build of a plan's branch. A build results summary may also contain no commits if no version control system was used.
This will not return records marked for deletion.
In case you need to find build results based on commit which was checked out into a build workspace, see the
ResultsSummaryManager.getResultSummariesByCheckoutChangesetId(String, Class)
getResultSummariesByChangeSetId
in interface ResultsSummaryManager
T
- extends ResultSummarychangeSetId
- of the commitdiscriminator
- class of the ResultSummary interface required@NotNull public <T extends ResultsSummary> List<T> getResultSummariesByCheckoutChangesetId(@NotNull String changeSetId, @NotNull Class<T> discriminator)
ResultsSummaryManager
Get a list of all build results containing repositories checked out with the given changeset ID.
A build may use one or more repositories, each checked out with a certain changeset. This method returns build results having exact changeset ID checked out (note that it does not search for intermediate commits between two changeset IDs).
This will not return records marked for deletion.
In case you need to find build results based on commits which were added in certain build (compared to a previous
one), see the ResultsSummaryManager.getResultSummariesByChangeSetId(String, Class)
getResultSummariesByCheckoutChangesetId
in interface ResultsSummaryManager
T
- extends ResultSummarychangeSetId
- of the checkout commitdiscriminator
- class of the ResultSummary interface requiredchangeSetId
commitpublic <T extends ResultsSummary> List<T> getResultSummariesByChangeSetIdAndRepository(long repositoryId, @NotNull String changeSetId, @NotNull Class<T> discriminator)
ResultsSummaryManager
getResultSummariesByChangeSetIdAndRepository
in interface ResultsSummaryManager
T
- extends ResultSummaryrepositoryId
- of the repositorychangeSetId
- of the commitdiscriminator
- class of the ResultSummary interface required@NotNull public <T extends ResultsSummary> List<T> getResultSummariesByChangeSetIds(@NotNull List<String> changeSetIds, Class<T> discriminator)
ResultsSummaryManager
getResultSummariesByChangeSetIds
in interface ResultsSummaryManager
T
- extends ResultSummarychangeSetIds
- of the commitdiscriminator
- class of the ResultSummary interface required@NotNull public <T extends ResultsSummary> List<T> getResultSummariesByChangeSetIds(@NotNull Iterable<Pair<String,RepositoryData>> changeSetIds, Class<T> discriminator)
ResultsSummaryManager
getResultSummariesByChangeSetIds
in interface ResultsSummaryManager
T
- extends ResultSummarychangeSetIds
- of the commit anding with the repository that commit came fromdiscriminator
- class of the ResultSummary interface required@NotNull public List<UnassociatedCommit> getCommitsForUser(@NotNull String username, int max)
ResultsSummaryManager
getCommitsForUser
in interface ResultsSummaryManager
username
- to filter commits bymax
- maximum number of commits to get.@Nullable public ResultsSummary findLastBuildResultBefore(@NotNull String buildKey, int buildNumber)
ResultsSummaryManager
BuildResultsSummary
before buildNumberfindLastBuildResultBefore
in interface ResultsSummaryManager
public <T extends ResultsSummary> T findLastBuildResultBeforeWithTests(@NotNull PlanResultKey planResultKey, @NotNull Class<T> aClass, boolean includeOnceOffBuilds)
ResultsSummaryManager
BuildResultsSummary
before buildNumberfindLastBuildResultBeforeWithTests
in interface ResultsSummaryManager
includeOnceOffBuilds
- should once-off builds be considered or ignored in the search@Nullable public ResultsSummary findFirstFailedBuildResultAfter(@NotNull String buildKey, int buildNumber)
ResultsSummaryManager
ResultsSummary
after buildNumberfindFirstFailedBuildResultAfter
in interface ResultsSummaryManager
@Nullable public ResultsSummary findFirstSuccessfulBuildResultAfter(@NotNull PlanResultKey planResultKey)
ResultsSummaryManager
ResultsSummary
after buildNumberfindFirstSuccessfulBuildResultAfter
in interface ResultsSummaryManager
@Nullable public ResultsSummary findLastFailingBuildResultBefore(@NotNull ImmutablePlan build, int buildNumber)
ResultsSummaryManager
ResultsSummary
before buildNumberfindLastFailingBuildResultBefore
in interface ResultsSummaryManager
@Nullable public ResultsSummary findFirstFailedBuildResultBetween(@NotNull ImmutablePlan build, int lowerBuildNumber, int upperBuildNumber)
ResultsSummaryManager
findFirstFailedBuildResultBetween
in interface ResultsSummaryManager
@Nullable public ChainResultsSummary getParentResultSummary(ResultsSummary resultsSummary)
ResultsSummaryManager
ResultsSummary
getParentResultSummary
in interface ResultsSummaryManager
@Nullable public ChainStageResult getStageForResult(ResultsSummary resultsSummary)
ResultsSummaryManager
ResultsSummary
getStageForResult
in interface ResultsSummaryManager
public long getNumberOfResults()
ResultsSummaryManager
ResultsSummary
sgetNumberOfResults
in interface ResultsSummaryManager
public long getNumberOfFinishedResults(@NotNull Plan plan)
ResultsSummaryManager
getNumberOfFinishedResults
in interface ResultsSummaryManager
public long getNumberOfFinalizedResults(@NotNull ImmutablePlan plan)
ResultsSummaryManager
ResultsSummary
s in a LifeCycleState.FINISHED
or LifeCycleState.NOT_BUILT
state for the given Plan
getNumberOfFinalizedResults
in interface ResultsSummaryManager
public List<ResultsSummary> getLatestResultSummaries()
ResultsSummaryManager
getLatestResultSummaries
in interface ResultsSummaryManager
List
of ResultsSummary
public List<ResultsSummary> getLatestFailedResultSummaries()
ResultsSummaryManager
getLatestFailedResultSummaries
in interface ResultsSummaryManager
List
of ResultsSummary
public long getAverageBuildTime(@NotNull ImmutableBuildable plan, int numberOfResults)
BuildResultsSummaryManager
getAverageBuildTime
in interface BuildResultsSummaryManager
numberOfResults
- - How many build results to use in the average. must be greater 0 @return Average build time. 0 if no build found.public long getAveragePlanExecutionDuration(@NotNull ImmutablePlan plan, int numberOfResults)
ResultsSummaryManager
getAveragePlanExecutionDuration
in interface ResultsSummaryManager
numberOfResults
- amount of results to be taken into account for average calculationpublic int countResultsWithState(@NotNull PlanKey planKey, int lowerBuildNumber, int upperBuildNumber, @NotNull BuildState buildState)
ResultsSummaryManager
countResultsWithState
in interface ResultsSummaryManager
planKey
- the key of plan to analyselowerBuildNumber
- the build number to start the count withupperBuildNumber
- the build number to end the count withbuildState
- the state that will be counted@Nullable public <T extends ResultsSummary> T getLastResultsSummary(@NotNull String planKey, Class<T> aClass)
ResultsSummaryManager
ResultsSummary
for planKey and Class
getLastResultsSummary
in interface ResultsSummaryManager
public void moveResultSummaries(@NotNull Plan newParentPlan, @NotNull PlanKey oldPlanKey, @NotNull PlanKey newPlanKey)
ResultsSummaryManager
moveResultSummaries
in interface ResultsSummaryManager
newParentPlan
- the new parent plan of result summaries. This should be a plan, not a job.public long scrollResultSummaries(@NotNull String buildKey, @NotNull com.google.common.base.Function<ResultsSummary,Void> function)
ResultsSummaryManager
scrollResultSummaries
in interface ResultsSummaryManager
buildKey
- of the plan you want to scroll the result summaries forfunction
- function to be executed on each of the BuildResultSummarypublic long scrollResultSummaries(@NotNull String buildKey, ResultDataRead resultDataRead, @NotNull com.google.common.base.Function<ResultsSummary,Void> function)
ResultsSummaryManager
scrollResultSummaries
in interface ResultsSummaryManager
buildKey
- of the plan you want to scroll the result summaries forresultDataRead
- if the data should be loaded lazy or eagerlyfunction
- function to be executed on each of the BuildResultSummarypublic void logVariablesForSubstitution(@NotNull BuildContext buildContext, @NotNull ResultsSummary resultsSummary)
logVariablesForSubstitution
in interface ResultsSummaryManager
public void logSubstitutedVariables(@NotNull BuildContext buildContext, @NotNull ResultsSummary resultsSummary)
logSubstitutedVariables
in interface ResultsSummaryManager
public void removeMergeResultSummary(@NotNull MergeResultSummary mergeResult)
ResultsSummaryManager
removeMergeResultSummary
in interface ResultsSummaryManager
@NotNull public List<PlanKey> getPlanKeysSortedByNumberOfFinalizedResultSummaries()
getPlanKeysSortedByNumberOfFinalizedResultSummaries
in interface ResultsSummaryManager
@Nullable public Long calculateQueueDuration(@NotNull ChainResultsSummary resultsSummary)
ResultsSummaryManager
calculateQueueDuration
in interface ResultsSummaryManager
resultsSummary
- ChainResultsSummary
for which calculation has to be madeBuildResultsSummary
records@Nullable public Long calculateVcsUpdateDuration(@NotNull ChainResultsSummary resultsSummary)
ResultsSummaryManager
calculateVcsUpdateDuration
in interface ResultsSummaryManager
resultsSummary
- ChainResultsSummary
for which calculation has to be madeBuildResultsSummary
records@NotNull public List<Integer> findAllBuildResultsNumbers(PlanKey planKey)
findAllBuildResultsNumbers
in interface ResultsSummaryManager
public void invalidateLogSize(@NotNull PlanResultKey planResultKey)
ResultsSummaryManager
ResultsSummary
with the given PlanResultKey
.
For a BuildResultsSummary
the ChainResultsSummary
's max log size will also be invalidated.invalidateLogSize
in interface ResultsSummaryManager
planResultKey
- result key@NotNull public Range<Integer> findBuildResultNumbersRange(@NotNull PlanKey planKey)
ResultsSummaryManager
findBuildResultNumbersRange
in interface ResultsSummaryManager
public void setBuildResultsSummaryDao(BuildResultsSummaryDao buildResultsSummaryDao)
public void setExtendedAuthorManager(ExtendedAuthorManager extendedAuthorManager)
public void setBuildResultsIndexer(BuildResultsIndexer buildResultsIndexer)
public void setEventPublisher(com.atlassian.event.api.EventPublisher eventPublisher)
public void setJiraIssueUtils(JiraIssueUtils jiraIssueUtils)
public void setArtifactLinkManager(ArtifactLinkManager artifactLinkManager)
public void setCommitDao(CommitDao commitDao)
public void setBuildExecutionManager(BuildExecutionManager buildExecutionManager)
public void setRepositoryDefinitionManager(RepositoryDefinitionManager repositoryDefinitionManager)
public void setTestsManager(TestsManager testsManager)
public void setCommentManager(CommentManager commentManager)
public void setBranchIntegrationService(BranchIntegrationService branchIntegrationService)
public void setMergeResultSummaryDao(MergeResultSummaryDao mergeResultSummaryDao)
public void setVariableContextBaselineDao(VariableContextBaselineDao variableContextBaselineDao)
public void setVcsRepositoryManager(VcsRepositoryManager vcsRepositoryManager)
public void setPlanManager(PlanManager planManager)
Copyright © 2017 Atlassian Software Systems Pty Ltd. All rights reserved.