예제 #1
0
파일: Deployer.cs 프로젝트: hopenbr/HopDev
        public bool IsInterestedStatusChange(BuildStatusChangeEvent changeEvent, Mapping mapping, Change statusChange)
        {
            bool isComputerMatch = string.Compare(Environment.MachineName,mapping.Computer,true) == 0;
            bool isOldValueMatch = string.Compare(mapping.OriginalQuality,statusChange.OldValue,true) == 0;
            bool isNewValueMatch = string.Compare(mapping.NewQuality,statusChange.NewValue) == 0;
            bool isUserPermitted = this.IsUserPermitted(changeEvent, mapping);

            return isComputerMatch  && isOldValueMatch && isNewValueMatch && isUserPermitted;
        }
예제 #2
0
파일: Deployer.cs 프로젝트: hopenbr/HopDev
        private bool IsUserPermitted(BuildStatusChangeEvent changeEvent, Mapping mapping)
        {
            if (mapping.PermittedUsers == null) return true;

            bool isUserPermitted;
            string[] permittedUsers = mapping.PermittedUsers.Split(';');
            List<string> permittedUsersList = new List<string>(permittedUsers);
            isUserPermitted = permittedUsersList.Exists(
                delegate(string value) { return string.Compare(changeEvent.ChangedBy, value, true) == 0; }
                );
            return isUserPermitted;
        }
예제 #3
0
파일: Deployer.cs 프로젝트: hopenbr/HopDev
 /// <summary>
 /// The main execution method for TFS Deployer it is this
 /// method that does all the work
 /// </summary>
 /// <param name="statusChanged"></param>
 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);
         BuildData buildData = GetBuild(statusChanged.TeamProject, statusChanged.Id);
         DeploymentMappings mappings = ConfigurationReader.Read(statusChanged.TeamProject, buildData);
         if (mappings != null)
         {
             foreach (Mapping mapping in mappings.Mappings)
             {
                 TraceHelper.TraceInformation(TraceSwitches.TfsDeployer, "Processing Mapping: Computer:{0}, Script:{1}",mapping.Computer,mapping.Script);
                 if (IsInterestedStatusChange(statusChanged, mapping, statusChanged.StatusChange))
                 {
                     IRunner runner = DetermineRunner(mapping);
                     runner.Execute(ConfigurationReader.WorkingDirectory, mapping, buildData);
                     Alerter.Alert(mapping, buildData, runner);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         TraceHelper.TraceError(TraceSwitches.TfsDeployer, ex);
     }
 }