private void ProcessMapping(BuildStatusChangeEvent statusChanged, BuildDetail buildDetail, Mapping mapping, IPostDeployAction postDeployAction) { lock (GetLockObject(mapping)) { var deployAgent = _deployAgentProvider.GetDeployAgent(mapping); // default to "happy; did nothing" if there's no deployment agent. var deployResult = new DeployAgentResult { HasErrors = false, Output = string.Empty }; if (deployAgent != null) { using (var workingDirectory = new WorkingDirectory()) { var deployAgentDataFactory = new DeployAgentDataFactory(); var deployData = deployAgentDataFactory.Create(workingDirectory.DirectoryInfo.FullName, mapping, buildDetail, statusChanged); _deploymentFolderSource.DownloadDeploymentFolder(deployData.TfsBuildDetail, workingDirectory.DirectoryInfo.FullName); deployResult = deployAgent.Deploy(deployData); } } postDeployAction.DeploymentFinished(mapping, deployResult); } }
public void ProcessMappings(IEnumerable <Mapping> mappings, BuildStatusChangeEvent statusChanged, BuildDetail buildDetail, IPostDeployAction postDeployAction) { var applicableMappings = from mapping in mappings where _mappingEvaluator.DoesMappingApply(mapping, statusChanged, buildDetail.Status.ToString()) select mapping; foreach (var mapping in applicableMappings) { TraceHelper.TraceInformation(TraceSwitches.TfsDeployer, "Matching mapping found, executing, Computer:{0}, Script:{1}", mapping.Computer, mapping.Script); ((ProcessMappingDelegate)ProcessMapping).BeginInvoke(statusChanged, buildDetail, mapping, postDeployAction, null, null); } }
public void ProcessMappings(IEnumerable <Mapping> mappings, BuildStatusChangeEvent statusChanged, BuildDetail buildDetail, IPostDeployAction postDeployAction, int eventId) { var applicableMappings = from mapping in mappings where _mappingEvaluator.DoesMappingApply(mapping, statusChanged, buildDetail.Status.ToString()) select mapping; foreach (var mapping in applicableMappings) { TraceHelper.TraceInformation(TraceSwitches.TfsDeployer, "Matching mapping found, executing, Computer:{0}, Script:{1}", mapping.Computer, mapping.Script); var deploymentId = _deploymentEventRecorder.RecordQueued(eventId, mapping.Script, mapping.Queue); var executor = _executorFactory(); ExecuteDelegate executeDelegate = executor.Execute; executeDelegate.BeginInvoke(statusChanged, buildDetail, mapping, postDeployAction, deploymentId, ExecuteDelegateCallback, executeDelegate); } }
public void Execute(BuildStatusChangeEvent statusChanged, BuildDetail buildDetail, Mapping mapping, IPostDeployAction postDeployAction, int deploymentId) { _ownedExecutor.Value.Execute(statusChanged, buildDetail, mapping, postDeployAction, deploymentId); }
public void Execute(BuildStatusChangeEvent statusChanged, BuildDetail buildDetail, Mapping mapping, IPostDeployAction postDeployAction, int deploymentId) { lock (_namedLockSet.GetLockObject(mapping.Queue)) { _deploymentEventRecorder.RecordStarted(deploymentId); var deployAgent = _deployAgentProvider.GetDeployAgent(mapping); // default to "happy; did nothing" if there's no deployment agent. var deployResult = new DeployAgentResult { HasErrors = false, Output = string.Empty }; if (deployAgent != null) { using (var workingDirectory = new WorkingDirectory()) { var deployAgentDataFactory = new DeployAgentDataFactory(); var deployData = deployAgentDataFactory.Create(workingDirectory.DirectoryInfo.FullName, mapping, buildDetail, statusChanged); deployData.DeploymentId = deploymentId; _deploymentFolderSource.DownloadDeploymentFolder(deployData.TfsBuildDetail, workingDirectory.DirectoryInfo.FullName); deployResult = deployAgent.Deploy(deployData); } } postDeployAction.DeploymentFinished(mapping, deployResult); _deploymentEventRecorder.RecordFinished(deploymentId, deployResult.HasErrors, deployResult.Output); } }
public void Execute(BuildStatusChangeEvent statusChanged, BuildDetail buildDetail, Mapping mapping, IPostDeployAction postDeployAction, int deploymentId) { Interlocked.Increment(ref _concurrentThreadCount); WaitHandle.WaitOne(); Interlocked.Decrement(ref _concurrentThreadCount); }