private void CreateTemporaryLabel(IIntegrationResult result) { if (ApplyLabel) { tempLabel = CreateTemporaryLabelName(result.StartTime); LabelSourceControlWith(tempLabel, result); result.AddIntegrationProperty("CCNetVSSTempLabel", tempLabel); } }
public void Run(IIntegrationResult result) { // only deal with known integration status if (result.Status == IntegrationStatus.Unknown) return; string LogFileName = this.GetFilename(result); string LogDirectory = this.LogDirectory(result.ArtifactDirectory); result.AddIntegrationProperty("CCNetLogFilePath", Path.Combine(LogDirectory, LogFileName)); using (XmlIntegrationResultWriter integrationWriter = new XmlIntegrationResultWriter(CreateWriter(LogDirectory, LogFileName))) { integrationWriter.Formatting = Formatting.Indented; integrationWriter.Write(result); } }
public void Run(IIntegrationResult result) { if (result.Status == IntegrationStatus.Unknown) { return; } result.AddIntegrationProperty("CCNetDashboardServerName", this.DashboardServerName); EmailMessage emailMessage = new EmailMessage(result, this); string to = emailMessage.Recipients; string subject = emailMessage.Subject; string message = CreateMessage(result); if (IsRecipientSpecified(to)) { SendMessage(fromAddress, to, subject, message); } }
public void Run(IIntegrationResult result) { // only deal with known integration status if (result.Status == IntegrationStatus.Unknown) { return; } string LogFileName = this.GetFilename(result); string LogDirectory = this.LogDirectory(result.ArtifactDirectory); result.AddIntegrationProperty("CCNetLogFilePath", Path.Combine(LogDirectory, LogFileName)); using (XmlIntegrationResultWriter integrationWriter = new XmlIntegrationResultWriter(CreateWriter(LogDirectory, LogFileName))) { integrationWriter.Formatting = Formatting.Indented; integrationWriter.Write(result); } }
public bool ShouldRunIntegration(ForceFilterClientInfo[] clientInfo, IIntegrationResult result) { UserInformation UserInfo = null; foreach (ForceFilterClientInfo Info in clientInfo) { if (Info is UserInformation) { UserInfo = (UserInformation)Info; break; } } if (UserInfo == null) { throw new InvalidOperationException("No user information was found."); } result.AddIntegrationProperty("CCNetForcedBy", UserInfo.Name); this.AddUserNameToResults(result, UserInfo); if (this.DontCheck) { return(true); } bool ToRun = false; if (this.UserList.Contains(UserInfo.Name)) { return(true); } foreach (string GroupName in this.Groups) { if (UserInfo.Groups.Contains(GroupName)) { return(true); } } Log.Info(string.Format("{0} is not allowed to force the build for project {1}.", UserInfo.Name, result.ProjectName)); return(ToRun); }
public bool ForceBuild(Dictionary <string, string> webParams, ForceFilterClientInfo[] clientInfo) { IIntegrationResult result = null; try { result = resultManager.StartNewIntegration(); } catch (Exception ex) { Log.Error(ex); return(false); } if (webParams != null) { foreach (KeyValuePair <string, string> webParam in webParams) { result.AddIntegrationProperty(webParam.Key, webParam.Value); } } if (this.Project.ForceFilters != null && this.Project.ForceFilters.Length != 0) { foreach (IForceFilter Filter in this.Project.ForceFilters) { Boolean ToForce = Filter.ShouldRunIntegration(clientInfo, result); if (!ToForce) { return(false); } } } Log.Info("Force Build for project: " + _project.Name); this.ShouldForceBuild = true; this.IntegrationResult = result; this.Start(); return(true); }
public void GetSource(IIntegrationResult result) { this.ChangesetQueue.BeginIntegration(); Changeset Set = this.ChangesetQueue.GetCurrentIntegrationSet(); string ChangesetIdTo = ChangesetIdTo = Set.ChangesetId.ToString(); result.AddIntegrationProperty("CCNetVSTSChangeSetId", ChangesetIdTo); if (AutoGetSource) { if (CleanCopy) { // If we have said we want a clean copy, then delete old copy before getting. Log.Debug("Deleting " + this.WorkingDirectory); this.DeleteDirectory(this.WorkingDirectory); } Workspace[] Workspaces = this.SourceControl.QueryWorkspaces(Workspace, this.SourceControl.AuthenticatedUser, Workstation.Current.Name); Workspace MyWorkspace = null; if (Workspaces.Length > 0) { // The workspace exists. if (DeleteWorkspace) { // We have asked for a new workspace every time, therefore delete the existing one. Log.Debug("Removing existing workspace " + Workspace); this.SourceControl.DeleteWorkspace(Workspace, this.SourceControl.AuthenticatedUser); Workspaces = new Workspace[0]; } else { Log.Debug("Existing workspace detected - reusing"); MyWorkspace = Workspaces[0]; } } if (Workspaces.Length == 0) { Log.Debug("Creating new workspace name: " + Workspace); MyWorkspace = this.SourceControl.CreateWorkspace(Workspace, this.SourceControl.AuthenticatedUser, "Created By CCNet vstsbychangesetSourceControl."); } try { MyWorkspace.Map(ProjectPath, WorkingDirectory); Log.Debug(String.Format("Getting {0} to {1}", ProjectPath, WorkingDirectory)); GetRequest GetInfo; GetInfo = new GetRequest(new ItemSpec(ProjectPath, RecursionType.Full), Set.ChangesetId); this.SourceControl.Getting += new GettingEventHandler(OnGet); if (CleanCopy || Force) { Log.Debug("Forcing a Get Specific with the options \"get all files\" and \"overwrite read/write files\""); MyWorkspace.Get(GetInfo, GetOptions.GetAll | GetOptions.Overwrite); } else { Log.Debug("Performing a Get Latest"); MyWorkspace.Get(GetInfo, GetOptions.None); } } finally { if (MyWorkspace != null && DeleteWorkspace) { Log.Debug("Deleting the workspace"); MyWorkspace.Delete(); } this.SourceControl.Getting -= new GettingEventHandler(OnGet); } } }
public void Run(IIntegrationResult result) { if (result.Status == IntegrationStatus.Unknown) return; result.AddIntegrationProperty("CCNetDashboardServerName", this.DashboardServerName); EmailMessage emailMessage = new EmailMessage(result, this); string to = emailMessage.Recipients; string subject = emailMessage.Subject; string message = CreateMessage(result); if (IsRecipientSpecified(to)) { SendMessage(fromAddress, to, subject, message); } }
public bool ShouldRunIntegration(ForceFilterClientInfo[] clientInfo, IIntegrationResult result) { UserInformation UserInfo = null; foreach (ForceFilterClientInfo Info in clientInfo) { if (Info is UserInformation) { UserInfo = (UserInformation)Info; break; } } if (UserInfo == null) throw new InvalidOperationException("No user information was found."); result.AddIntegrationProperty("CCNetForcedBy", UserInfo.Name); this.AddUserNameToResults(result, UserInfo); if (this.DontCheck) return true; bool ToRun = false; if (this.UserList.Contains(UserInfo.Name)) { return true; } foreach (string GroupName in this.Groups) { if (UserInfo.Groups.Contains(GroupName)) { return true; } } Log.Info(string.Format("{0} is not allowed to force the build for project {1}.", UserInfo.Name, result.ProjectName)); return ToRun; }