Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
 public void DeploymentFinished(Mapping mapping, DeployAgentResult result)
 {
     ApplyRetainBuild(mapping, result, _tfsBuildDetail);
     _alert.Alert(mapping, _buildDetail, result);
 }