Interface DeploymentResultService

    • Method Detail

      • getDeploymentResult

        @Nullable
        @Nullable DeploymentResult getDeploymentResult​(long deploymentResultId)
                                                throws org.acegisecurity.AccessDeniedException
        Retrieve a specific deployment result.
        Parameters:
        deploymentResultId - of the result
        Returns:
        deployment result with given id
        Throws:
        org.acegisecurity.AccessDeniedException - when logged in user don't have permissions to view deployment environment for deployment result
      • getLatestDeploymentResult

        @Nullable
        @Nullable DeploymentResult getLatestDeploymentResult​(long environmentId,
                                                             long deploymentVersionId)
        Retrieve a specific deployment result for an environment and version. There should only be one result per environment/version combination. Entirely possible it has not executed yet so will return null;
        Parameters:
        environmentId - of the environment
        deploymentVersionId - of the version
        Returns:
        deployment result for a version against an environment.
      • getDeploymentResultsForEnvironment

        @Deprecated
        @NotNull
        @NotNull List<DeploymentResult> getDeploymentResultsForEnvironment​(long environmentId,
                                                                           int offset,
                                                                           int maxResults)
        Deprecated.
        Get deployment results for environment. Sorted by started date, newest first, skips a number of results defined in 'offset' parameter, limits to 'maxResults'
        Parameters:
        environmentId - id of environment to get results from
        offset -
        maxResults -
        Returns:
        List of deployment results
        Since:
        5.1.2
      • getDeploymentResultsForEnvironmentWithoutVariables

        @NotNull
        @NotNull List<DeploymentResult> getDeploymentResultsForEnvironmentWithoutVariables​(long environmentId,
                                                                                           int offset,
                                                                                           int maxResults)
        Get deployment results for environment. Sorted by started date, newest first, skips a number of results defined in 'offset' parameter, limits to 'maxResults'
        Parameters:
        environmentId - id of environment to get results from
        offset -
        maxResults -
        Returns:
        List of deployment results
        Since:
        6.7
      • getSuccessfulDeploymentResultsForEnvironment

        @NotNull
        @NotNull List<DeploymentResult> getSuccessfulDeploymentResultsForEnvironment​(long environmentId,
                                                                                     int offset,
                                                                                     int maxResults)
        Get successful deployment results for environment. Sorted by started date, newest first, skips a number of results defined in 'offset' parameter, limits to 'maxResults'
        Parameters:
        environmentId - id of environment to get results from
        offset -
        maxResults -
        Returns:
        List of successful deployment results
        Since:
        5.7
      • getDeploymentResultsForDeploymentVersion

        @NotNull
        @NotNull List<DeploymentResult> getDeploymentResultsForDeploymentVersion​(long deploymentVersionId)
        Get all deployment results for deployment version. Sorted by started date, newest first. This method could return significant sets of data and is a potential problem due to performance reasons
        Parameters:
        deploymentVersionId - id of deployment version to get results from
        Returns:
        List of deployment results sorted by started data (newest first)
        Since:
        5.7
      • getDeploymentResultsForDeploymentVersionAndEnvironment

        @NotNull
        @NotNull List<DeploymentResult> getDeploymentResultsForDeploymentVersionAndEnvironment​(long deploymentVersionId,
                                                                                               long environmentId)
        Get all deployment results for deployment versions that ran against the specified environment.
        Parameters:
        deploymentVersionId - id of deployment version
        environmentId - id of environment
        Returns:
        List of deployment results sorted by started date (newest first)
      • getDeploymentResultsForDeploymentVersionFinishedBefore

        @Deprecated
        @NotNull
        @NotNull List<DeploymentResult> getDeploymentResultsForDeploymentVersionFinishedBefore​(long deploymentVersionId,
                                                                                               Date finishDate)
        Deprecated.
        since 5.10 on account of it potentially consuming lots of memory. Consider getDeploymentResultIdsForDeploymentVersionFinishedBefore(long, Date) instead.
        Get all deployment results for deployment version finished before given date. Sorted by started date, newest first. This method could return significant sets of data and is a potential problem due to performance reasons
        Parameters:
        deploymentVersionId - id of deployment version to get results from
        finishDate - only select results finished before this date
        Returns:
        List of deployment results sorted by started data (newest first)
        Since:
        5.5
      • getDeploymentResultIdsForDeploymentVersionFinishedBefore

        @NotNull
        @NotNull List<Long> getDeploymentResultIdsForDeploymentVersionFinishedBefore​(long deploymentVersionId,
                                                                                     @NotNull
                                                                                     @NotNull Date finishDate)
        Get ids of all deployment results for deployment version finished before given date. Sorted by started date, oldest first.
        Parameters:
        deploymentVersionId - id of deployment version to get results from
        finishDate - only select results finished before this date
        Returns:
        List of deployment results sorted by started data (oldest first)
      • countDeploymentResultsForEnvironment

        int countDeploymentResultsForEnvironment​(long environmentId)
        Count deployment results for deployment.
        Parameters:
        environmentId -
        Returns:
        Since:
        5.1.2
      • getLatestDeploymentResultForEnvironment

        @Nullable
        @Nullable DeploymentResult getLatestDeploymentResultForEnvironment​(long environmentId)
        Get the latest result that ran against an environment
        Parameters:
        environmentId - id of the environment
        Returns:
        the latest result. Null if not run
      • getLatestKnownDeploymentResultForEnvironments

        @NotNull
        @Deprecated
        @NotNull List<EnvironmentStatus> getLatestKnownDeploymentResultForEnvironments​(Iterable<? extends Environment> environments)
        Deprecated.
        Get the latest results that *actually* ran against a list of environments. Any NOT_BUILT results are skipped, so you can see the state of that particular environment. Wraps the return into EnvironmentStatus'
        Parameters:
        environments - we want to retrieve latest DeploymentResult
        Returns:
        the List of EnvironmentStatus that contain latest results.
      • getLatestKnownDeploymentResultForEnvironmentsInProject

        @NotNull
        @NotNull List<EnvironmentStatus> getLatestKnownDeploymentResultForEnvironmentsInProject​(@NotNull
                                                                                                @NotNull DeploymentProject deploymentProject)
        Get the latest results that *actually* ran against a list of environments. Any NOT_BUILT results are skipped, so you can see the state of that particular environment. Wraps the return into EnvironmentStatus' The variables contexts _are not fetched_
        Parameters:
        deploymentProject - we want to retrieve latest DeploymentResults for
        Returns:
        the List of EnvironmentStatus that contain latest results.
        Since:
        6.8
      • updateLifeCycleState

        void updateLifeCycleState​(long deploymentResultId,
                                  @NotNull
                                  @NotNull LifeCycleState lifeCycleState)
        Update lifecycle state of the DeploymentResult. This method expects only PENDING and NOT_BUILD lifeCycleState.
        Parameters:
        deploymentResultId - id of DeploymentResult
        lifeCycleState - lifecycle state to be set
      • updateLifeCycleState

        void updateLifeCycleState​(@NotNull
                                  @NotNull DeploymentTimingPoint timingPoint,
                                  @NotNull
                                  @NotNull LifeCycleState lifeCycleState)
        Update lifecycle state of the DeploymentResult
        Parameters:
        timingPoint - deployment timing point
        lifeCycleState - lifecycle state to be set
      • setExecutingAgent

        void setExecutingAgent​(long deploymentResultId,
                               long agentId)
        Set the agent that the deployment is executing on.
        Parameters:
        deploymentResultId - id of the deployment result
        agentId - if of the agent
      • updateDeploymentState

        void updateDeploymentState​(long deploymentResultId,
                                   @NotNull
                                   @NotNull BuildState buildState,
                                   Map<String,​String> customData)
        Update the build state of the Deployment Result
        Parameters:
        deploymentResultId - if of result to update
        buildState - new value of the build state to save
        customData -
      • getRollbackVersion

        @Nullable
        @Nullable DeploymentVersion getRollbackVersion​(long environmentId)
        For a given environment find the version that existed on the environment prior to the last deployment. This is the version that you would "Roll back" to in the case of problems.
        Parameters:
        environmentId - to find rollback version for.
        Returns:
        the version that is considered the rollback version for this environment
      • getRollbackVersion

        @Nullable
        @Nullable DeploymentVersion getRollbackVersion​(@NotNull
                                                       @NotNull DeploymentResult deploymentResult)
        For a given deployment result find the version that existed on the environment before that deployment.
        Parameters:
        deploymentResult - deployment result that was deployed at some time on some environment
        Returns:
        deployment that was previously on same environment
      • findEnvironmentIdsVersionWasDeployedOn

        @NotNull
        @NotNull Set<Long> findEnvironmentIdsVersionWasDeployedOn​(long deploymentVersionId)
        Parameters:
        deploymentVersionId -
        Returns:
        ids of all environments a version was ever deployed on
      • getResultsWhereDeploymentVersionIsDeployedNow

        @NotNull
        @NotNull List<DeploymentResult> getResultsWhereDeploymentVersionIsDeployedNow​(List<Long> environmentsId,
                                                                                      long deploymentVersionId)
        Parameters:
        environmentsId - list of environments to check
        deploymentVersionId -
        Returns:
        list of deployment results that are now deployed on given environments
      • getLastResultBefore

        @Nullable
        @Nullable DeploymentResult getLastResultBefore​(@NotNull
                                                       @NotNull DeploymentResult deploymentResult)
        Returns:
        result of the last deployment performed on an environment before given result
      • getLastResultInStatesBefore

        @Nullable
        @Nullable DeploymentResult getLastResultInStatesBefore​(@NotNull
                                                               @NotNull DeploymentResult deploymentResult,
                                                               @NotNull
                                                               @NotNull EnumSet<BuildState> buildStates)
        Returns:
        result of the last deployment performed on an environment before given result in one of given states
      • getLatestStatusForAllEnvironments

        @Deprecated
        Map<Long,​EnvironmentStatus> getLatestStatusForAllEnvironments​(Map<Long,​Environment> environmentsById,
                                                                            Map<Long,​DeploymentProject> deploymentProjectsById)
        Deprecated.
        Parameters:
        environmentsById - pass all visible environments. Any environments not passed will not have results returned. This can technically be used to retrieve deployment results for a subset of environments but it's only efficient for significant sets. By definition this should not contain any environments without visible projects.
        deploymentProjectsById - All visible deployment projects.
        Returns:
        the latest environment status for each environment in the system as a map of environment Id to EnvironmentStatus. Environments that have not been deployed will have a status with no result. Note that this is potentially a very slow operation and should be called only when most deployment results will be required.
        Since:
        5.10
      • getLatestStatusForEnvironments

        @NotNull
        @NotNull Map<Long,​EnvironmentStatusForDashboard> getLatestStatusForEnvironments​(@NotNull
                                                                                              @NotNull List<Long> environmentIds)
                                                                                       throws AccessDeniedException
        Returns:
        the latest environment status for environments ids passes as the first argument as a map of environment Id to EnvironmentStatus. Environments that have not been deployed will have a status with no result.
        Throws:
        AccessDeniedException - if user has no access to requested environment.
        Since:
        6.8