public void Run(string deployStateId, IDeployTaskStatusManager statusManager, List<IDeployTaskDefinition> taskDefinitionList, DeployComponent component, DeployEnvironmentConfiguration environmentComponent, DeployMachine machine, DeployBuild build, RuntimeSystemSettings runtimeSystemSettings) { int stepCounter = 0; foreach(var taskDefinition in taskDefinitionList) { stepCounter++; statusManager.Info(deployStateId, string.Format("Step {0}: Starting {1}", stepCounter, taskDefinition.TaskDefintionName)); DeployTaskExecutionResult result; //using (var impersontator = BeginImpersonation(deployStateId, statusManager, environmentComponent)) //{ var executor = _deployTaskFactory.CreateTaskExecutor(taskDefinition.GetTaskExecutorType()); result = executor.Execute(deployStateId, statusManager, taskDefinition, component, environmentComponent, machine, build, runtimeSystemSettings); //} switch(result.Status) { case EnumDeployTaskExecutionResultStatus.Success: statusManager.Info(deployStateId, string.Format("Step {0}: End {1}, completed successfully", stepCounter, taskDefinition.TaskDefintionName)); break; case EnumDeployTaskExecutionResultStatus.Error: statusManager.Info(deployStateId, string.Format("Step {0}: End {1}, failed", stepCounter, taskDefinition.TaskDefintionName)); return; //error error eject! //break; case EnumDeployTaskExecutionResultStatus.Warning: statusManager.Info(deployStateId, string.Format("Step {0}: End {1}, completed with warnings", stepCounter, taskDefinition.TaskDefintionName)); break; default: throw new UnknownEnumValueException(result.Status); } } }
public DeployRunner(IBuildRepository buildRepository, IProjectRepository projectRepository, IDeployTaskStatusManager statusManager, IDeployComponentRunner componentRunner, IDeployTaskFactory taskFactory, IFileManager fileManager, IZipper zipper) { _buildRepository = DIHelper.VerifyParameter(buildRepository); _projectRepository = DIHelper.VerifyParameter(projectRepository); _statusManager = DIHelper.VerifyParameter(statusManager); _componentRunner = DIHelper.VerifyParameter(componentRunner); _taskFactory = DIHelper.VerifyParameter(taskFactory); _fileManager = DIHelper.VerifyParameter(fileManager); _zipper = DIHelper.VerifyParameter(zipper); }
private ImpersonationContext BeginImpersonation(string deployStateId, IDeployTaskStatusManager statusManager, DeployEnvironmentConfiguration environmentComponent) { if(!string.IsNullOrEmpty(environmentComponent.DeployCredentialsId)) { var context = _impersonator.BeginImpersonation(environmentComponent.DeployCredentialsId); statusManager.Info(deployStateId, "Starting impersonation of " + context.Credentials.DisplayValue); return context; } else { statusManager.Info(deployStateId, "No impersonation"); return null; } }