Interface DeploymentResultService
- All Known Implementing Classes:
DeploymentResultServiceImpl
public interface DeploymentResultService
-
Method Summary
Modifier and TypeMethodDescriptionint
countDeploymentResultsForEnvironment
(long environmentId) Count deployment results for deployment.createDeploymentResult
(long environmentId, long deploymentVersionId, @NotNull VariableContext variableContext, @NotNull TriggerReason triggerReason) findEnvironmentIdsVersionWasDeployedOn
(long deploymentVersionId) @Nullable DeploymentResult
getDeploymentResult
(long deploymentResultId) Retrieve a specific deployment result.getDeploymentResultIdsForDeploymentVersionFinishedBefore
(long deploymentVersionId, @NotNull Date finishDate) Get ids of all deployment results for deployment version finished before given date.@NotNull List<DeploymentResult>
getDeploymentResultsByLifeCycleState
(Collection<LifeCycleState> lifeCycleStates) @NotNull List<DeploymentResult>
getDeploymentResultsForDeploymentVersion
(long deploymentVersionId) Get all deployment results for deployment version.@NotNull List<DeploymentResult>
getDeploymentResultsForDeploymentVersionAndEnvironment
(long deploymentVersionId, long environmentId) Get all deployment results for deployment versions that ran against the specified environment.@NotNull List<DeploymentResult>
getDeploymentResultsForDeploymentVersionFinishedBefore
(long deploymentVersionId, Date finishDate) Deprecated.since 5.10 on account of it potentially consuming lots of memory.@NotNull List<DeploymentResult>
getDeploymentResultsForEnvironment
(long environmentId) Deprecated.since 6.7 for performance reasons usegetDeploymentResultsForEnvironmentWithoutVariables(long, int, int)
@NotNull List<DeploymentResult>
getDeploymentResultsForEnvironment
(long environmentId, int offset, int maxResults) Deprecated.since 6.7 for performance reasons usegetDeploymentResultsForEnvironmentWithoutVariables(long, int, int)
@NotNull List<DeploymentResult>
getDeploymentResultsForEnvironmentWithoutVariables
(long environmentId, int offset, int maxResults) Get deployment results for environment.@Nullable DeploymentResult
getLastResultBefore
(@NotNull DeploymentResult deploymentResult) @Nullable DeploymentResult
getLastResultInStatesBefore
(@NotNull DeploymentResult deploymentResult, @NotNull EnumSet<BuildState> buildStates) @Nullable DeploymentResult
getLatestDeploymentResult
(long environmentId, long deploymentVersionId) Retrieve a specific deployment result for an environment and version.@Nullable DeploymentResult
getLatestDeploymentResultForEnvironment
(long environmentId) Get the latest result that ran against an environment@NotNull List<EnvironmentStatus>
getLatestKnownDeploymentResultForEnvironments
(Iterable<? extends Environment> environments) Deprecated.since 6.8 for performance reasons usegetLatestKnownDeploymentResultForEnvironmentsInProject(DeploymentProject)
@NotNull List<EnvironmentStatus>
getLatestKnownDeploymentResultForEnvironmentsInProject
(@NotNull DeploymentProject deploymentProject) Get the latest results that *actually* ran against a list of environments.getLatestStatusForAllEnvironments
(Map<Long, Environment> environmentsById, Map<Long, DeploymentProject> deploymentProjectsById) Deprecated.since 6.8 usegetLatestStatusForEnvironments(List)
@NotNull Map<Long,
EnvironmentStatusForDashboard> getLatestStatusForEnvironments
(@NotNull List<Long> environmentIds) @NotNull List<DeploymentResult>
getResultsWhereDeploymentVersionIsDeployedNow
(List<Long> environmentsId, long deploymentVersionId) @Nullable DeploymentVersion
getRollbackVersion
(long environmentId) For a given environment find the version that existed on the environment prior to the last deployment.@Nullable DeploymentVersion
getRollbackVersion
(@NotNull DeploymentResult deploymentResult) For a given deployment result find the version that existed on the environment before that deployment.@NotNull List<EnvironmentStatusForAggregation>
getStatusesForAggregationByProject
(@NotNull DeploymentProject deploymentProject) @NotNull List<DeploymentResult>
getSuccessfulDeploymentResultsForEnvironment
(long environmentId, int offset, int maxResults) Get successful deployment results for environment.void
setExecutingAgent
(long deploymentResultId, long agentId) Set the agent that the deployment is executing on.void
updateDeploymentState
(long deploymentResultId, @NotNull BuildState buildState, Map<String, String> customData) Update the build state of the Deployment Resultvoid
updateLifeCycleState
(long deploymentResultId, @NotNull LifeCycleState lifeCycleState) Update lifecycle state of the DeploymentResult.void
updateLifeCycleState
(@NotNull DeploymentTimingPoint timingPoint, @NotNull LifeCycleState lifeCycleState) Update lifecycle state of the DeploymentResult
-
Method Details
-
createDeploymentResult
DeploymentResult createDeploymentResult(long environmentId, long deploymentVersionId, @NotNull @NotNull VariableContext variableContext, @NotNull @NotNull TriggerReason triggerReason) -
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 environmentdeploymentVersionId
- of the version- Returns:
- deployment result for a version against an environment.
-
getDeploymentResultsForEnvironment
@Deprecated @NotNull @NotNull List<DeploymentResult> getDeploymentResultsForEnvironment(long environmentId) Deprecated.since 6.7 for performance reasons usegetDeploymentResultsForEnvironmentWithoutVariables(long, int, int)
Get all deployment results for environment. Sorted by started date, newest first. todo pagination- Parameters:
environmentId
- id of environment to get results from- Returns:
- List of deployment results
-
getDeploymentResultsForEnvironment
@Deprecated @NotNull @NotNull List<DeploymentResult> getDeploymentResultsForEnvironment(long environmentId, int offset, int maxResults) Deprecated.since 6.7 for performance reasons usegetDeploymentResultsForEnvironmentWithoutVariables(long, int, int)
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 fromoffset
-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 fromoffset
-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 fromoffset
-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 versionenvironmentId
- 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. ConsidergetDeploymentResultIdsForDeploymentVersionFinishedBefore(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 fromfinishDate
- 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 fromfinishDate
- 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
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.since 6.8 for performance reasons usegetLatestKnownDeploymentResultForEnvironmentsInProject(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'- 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
-
getStatusesForAggregationByProject
@NotNull @NotNull List<EnvironmentStatusForAggregation> getStatusesForAggregationByProject(@NotNull @NotNull DeploymentProject deploymentProject) -
getDeploymentResultsByLifeCycleState
@NotNull @NotNull List<DeploymentResult> getDeploymentResultsByLifeCycleState(Collection<LifeCycleState> lifeCycleStates) -
updateLifeCycleState
Update lifecycle state of the DeploymentResult. This method expects only PENDING and NOT_BUILD lifeCycleState.- Parameters:
deploymentResultId
- id of DeploymentResultlifeCycleState
- 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 pointlifeCycleState
- 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 resultagentId
- 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 updatebuildState
- new value of the build state to savecustomData
-
-
getRollbackVersion
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
- 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 checkdeploymentVersionId
-- 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.since 6.8 usegetLatestStatusForEnvironments(List)
- 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
-