public static void PublishRecord(string label) { var startTime = FindStart(label); var builder = new TimerRecordBuilder(new SourceControlInfo(), new BuildCounter()); var record = builder .WithProjectName(label) .WithStartTime(startTime) .WithFinishTime(DateTime.Now) .WithBuildStartTime(TotalBuildTimer.GetBuildStart()) .WithMachineName() .WithUserName() .WithTrunkPath() .WithSourceControlInfo() .WithLocalBuildNumber() .Build(); var recordJson = JsonConvert.SerializeObject(record); _logSender.Value.SendString(recordJson); }
public static void PublishTotalBuildRecord(DateTime startTime, DateTime endTime, string buildNumber) { var buildCounter = new BuildCounter(); var builder = new TimerRecordBuilder(new SourceControlInfo(), buildCounter); var record = builder .WithProjectName("Total_Build_Time") .WithStartTime(startTime) .WithFinishTime(endTime) .WithMachineName() .WithUserName() .WithTrunkPath() .WithLocalBuildNumber(buildNumber) .Build(); //Increment build count here... buildCounter.IncrementFile(); //TODO validate elsewhere if ((Settings.TotalBuildTimeValidMin != null && record.ElapsedTime < Settings.TotalBuildTimeValidMin) || (Settings.TotalBuildTimeValidMax != null && record.ElapsedTime > Settings.TotalBuildTimeValidMax)) return; var recordJson = JsonConvert.SerializeObject(record); _logSender.Value.SendString(recordJson); }