public void ExecuteDeploymentProcess(BuildStatusChangeEvent statusChanged) { try { TraceHelper.TraceInformation(TraceSwitches.TfsDeployer, "Build Status Changed: Team Project {0} Team Build Version: {1} From {2} : {3}", statusChanged.TeamProject, statusChanged.Id, statusChanged.StatusChange.OldValue, statusChanged.StatusChange.NewValue); var tfsBuildDetail = GetBuildDetail(statusChanged); var buildDetail = Mapper.Map <IBuildDetail, BuildDetail>(tfsBuildDetail); var postDeployAction = new PostDeployAction(buildDetail, tfsBuildDetail, _alerter); var mappings = _configurationReader.ReadMappings(buildDetail); _mappingProcessor.ProcessMappings(mappings, statusChanged, buildDetail, postDeployAction); } catch (Exception ex) { TraceHelper.TraceError(TraceSwitches.TfsDeployer, ex); } }
public void ExecuteDeploymentProcess(BuildStatusChangeEvent statusChanged) { try { TraceHelper.TraceInformation(TraceSwitches.TfsDeployer, "Build Status Changed: Team Project {0} Team Build Version: {1} From {2} : {3}", statusChanged.TeamProject, statusChanged.Id, statusChanged.StatusChange.OldValue, statusChanged.StatusChange.NewValue); var info = new BuildInformation(GetBuildDetail(statusChanged)); using (var workingDirectory = new WorkingDirectory()) { var mappings = _configurationReader.ReadMappings(statusChanged.TeamProject, info.Data, workingDirectory); foreach (var mapping in mappings) { TraceHelper.TraceInformation(TraceSwitches.TfsDeployer, "Processing Mapping: Computer:{0}, Script:{1}", mapping.Computer, mapping.Script); if (_mappingEvaluator.DoesMappingApply(mapping, statusChanged, info.Detail.Status.ToString())) { TraceHelper.TraceInformation(TraceSwitches.TfsDeployer, "Matching mapping found, running script {0}", mapping.Script); var deployAgent = _deployAgentProvider.GetDeployAgent(mapping); var deployData = CreateDeployAgentData(workingDirectory.DirectoryInfo.FullName, mapping, info); var deployResult = deployAgent.Deploy(deployData); ApplyRetainBuild(mapping, deployResult, info.Detail); _alerter.Alert(mapping, info.Data, deployResult); } } } } catch (Exception ex) { TraceHelper.TraceError(TraceSwitches.TfsDeployer, ex); } }