com.atlassian.bamboo.deployments.results.service
Interface DeploymentResultService

All Known Implementing Classes:
DeploymentResultServiceImpl

public interface DeploymentResultService


Method Summary
 int countDeploymentResultsForEnvironment(long environmentId)
          Count deployment results for deployment.
 DeploymentResult createDeploymentResult(long environmentId, long deploymentVersionId, VariableContext variableContext, TriggerReason triggerReason)
           
 Set<Long> findEnvironmentIdsVersionWasDeployedOn(long deploymentVersionId)
           
 DeploymentResult getDeploymentResult(long deploymentResultId)
          Retrieve a specific deployment result.
 List<DeploymentResult> getDeploymentResultsByLifeCycleState(Collection<LifeCycleState> lifeCycleStates)
           
 List<DeploymentResult> getDeploymentResultsForDeploymentVersion(long deploymentVersionId)
          Get all deployment results for deployment version.
 List<DeploymentResult> getDeploymentResultsForDeploymentVersionAndEnvironment(long deploymentVersionId, long environmentId)
          Get all deployment results for deployment versions that ran against the specified environment.
 List<DeploymentResult> getDeploymentResultsForDeploymentVersionFinishedBefore(long deploymentVersionId, Date finishDate)
          Get all deployment results for deployment version finished before given date.
 List<DeploymentResult> getDeploymentResultsForEnvironment(long environmentId)
          Get all deployment results for environment.
 List<DeploymentResult> getDeploymentResultsForEnvironment(long environmentId, int offset, int maxResults)
          Get deployment results for environment.
 DeploymentResult getLastResultBefore(DeploymentResult deploymentResult)
           
 DeploymentResult getLastResultInStatesBefore(DeploymentResult deploymentResult, EnumSet<BuildState> buildStates)
           
 DeploymentResult getLatestDeploymentResult(long environmentId, long deploymentVersionId)
          Retrieve a specific deployment result for an environment and version.
 DeploymentResult getLatestDeploymentResultForEnvironment(long environmentId)
          Get the latest result that ran against an environment
 List<EnvironmentStatus> getLatestKnownDeploymentResultForEnvironments(Iterable<? extends Environment> environments)
          Get the latest results that *actually* ran against a list of environments.
 List<DeploymentResult> getResultsWhereDeploymentVersionIsDeployedNow(List<Long> environmentsId, long deploymentVersionId)
           
 DeploymentVersion getRollbackVersion(DeploymentResult deploymentResult)
          For a given deployment result find the version that existed on the environment before that deployment.
 DeploymentVersion getRollbackVersion(long environmentId)
          For a given environment find the version that existed on the environment prior to the last deployment.
 List<DeploymentResult> getSuccessfulDeploymentResultsForEnvironment(long environmentId, int offset, int maxResults)
          Get successful deployment results for environment.
 void logSubstitutedVariables(long deploymentResultId, Map<String,VariableSubstitutionContext> substitutions)
          Adds variable substitution result to DeploymentResult This method logs substitution after it was performed and will use only REALLY substituted values
 void setExecutingAgent(long deploymentResultId, long agentId)
          Set the agent that the deployment is executing on.
 void updateDeploymentState(long deploymentResultId, BuildState buildState, Map<String,String> customData)
          Update the build state of the Deployment Result
 void updateLifeCycleState(DeploymentTimingPoint timingPoint, LifeCycleState lifeCycleState)
          Update lifecycle state of the DeploymentResult
 void updateLifeCycleState(long deploymentResultId, LifeCycleState lifeCycleState)
          Update lifecycle state of the DeploymentResult.
 

Method Detail

createDeploymentResult

DeploymentResult createDeploymentResult(long environmentId,
                                        long deploymentVersionId,
                                        @NotNull
                                        VariableContext variableContext,
                                        @NotNull
                                        TriggerReason triggerReason)

getDeploymentResult

@Nullable
DeploymentResult getDeploymentResult(long deploymentResultId)
Retrieve a specific deployment result.

Parameters:
deploymentResultId - of the result
Returns:
deployment result with given id

getLatestDeploymentResult

@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

@NotNull
List<DeploymentResult> getDeploymentResultsForEnvironment(long environmentId)
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

@NotNull
List<DeploymentResult> getDeploymentResultsForEnvironment(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:
5.1.2

getSuccessfulDeploymentResultsForEnvironment

@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
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
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

@NotNull
List<DeploymentResult> getDeploymentResultsForDeploymentVersionFinishedBefore(long deploymentVersionId,
                                                                                      Date finishDate)
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

countDeploymentResultsForEnvironment

int countDeploymentResultsForEnvironment(long environmentId)
Count deployment results for deployment.

Parameters:
environmentId -
Returns:
Since:
5.1.2

getLatestDeploymentResultForEnvironment

@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
List<EnvironmentStatus> getLatestKnownDeploymentResultForEnvironments(Iterable<? extends Environment> environments)
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.

getDeploymentResultsByLifeCycleState

@NotNull
List<DeploymentResult> getDeploymentResultsByLifeCycleState(Collection<LifeCycleState> lifeCycleStates)

updateLifeCycleState

void updateLifeCycleState(long deploymentResultId,
                          @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
                          DeploymentTimingPoint timingPoint,
                          @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
                           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 -

logSubstitutedVariables

void logSubstitutedVariables(long deploymentResultId,
                             Map<String,VariableSubstitutionContext> substitutions)
Adds variable substitution result to DeploymentResult This method logs substitution after it was performed and will use only REALLY substituted values


getRollbackVersion

@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
DeploymentVersion getRollbackVersion(@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
Set<Long> findEnvironmentIdsVersionWasDeployedOn(long deploymentVersionId)
Parameters:
deploymentVersionId -
Returns:
ids of all environments a version was ever deployed on

getResultsWhereDeploymentVersionIsDeployedNow

@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
DeploymentResult getLastResultBefore(@NotNull
                                              DeploymentResult deploymentResult)
Returns:
result of the last deployment performed on an environment before given result

getLastResultInStatesBefore

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


Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.