Interface ResultsSummaryManager

All Known Subinterfaces:
BuildResultsSummaryManager
All Known Implementing Classes:
BuildResultsSummaryManagerImpl

@PublicApi public interface ResultsSummaryManager
Manager for all ResultsSummary derivatives that supersedes BuildResultsSummaryManager
Since:
2.7
  • Method Details

    • createResultsSummary

      <T extends ResultsSummary> T createResultsSummary(@NotNull @NotNull BuildContext buildContext, @NotNull @NotNull Class<T> aClass) throws ResultsSummaryCreationException
      Creates a ResultsSummary of the given Class
      Type Parameters:
      T -
      Parameters:
      buildContext -
      aClass -
      Returns:
      resultsSummary
      Throws:
      ResultsSummaryCreationException
    • getResultsSummary

      @Nullable @Nullable ResultsSummary getResultsSummary(@NotNull @NotNull PlanResultKey planResultKey)
      Lookup the ResultsSummary by PlanResultKey
      Parameters:
      planResultKey -
      Returns:
      resultsSummary
    • getResultsSummary

      @Nullable @Nullable ResultsSummary getResultsSummary(long id)
      Lookup the ResultsSummary by id
      Parameters:
      id - - database id
      Returns:
      resultsSummary
    • getResultsSummary

      @Nullable @Nullable ResultsSummary getResultsSummary(@NotNull @NotNull PlanResultKey planResultKey, ResultDataRead dataRead)
      Lookup the ResultsSummary by PlanResultKey. All lazy initialized collections can be eagerly fetched to avoid session problems. Use with caution - expensive call
      Parameters:
      planResultKey -
      dataRead -
      Returns:
      resultsSummary
    • getResultsSummary

      @Nullable <T extends ResultsSummary> T getResultsSummary(@NotNull @NotNull PlanResultKey planResultKey, @NotNull @NotNull Class<T> aClass)
      Lookup ResultsSummary by PlanResultKey and expected type
      Type Parameters:
      T -
      Parameters:
      planResultKey -
      aClass -
      Returns:
      resultSummary
    • getResultsSummary

      @Nullable <T extends ResultsSummary> T getResultsSummary(@NotNull @NotNull PlanResultKey planResultKey, @NotNull @NotNull Class<T> aClass, ResultDataRead dataRead)
      Lookup ResultsSummary by PlanResultKey and expected type. All lazy initialized collections can be eagerly fetched to avoid session problems. Use with caution - expensive call
      Type Parameters:
      T -
      Parameters:
      planResultKey -
      aClass -
      dataRead -
      Returns:
      resultSummary
    • updateLifeCycleState

      void updateLifeCycleState(@NotNull @NotNull ResultsSummary resultsSummary, @NotNull @NotNull LifeCycleState lifeCycleState, @NotNull @NotNull BuildState buildState)
      Update LifeCycleState and saves the given ResultsSummary
      Parameters:
      resultsSummary - ResultsSummary to be updated and saved
      lifeCycleState - LifeCycleState to be set
      buildState - BuildState to be set
    • cleanPendingLifeCycleState

      void cleanPendingLifeCycleState(@NotNull @NotNull PlanResultKey planResultKey)
      Cleans state of pending result.
    • updateLifeCycleState

      void updateLifeCycleState(@NotNull @NotNull BuildIdentifier buildIdentifier, @NotNull @NotNull LifeCycleState lifeCycleState, @NotNull @NotNull BuildState buildState)
      Update LifeCycleState and saves the ResultsSummary for given BuildContext Updates also timing information
      Parameters:
      buildIdentifier - BuildIdentifier used to get information on ResultsSummary
      lifeCycleState - LifeCycleState to be set
      buildState - BuildState to be set
    • updateLifeCycleState

      void updateLifeCycleState(@NotNull @NotNull CurrentlyBuilding currentlyBuilding, @NotNull @NotNull LifeCycleState lifeCycleState, @NotNull @NotNull BuildState buildState)
      Update LifeCycleState and saves the ResultsSummary for given BuildContext Updates also timing information.
      Parameters:
      currentlyBuilding - in-memory state of the build
      lifeCycleState - LifeCycleState to be set
      buildState - BuildState to be set
      Since:
      9.3
    • updatePlanCompletedDate

      void updatePlanCompletedDate(@NotNull @NotNull ChainResultsSummary resultsSummary, @NotNull @NotNull Date completionDate)
      Update completed date and duration of ChainResultsSummary
      Parameters:
      resultsSummary -
      completionDate -
    • calculateAndSetDeltaState

      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. This method only updates the values on the provided results summary object, it does not save it to the database. Assumes buildState has already been set on resultsSummary.
      Parameters:
      resultsSummary - to update
    • saveResultSummary

      void saveResultSummary(@NotNull @NotNull ResultsSummary resultsSummary)
      Saves the ResultsSummary
      Parameters:
      resultsSummary -
    • addVariableContextSnapshotToResultSummary

      void addVariableContextSnapshotToResultSummary(@NotNull @NotNull ResultsSummary resultsSummary, @NotNull @NotNull VariableContext variableContext)
      Adds state of global and plan variables to result at the beginning of execution. If first argument is chain result, also adds snapshot of manual variables.
      Parameters:
      resultsSummary -
      variableContext -
    • updateVariablesOnContinuedBuild

      void updateVariablesOnContinuedBuild(@NotNull @NotNull ResultsSummary resultsSummary, @NotNull @NotNull VariableContext variableContext)
      Add manual variables added when starting manual stage or restarting failed stage. Does nothing for job results.
      Parameters:
      resultsSummary -
      variableContext -
    • clearVariablesOnRerunBuild

      void clearVariablesOnRerunBuild(@NotNull @NotNull ResultsSummary resultSummary)
      Clear stored stage manual variables when build is fully rerun. Does nothing for job results.
      Parameters:
      resultSummary -
    • postBuildVariableSnapshotUpdate

      void postBuildVariableSnapshotUpdate(@NotNull @NotNull ResultsSummary resultsSummary, @NotNull @NotNull VariableContext variableContext)
      Saves result variables produced in a job. Does nothing for chain results.
      Parameters:
      resultsSummary -
      variableContext -
    • getAllPendingResultSummaries

      @NotNull <T extends ResultsSummary> @NotNull Collection<T> getAllPendingResultSummaries(Class<T> aClass)
      Returns all the ResultsSummary in a LifeCycleState.PENDING state
      Returns:
      pendingSummaries
    • getAllQueuedResultSummaries

      @NotNull <T extends ResultsSummary> @NotNull Collection<T> getAllQueuedResultSummaries(Class<T> aClass)
      Returns all the ResultsSummary in a LifeCycleState.QUEUED state
      Returns:
      summaries
    • getAllInProgressResultSummaries

      @NotNull <T extends ResultsSummary> @NotNull Collection<T> getAllInProgressResultSummaries(Class<T> aClass)
      Returns all the ResultsSummary in a LifeCycleState.IN_PROGRESS state
      Parameters:
      aClass -
      Returns:
      summaries
    • getAllActiveResultSummariesForPlan

      @NotNull <T extends ResultsSummary> @NotNull Collection<T> getAllActiveResultSummariesForPlan(PlanKey planKey, Class<T> aClass)
      Returns all the ResultsSummary in a LifeCycleState.IN_PROGRESS state
      Parameters:
      aClass -
      Returns:
      summaries
    • getFinalizedResultSummariesForPlan

      @NotNull <T extends ResultsSummary> @NotNull List<T> 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. Results are sorted descending by build number.
      Type Parameters:
      T -
      Parameters:
      planKey -
      aClass -
      firstResult - - specifies the first result to be included in the list.
      maxResults - - specifies the length of the result; 0 for all results;
      Returns:
    • getNeighbouringSummaries

      @NotNull @NotNull List<ResultsSummary> getNeighbouringSummaries(Plan plan, int buildNumber)
      Returns all the ResultsSummary objects that matches the passed build numbers
      Parameters:
      plan -
      buildNumber -
      Returns:
      List of BuildResultsSummary
    • getNeighbouringSummaries

      @NotNull @NotNull List<ResultsSummary> getNeighbouringSummaries(@NotNull @NotNull ImmutablePlan plan, int buildNumber, int maxCount)
      Returns all the ResultsSummary objects that represent build results "around" the given build number.
      Parameters:
      plan - the plan to return results for
      buildNumber - the build number to search around
      maxCount - the maximum number of builds to return
      Returns:
      List of BuildResultsSummary in ascending order. At most there will be maxCount items in the list, inclusive of the result for buildNumber (if present).
    • getBeforeSummaries

      @NotNull @NotNull List<ResultsSummary> getBeforeSummaries(@NotNull @NotNull ImmutablePlan plan, int buildNumber, int maxCount)
      Returns all the ResultsSummary objects that represent build results strictly before the given build number.
      Parameters:
      plan - the plan to return results for
      buildNumber - the build number to search before
      maxCount - the maximum number of builds to return
      Returns:
      List of BuildResultsSummary in ascending order. At most there will be maxCount items in the list, exclusive of the result for buildNumber (if present).
    • getAfterSummaries

      @NotNull @NotNull List<ResultsSummary> getAfterSummaries(@NotNull @NotNull ImmutablePlan plan, int buildNumber, int maxCount)
      Returns all the ResultsSummary objects that represent build results strictly after the given build number.
      Parameters:
      plan - the plan to return results for
      buildNumber - the build number to search after
      maxCount - the maximum number of builds to return
      Returns:
      List of BuildResultsSummary in ascending order. At most there will be maxCount items in the list, exclusive of the result for buildNumber (if present).
    • getNumberOfConcurrentlyRunningBuilds

      int getNumberOfConcurrentlyRunningBuilds(PlanKey planKey)
      Gets the number of concurrently running builds
      Parameters:
      planKey -
      Returns:
    • getAllBuildResultSummariesInUnknownState

      @NotNull <T extends ResultsSummary> @NotNull Collection<T> getAllBuildResultSummariesInUnknownState(Class<T> aClass)
      Returns all the BuildResultsSummary in a BuildState.UNKNOWN state
      Returns:
      summaries
    • findLastResultBefore

      @Nullable <T extends ResultsSummary> T findLastResultBefore(@NotNull @NotNull PlanResultKey planResultKey, Class<T> aClass)
      Finds the last successful or failing ResultsSummary before planResultKey.getBuildNumber
      Parameters:
      planResultKey -
      aClass -
      Returns:
    • findLastResultBefore

      @Nullable <T extends ResultsSummary> T findLastResultBefore(@NotNull @NotNull PlanResultKey planResultKey, Class<T> aClass, boolean includeOnceOffBuilds)
      Finds the last ResultsSummary before planResultKey.getBuildNumber
      Parameters:
      planResultKey -
      aClass -
      includeOnceOffBuilds - - should we skip once-off builds or include them in the search
      Returns:
    • getChainStageResultById

      @Nullable @Nullable ChainStageResult getChainStageResultById(@NotNull @NotNull Long id)
      Returns a ChainStageResult by its id
      Returns:
      chainStageResult
    • getNumberOfResults

      long getNumberOfResults()
      Get number of all ResultsSummarys
      Returns:
      number of summaries
    • getNumberOfFinishedResults

      long getNumberOfFinishedResults(@NotNull @NotNull Plan plan)
      Get number of the ResultsSummarys in LifeCycleState.FINISHED state for the given Plan
      Parameters:
      plan -
      Returns:
      number of summaries
    • getNumberOfFinalizedResults

      long getNumberOfFinalizedResults(@NotNull @NotNull ImmutablePlan plan)
      Get number of the ResultsSummarys in a LifeCycleState.FINISHED or LifeCycleState.NOT_BUILT state for the given Plan
      Parameters:
      plan -
      Returns:
      number of summaries
    • getNumberOfFinalizedResults

      long getNumberOfFinalizedResults(@NotNull @NotNull PlanKey planKey)
      Get number of the ResultsSummarys in a LifeCycleState.FINISHED or LifeCycleState.NOT_BUILT state for the given Plan
      Parameters:
      planKey -
      Returns:
      number of summaries
      Since:
      6.9
    • getResultSummariesForPlan

      @NotNull <T extends ResultsSummary> @NotNull List<T> getResultSummariesForPlan(@NotNull @NotNull ImmutablePlan plan, int firstResult, int maxResults)
      Get the ResultsSummarys 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.
      Type Parameters:
      T -
      Parameters:
      plan -
      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.
      Returns:
      summaries
    • getResultSummariesForPlanByLifeCycleState

      @NotNull <T extends ResultsSummary> @NotNull List<T> getResultSummariesForPlanByLifeCycleState(@NotNull @NotNull Plan plan, @NotNull @NotNull LifeCycleState lifeCycleState, int firstResult, int maxResults)
      Get the ResultsSummarys 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.
      Type Parameters:
      T -
      Parameters:
      plan -
      lifeCycleState -
      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.
      Returns:
      summaries
    • getAveragePlanExecutionDuration

      long getAveragePlanExecutionDuration(@NotNull @NotNull ImmutablePlan plan, int numberOfResults)
      Get average duration from n last results summaries in finished state for a plan. Results in SUCCESSFUL state are preferred; only if there are none those in FAILED state are selected.
      Parameters:
      plan -
      numberOfResults - amount of results to be taken into account for average calculation
      Returns:
      average duration in milliseconds or 0 if there is no results
    • getLastResultsSummary

      <T extends ResultsSummary> T getLastResultsSummary(@NotNull @NotNull String planKey, Class<T> aClass)
      Get the last ResultsSummary for planKey and Class
      Type Parameters:
      T -
      Parameters:
      planKey -
      aClass -
      Returns:
    • getLastResultsSummary

      <T extends ResultsSummary> T getLastResultsSummary(@NotNull @NotNull String planKey, Class<T> aClass, boolean ignoreSpecsResults)
      Get the last ResultsSummary for planKey and Class with possible skip of specs results.
      Type Parameters:
      T -
      Parameters:
      planKey -
      aClass -
      ignoreSpecsResults -
      Returns:
    • getLastSuccessfulResultSummary

      @Nullable @Nullable ResultsSummary getLastSuccessfulResultSummary(@NotNull @NotNull PlanKey planKey)
      Get the last successful ResultsSummary for planKey
      Parameters:
      planKey -
      Returns:
    • removeResultsSummariesForPlan

      int removeResultsSummariesForPlan(@NotNull @NotNull Plan plan, @NotNull @NotNull List<PlanKey> affectedJobKeys)
      Remove all resultSummary objects for the given plan. Time-cost of this method might be significant if there are thousands of ResultsSummary objects to be deleted.
      Parameters:
      plan - to remove results for.
      affectedJobKeys - identifiers of jobs related to the plan you want to remove results for.
      Returns:
      number of ResultsSummarys removed
      Since:
      10.1
    • removeResultsSummariesForPlan

      int removeResultsSummariesForPlan(@NotNull @NotNull Plan plan)
      Remove all resultSummary objects for the given plan. Time-cost of this method might be significant if there are thousands of ResultsSummary objects to be deleted.
      Parameters:
      plan - to remove results for.
      Returns:
      number of ResultsSummarys removed
    • removeAllOrphanedResultSummaries

      int removeAllOrphanedResultSummaries()
      Removes all the ResultsSummary objects in the database that do not have a matching Plan
      Returns:
      number of ResultsSummarys removed
    • findFirstFailedBuildResultAfter

      @Nullable @Nullable ResultsSummary findFirstFailedBuildResultAfter(@NotNull @NotNull String buildKey, int buildNumber)
      Finds the first failed ResultsSummary after buildNumber
      Parameters:
      buildKey -
      buildNumber -
      Returns:
      buildResult
    • findFirstSuccessfulBuildResultAfter

      @Nullable @Nullable ResultsSummary findFirstSuccessfulBuildResultAfter(@NotNull @NotNull PlanResultKey planResultKey)
      Finds the last successful ResultsSummary after buildNumber
      Parameters:
      planResultKey -
      Returns:
      buildResult
    • findLastSuccessfulBuildResultBefore

      @Nullable @Nullable ResultsSummary findLastSuccessfulBuildResultBefore(@NotNull @NotNull PlanResultKey planResultKey)
      Finds the last successful ResultsSummary before build
      Parameters:
      planResultKey -
      Returns:
      buildResult
    • findLastSuccessfulBuildResultBefore

      @Nullable @Nullable ResultsSummary findLastSuccessfulBuildResultBefore(@NotNull @NotNull PlanResultKey planResultKey, boolean includeOnceOffBuilds)
      Finds the last successful ResultsSummary before build
      Since:
      6.8.1
    • findLastFailingBuildResultBefore

      @Nullable @Nullable ResultsSummary findLastFailingBuildResultBefore(@NotNull @NotNull ImmutablePlan build, int buildNumber)
      Finds the last failing ResultsSummary before buildNumber
      Parameters:
      build -
      buildNumber -
      Returns:
      buildResult
    • findLastFailingBuildResultBefore

      @Nullable @Nullable ResultsSummary findLastFailingBuildResultBefore(@NotNull @NotNull PlanKey planKey, int buildNumber)
      Finds the last failing ResultsSummary before buildNumber
      Returns:
      buildResult
    • findFirstFailedBuildResultBetween

      @Nullable @Nullable ResultsSummary findFirstFailedBuildResultBetween(@NotNull @NotNull PlanKey planKey, int lowerBuildNumber, int upperBuildNumber)
      Finds the first failed build between the upper and lower build numbers inclusively.*
    • findFirstFailedBuildResultBetween

      @Nullable @Nullable ResultsSummary findFirstFailedBuildResultBetween(@NotNull @NotNull ImmutablePlan build, int lowerBuildNumber, int upperBuildNumber)
      Finds the first failed build between the upper and lower build numbers inclusively.
      Parameters:
      build -
      lowerBuildNumber -
      upperBuildNumber -
      Returns:
      buildResults
    • findLastBuildResultBefore

      @Nullable @Nullable ResultsSummary findLastBuildResultBefore(@NotNull @NotNull String buildKey, int buildNumber)
      Finds the last successful or failing BuildResultsSummary before buildNumber
      Parameters:
      buildKey -
      buildNumber -
      Returns:
    • findLastBuildResultBeforeWithTests

      @Nullable <T extends ResultsSummary> T findLastBuildResultBeforeWithTests(@NotNull @NotNull PlanResultKey planResultKey, @NotNull @NotNull Class<T> aClass, boolean includeOnceOffBuilds)
      Finds the last successful or failing BuildResultsSummary before buildNumber
      Parameters:
      planResultKey -
      includeOnceOffBuilds - should once-off builds be considered or ignored in the search
      aClass -
      Returns:
      resultsSummary
    • getBreakingBuild

      @Nullable @Nullable ResultsSummary getBreakingBuild(ResultsSummary buildResultsSummary)
      Returns the first failing build after the last successful build. ie the latest build before this one with the delta state "broken"
      Parameters:
      buildResultsSummary - of the current build
      Returns:
      null if there is no breaking build.
    • getFixingBuild

      @Nullable @Nullable ResultsSummary getFixingBuild(ResultsSummary buildResultsSummary)
      Returns the first successful ResultsSummary for given ResultsSummary. The input build is returned if it is successful.
      Parameters:
      buildResultsSummary -
      Returns:
      null if there is no fixing build.
    • getLatestResultSummaries

      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
      Returns:
      List of ResultsSummary
    • getLatestFailedResultSummaries

      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
      Returns:
      List of ResultsSummary
    • getLastNResultsSummaries

      @NotNull @NotNull List<ResultsSummary> getLastNResultsSummaries(@NotNull @NotNull PlanIdentifier planIdentifier, int numberOfResults)
      Provides a list of the latest N results summaries for the given plan, newest first.
      Parameters:
      planIdentifier - - to get the results for
      numberOfResults - - number of summaries you would like
      Returns:
      list<ResultsSummary>
    • getLastNResultsSummaries

      @Deprecated @NotNull default @NotNull List<ResultsSummary> getLastNResultsSummaries(@NotNull @NotNull ImmutablePlan plan, int numberOfResults)
      Deprecated.
      Provides a list of the latest N results summaries for the given plan, newest first.
      Parameters:
      plan - - to get the results for
      numberOfResults - - number of summaries you would like
      Returns:
      list<ResultsSummary>
    • getLastNFailedResultsSummaries

      @NotNull @NotNull List<ResultsSummary> getLastNFailedResultsSummaries(@NotNull @NotNull PlanIdentifier planIdentifier, int numberOfResults)
      Returns the most recent n failed build results. Sorted by newest first.
      Parameters:
      planIdentifier -
      numberOfResults - must be > 0
    • getAnyResultSummary

      @Nullable <T extends ResultsSummary> T getAnyResultSummary(@NotNull @NotNull ResultsSummaryCriteria criteria, ResultDataRead dataRead)
      Generic search to find any result summary basing on the criteria provided. Note that if criteria does not specify order then result of this method might be non-deterministic.
      Parameters:
      criteria - containing all the search constraints
      Returns:
      any resultSummary matching the criteria or null.
    • getResultSummaries

      @NotNull <T extends ResultsSummary> @NotNull List<T> getResultSummaries(@NotNull @NotNull ResultsSummaryCriteria criteria)
      Generic search to find any result summaries basing on the criteria provided.
      Parameters:
      criteria - containing all the search constraints
      Returns:
      list of resultsSummaries matching the criteria.
    • getResultSummariesForExpiry

      @NotNull <T extends ResultsSummary> @NotNull List<T> getResultSummariesForExpiry(@NotNull @NotNull ExpiryCriteria expiryCriteria)
      Searches for result summaries according to the given criteria for use in build expiry.
      Type Parameters:
      T - type of returned results (determined by the criteria)
      Parameters:
      expiryCriteria - search constraints
      Returns:
      list of results summaries matching the criteria
    • findJiraIssuesForResults

      @NotNull @NotNull List<LinkedJiraIssue> findJiraIssuesForResults(@NotNull @NotNull List<ResultsSummary> buildResults)
      Retrieves a list of LinkedJiraIssue linked to the given build result summaries
      Parameters:
      buildResults - to look for issues attached to
      Returns:
      a list of LinkedJiraIssue linked to the given build result summaries
    • findJiraIssuesForPlanKey

      @NotNull @NotNull List<LinkedJiraIssue> findJiraIssuesForPlanKey(@NotNull @NotNull PlanKey planKey)
      Retrieves a list of LinkedJiraIssue linked to the given plan key
      Parameters:
      planKey - to look for issues associated with plan of this key
      Returns:
      a list of LinkedJiraIssue linked to the given Plan
    • findResultsSummariesByJiraIssues

      @NotNull @NotNull List<? extends ResultsSummary> findResultsSummariesByJiraIssues(@Nullable @Nullable List<String> issueKeys)
      Finds a list of results which are linked to the given issue keys
      Parameters:
      issueKeys - to search for
      Returns:
      al list of ResultsSummary associated with any of the given list of issue keys
    • findResultsSummariesByProjectKey

      @NotNull @NotNull List<? extends ResultsSummary> findResultsSummariesByProjectKey(@Nullable @Nullable String projectKey)
      Provide a list of results which are linked to any issues under the given jira project key
      Parameters:
      projectKey - - jira project key
      Returns:
      a list of results which are linked to any issues under the given jira project key
    • getParentResultSummary

      @Nullable @Nullable ChainResultsSummary getParentResultSummary(ResultsSummary resultsSummary)
      Get (@link ChainResultsSummary} containing given ResultsSummary
      Parameters:
      resultsSummary -
      Returns:
    • getStageForResult

      @Nullable @Nullable ChainStageResult getStageForResult(ResultsSummary resultsSummary)
      Get (@link ChainStageResult} containing given ResultsSummary
      Parameters:
      resultsSummary -
      Returns:
    • removeResultSummary

      void removeResultSummary(@NotNull @NotNull ImmutablePlan plan, int buildNumber)
      Remove plan result summary and all associated objects.
      Parameters:
      plan -
      buildNumber -
    • removeResultSummary

      void removeResultSummary(@NotNull @NotNull ResultsSummary resultsSummary)
      Remove plan result summary and all associated objects.
      Since:
      6.9
    • removeResultSummary

      void removeResultSummary(@NotNull @NotNull PlanResultKey planResultKey)
      Remove plan result summary and all associated objects.
      Since:
      6.9
    • removeArtifacts

      void removeArtifacts(@NotNull @NotNull ImmutablePlan plan, int buildNumber) throws IOException
      Remove any artifacts stored for this plan result
      Parameters:
      plan -
      buildNumber -
      Throws:
      IOException
    • removeArtifacts

      void removeArtifacts(@NotNull @NotNull ResultsSummary resultsSummary) throws IOException
      Remove any artifacts stored for this plan result
      Parameters:
      resultsSummary -
      Throws:
      IOException
    • removeMatchingArtifacts

      void removeMatchingArtifacts(@NotNull @NotNull ResultsSummary resultsSummary, @NotNull @NotNull Predicate<ArtifactLink> predicate) throws IOException
      Remove artifacts from results summary that match a predicate.
      Parameters:
      resultsSummary -
      predicate -
      Throws:
      IOException
    • removeBuildLogs

      void removeBuildLogs(ImmutablePlan plan, int buildNumber)
      Remove any build logs stored for this plan result
      Parameters:
      plan -
      buildNumber -
    • removeBuildLogs

      void removeBuildLogs(@NotNull @NotNull ResultsSummary resultsSummary)
      Remove any build logs stored for this plan result
      Parameters:
      resultsSummary -
    • removeBuildLogs

      void removeBuildLogs(ImmutablePlan plan, int buildNumber, long maxIgnoredLogSize)
      Remove build logs stored for this plan result that are greater than given size (in bytes).
      Parameters:
      plan -
      buildNumber -
      maxIgnoredLogSize -
    • removeBuildLogs

      void removeBuildLogs(@NotNull @NotNull ResultsSummary resultsSummary, long maxIgnoredLogSize)
      Remove build logs stored for this plan result that are greater than given size (in bytes).
      Parameters:
      resultsSummary -
      maxIgnoredLogSize -
    • findChainResultsWithJobLabelled

      List<ChainResultsSummary> findChainResultsWithJobLabelled(ResultsSummaryCriteria criteria, List<Label> labels)
      Searches through all chains to find any that have jobs which match the given labels. The list of chains is then filtered if required, using other criteria elements. Currently the only used criteria are:
      • buildKey
      • toBuildDate
      • toBuildNumber
      This is to ensure performance is consistant and reduce the possibility of conflicts.
      Parameters:
      criteria - containing the restrictions for the chains to be returned
      labels - that the jobs can be associated with
      Returns:
      list of ChainResultSummary that match the criteria and have jobs with any of the given labels
    • moveResultSummaries

      void moveResultSummaries(@NotNull @NotNull Plan newParentPlan, @NotNull @NotNull PlanKey oldPlanKey, @NotNull @NotNull PlanKey newPlanKey)
      Reassigns plan key ResultsSummaries associated with selected plan key.
      Parameters:
      newParentPlan - the new parent plan of result summaries. This should be a plan, not a job.
    • scrollResultSummaries

      long scrollResultSummaries(@NotNull @NotNull String buildKey, @NotNull @NotNull Function<ResultsSummary,Void> function)
      Scroll through and execute function for each of BuildResultsSummary Objects passed to function are not fully initialized. Collections are empty and related objects have only id set.
      Parameters:
      buildKey - of the plan you want to scroll the result summaries for
      function - function to be executed on each of the BuildResultSummary
      Returns:
      number of traversed rows
    • scrollResultSummaries

      long scrollResultSummaries(@NotNull @NotNull String buildKey, ResultDataRead resultDataRead, @NotNull @NotNull Function<ResultsSummary,Void> function)
      Scroll through and execute function for each of ResultsSummary (Build and Chain) Objects passed to function are not fully initialized. Collections are empty and related objects have only id set.
      Parameters:
      buildKey - of the plan you want to scroll the result summaries for
      resultDataRead - if the data should be loaded lazy or eagerly
      function - function to be executed on each of the BuildResultSummary
      Returns:
      number of traversed rows
    • findFirstResultAfter

      @Nullable <T extends ResultsSummary> T findFirstResultAfter(@NotNull @NotNull PlanResultKey planResultKey, Class<T> aClass)
      Finds the first ResultsSummary after a specified build which is either FINISHED or can be FINISHED, i.e. is not in NOT_BUILT state.
      Parameters:
      planResultKey -
      aClass -
      Returns:
    • findLastResultSummaryWithState

      @Nullable <T extends ResultsSummary> T findLastResultSummaryWithState(@NotNull @NotNull PlanKey planKey, @NotNull @NotNull BuildState buildState, @NotNull @NotNull Class<T> aClass)
      Type Parameters:
      T -
      Parameters:
      planKey -
      buildState -
      aClass -
      Returns:
      the last ResultsSummary with the provided BuildState
    • findLastResultSummaryWithState

      @Nullable <T extends ResultsSummary> T findLastResultSummaryWithState(@NotNull @NotNull PlanKey planKey, @NotNull @NotNull BuildState buildState, @NotNull @NotNull Class<T> aClass, boolean ignoreSpecsResults)
      Type Parameters:
      T -
      Parameters:
      planKey -
      buildState -
      aClass -
      ignoreSpecsResults -
      Returns:
      the last ResultsSummary with the provided BuildState
    • getResultSummariesByChangeSetId

      @NotNull <T extends ResultsSummary> @NotNull List<T> getResultSummariesByChangeSetId(@NotNull @NotNull String changeSetId, @NotNull @NotNull Class<T> discriminator)

      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 getResultSummariesByCheckoutChangesetId(String, Class)

      Type Parameters:
      T - extends ResultSummary
      Parameters:
      changeSetId - of the commit
      discriminator - class of the ResultSummary interface required
      Returns:
      List of ResultsSummary (ResultSummary as determined by discriminator) containing a commit with the given changeSetId
    • getResultSummariesByCheckoutChangesetId

      @NotNull <T extends ResultsSummary> @NotNull List<T> getResultSummariesByCheckoutChangesetId(@NotNull @NotNull String changeSetId, @NotNull @NotNull Class<T> discriminator)

      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 getResultSummariesByChangeSetId(String, Class)

      Type Parameters:
      T - extends ResultSummary
      Parameters:
      changeSetId - of the checkout commit
      discriminator - class of the ResultSummary interface required
      Returns:
      List of ResultsSummary (ResultSummary as determined by discriminator) containing a repository which was checked out with a changeSetId commit
    • getResultSummariesByChangeSetIdAndRepository

      @NotNull <T extends ResultsSummary> @NotNull List<T> getResultSummariesByChangeSetIdAndRepository(long repositoryId, @NotNull @NotNull String changeSetId, @NotNull @NotNull Class<T> discriminator)
      Get a list of all build results containing a commit with the given changeset ID that are in the given repository.
      Type Parameters:
      T - extends ResultSummary
      Parameters:
      repositoryId - of the repository
      changeSetId - of the commit
      discriminator - class of the ResultSummary interface required
      Returns:
      List of ResultsSummary (ResultSummary as determined by discriminator) containing a commit with the given changeSetId
      Since:
      5.7
    • getResultSummariesByChangeSetIds

      @NotNull <T extends ResultsSummary> @NotNull List<T> getResultSummariesByChangeSetIds(@NotNull @NotNull List<String> changeSetIds, Class<T> discriminator)
      Get a list of all build results containing a commit with any of the given changeset IDs.

      Type Parameters:
      T - extends ResultSummary
      Parameters:
      changeSetIds - of the commit
      discriminator - class of the ResultSummary interface required
      Returns:
      List of ResultsSummary (ResultSummary as determined by discriminator) containing a commit with any of the given changeSetIds
    • getResultSummariesByChangeSetIds

      @NotNull <T extends ResultsSummary> @NotNull List<T> getResultSummariesByChangeSetIds(@NotNull @NotNull 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.

      Type Parameters:
      T - extends ResultSummary
      Parameters:
      changeSetIds - of the commit anding with the repository that commit came from
      discriminator - class of the ResultSummary interface required
      Returns:
      List of ResultsSummary (ResultSummary as determined by discriminator) containing a commit with any of the given changeSetIds
    • getCommitsForUser

      @NotNull @NotNull List<UnassociatedCommit> getCommitsForUser(@NotNull @NotNull String username, int max)
      Retrieve a list of recent Commits for the given user. Items in the collection are unique and sorted by date.
      Parameters:
      username - to filter commits by
      max - maximum number of commits to get.
      Returns:
      a list of recent Commits for the given user
    • countResultsWithState

      int countResultsWithState(@NotNull @NotNull PlanKey planKey, int lowerBuildNumber, int upperBuildNumber, @NotNull @NotNull BuildState buildState)
      Counts results with a given state in a given build number range for plan.
      Parameters:
      planKey - the key of plan to analyse
      lowerBuildNumber - the build number to start the count with
      upperBuildNumber - the build number to end the count with
      buildState - the state that will be counted
      Returns:
      the count
    • updateProcessingDuration

      void updateProcessingDuration(ChainResultsSummary resultSummary)
      Parameters:
      resultSummary -
    • markResultSummariesForDeletion

      int markResultSummariesForDeletion(@NotNull @NotNull PlanKey planKey)
      Mass update of all ResultsSummary records in the database related to a Plan identified by planKey.
      Parameters:
      planKey - key of a plan
      Returns:
      number of updated records
    • updateResultSummaryWithBuildChanges

      void updateResultSummaryWithBuildChanges(@NotNull @NotNull BuildContext buildContext) throws ResultsSummaryCreationException
      Throws:
      ResultsSummaryCreationException
    • resetResultSummary

      ResultsSummary resetResultSummary(@NotNull @NotNull BuildResultsSummary resultsSummary) throws IOException
      Prepare result summry to be reuse for plan rerun
      Parameters:
      resultsSummary -
      Returns:
      Throws:
      IOException
    • removeMergeResultSummary

      void removeMergeResultSummary(@NotNull @NotNull MergeResultSummary mergeResult)
      Removes merge result. Use with care.
      Since:
      5.0
    • getPlanKeysSortedByNumberOfFinalizedResultSummaries

      @Internal @NotNull @NotNull List<PlanKey> getPlanKeysSortedByNumberOfFinalizedResultSummaries()
    • calculateQueueDuration

      @Nullable @Nullable Long calculateQueueDuration(@NotNull @NotNull ChainResultsSummary resultsSummary)
      Calculates queueDuration value for a chain result as a maximum value of (vcsUpdateTime - queueTime) for all related job results.
      Parameters:
      resultsSummary - ChainResultsSummary for which calculation has to be made
      Returns:
      queueDuration value or null if there are no related BuildResultsSummary records
      Since:
      5.4
    • calculateVcsUpdateDuration

      @Nullable @Nullable Long calculateVcsUpdateDuration(@NotNull @NotNull ChainResultsSummary resultsSummary)
      Calculates vcsUpdateDuration value for a chain result as a maximum value of (buildDate - vcsUpdateTime) for all related job results.
      Parameters:
      resultsSummary - ChainResultsSummary for which calculation has to be made
      Returns:
      vcsUpdateDuration value or null if there are no related BuildResultsSummary records
      Since:
      5.4
    • findAllBuildResultsNumbers

      @NotNull @NotNull List<Integer> findAllBuildResultsNumbers(PlanKey planKey)
    • invalidateLogSize

      void invalidateLogSize(@NotNull @NotNull PlanResultKey planResultKey)
      Invalidates the log size of a ResultsSummary with the given PlanResultKey.

      For a BuildResultsSummary the ChainResultsSummary's max log size will also be invalidated.

      Parameters:
      planResultKey - result key
    • findBuildResultNumbersRange

      @NotNull @NotNull Range<Integer> findBuildResultNumbersRange(@NotNull @NotNull PlanKey planKey)
      Finds minimum and maximum build number for a plan. Works for both chains and jobs.
      Parameters:
      planKey -
      Returns:
      (min, max) pair or (0,0) if there are no results.
    • findChainResultsWithFormatVersionLessThan

      @Deprecated @NotNull @NotNull List<PlanResultKey> findChainResultsWithFormatVersionLessThan(int formatVersion, int maxResults)
      Deprecated.
      internal use only
    • findJobKeysFromExistingChainResults

      @NotNull @NotNull List<PlanKey> findJobKeysFromExistingChainResults(@NotNull @NotNull PlanKey chainKey)
      Find keys of jobs for which results associated with given plan exist. The jobs themselves might no longer exist. Internal use only
      Since:
      6.9
    • findMinimumBuildNumberForNLatest

      int findMinimumBuildNumberForNLatest(@NotNull @NotNull PlanKey planKey, int n)
      Find a build number for which exist n non-specs results with a build number greater or equal. If the build has less that n such results, the lowest build number is returned.
      Since:
      7.1