private void MakeDistinct(HashSet <DeployLog> targetSet) { var byChangelist = new Dictionary <int, DeployLog>(); var rejected = new List <DeployLog>(); foreach (DeployLog log in targetSet) { int changelist = log.Changelist; if (byChangelist.ContainsKey(changelist)) { DeployLog oldLog = byChangelist[changelist]; if (oldLog.TimeStamp.CompareTo(log.TimeStamp) < 0) { byChangelist[changelist] = log; rejected.Add(oldLog); } } else { byChangelist.Add(changelist, log); } } rejected.ForEach(log => targetSet.Remove(log)); }
public static async Task <ClientVersionInfo> GetTargetVersionInfo(string branch, string targetVersion, string fastGuid = "") { var logData = await StudioDeployLogs.Get(branch); HashSet <DeployLog> targets; if (Environment.Is64BitOperatingSystem) { targets = logData.CurrentLogs_x64; } else { targets = logData.CurrentLogs_x86; } DeployLog target = targets .Where(log => log.VersionId == targetVersion) .FirstOrDefault(); if (target == null) { Program.SetValue("TargetVersion", ""); return(await GetCurrentVersionInfo(branch, fastGuid)); } return(new ClientVersionInfo() { Guid = target.VersionGuid, Version = target.VersionId }); }
private async void branchSelect_SelectedIndexChanged(object sender, EventArgs e) { // Save the user's branch preference. string branch = getSelectedBranch(); Program.SetValue("BuildBranch", branch); // Grab the version currently being targetted. string targetId = Program.GetString("TargetVersion"); // Clear the current list of target items. targetVersion.Items.Clear(); targetVersion.Items.Add("(Use Latest)"); // Populate the items list using the deploy history. Enabled = false; UseWaitCursor = true; var getDeployLogs = StudioDeployLogs.Get(branch); var deployLogs = await getDeployLogs.ConfigureAwait(true); Enabled = true; UseWaitCursor = false; HashSet <DeployLog> targets; if (Environment.Is64BitOperatingSystem) { targets = deployLogs.CurrentLogs_x64; } else { targets = deployLogs.CurrentLogs_x86; } var items = targets .OrderByDescending(log => log.Changelist) .Cast <object>() .Skip(1) .ToArray(); targetVersion.Items.AddRange(items); // Select the deploy log being targetted. DeployLog target = targets .Where(log => log.VersionId == targetId) .FirstOrDefault(); if (target != null) { targetVersion.SelectedItem = target; return; } // If the target isn't valid, fallback to the latest version. targetVersion.SelectedIndex = 0; }
private void UpdateLogs(string deployHistory, int maxVersion) { MatchCollection matches = Regex.Matches(deployHistory, LogPattern); CurrentLogs_x86.Clear(); CurrentLogs_x64.Clear(); foreach (Match match in matches) { string[] data = match.Groups.Cast <Group>() .Select(group => group.Value) .Where(value => value.Length != 0) .ToArray(); string buildType = data[1]; bool is64Bit = buildType.EndsWith("64"); DeployLog deployLog = new DeployLog() { Is64Bit = is64Bit, VersionGuid = data[2] }; DateTime.TryParse(data[3], out deployLog.TimeStamp); int.TryParse(data[4], out deployLog.MajorRev); int.TryParse(data[5], out deployLog.Version); int.TryParse(data[6], out deployLog.Patch); int.TryParse(data[7], out deployLog.Changelist); if (deployLog.Changelist < EarliestChangelist || deployLog.Version > maxVersion) { continue; } HashSet <DeployLog> targetList; if (deployLog.Is64Bit) { targetList = CurrentLogs_x64; } else { targetList = CurrentLogs_x86; } targetList.Add(deployLog); } MakeDistinct(CurrentLogs_x64); MakeDistinct(CurrentLogs_x86); }
private void UpdateLogs(string deployHistory) { MatchCollection matches = Regex.Matches(deployHistory, LogPattern); CurrentLogs.Clear(); foreach (Match match in matches) { string[] data = match.Groups.Cast <Group>() .Select(group => group.Value) .Where(value => value.Length != 0) .ToArray(); DeployLog deployLog = new DeployLog(); deployLog.VersionGuid = data[1]; int.TryParse(data[2], out deployLog.MajorRev); int.TryParse(data[3], out deployLog.Version); int.TryParse(data[4], out deployLog.Patch); int.TryParse(data[5], out deployLog.Changelist); CurrentLogs.Add(deployLog); } }
public static async Task <ClientVersionInfo> GetCurrentVersionInfo(string branch, string fastVersionGuid = "") { string binaryType = GetStudioBinaryType(); if (branch == "roblox") { return(await ClientVersionInfo.Get(binaryType)); } if (fastVersionGuid != "") { string latestGuid; if (binaryType == "WindowsStudio64") { latestGuid = versionRegistry.GetString("LatestGuid_x86"); } else { latestGuid = versionRegistry.GetString("LatestGuid_x64"); } // If we already determined the fast version guid is pointing // to the other version of Roblox Studio, fallback to the // version data that has been cached already. if (fastVersionGuid == latestGuid) { string versionId = versionRegistry.GetString("Version"); string versionGuid = versionRegistry.GetString("VersionGuid"); ClientVersionInfo proxy = new ClientVersionInfo() { Version = versionId, Guid = versionGuid }; return(proxy); } } // Unfortunately as of right now, the ClientVersionInfo end-point on // gametest isn't available to the public, so I have to use some hacks // with the DeployHistory.txt file to figure out what version guid to use. var logData = await StudioDeployLogs.Get(branch); var currentLogs = logData.CurrentLogs; int numLogs = currentLogs.Count; DeployLog latest = currentLogs[numLogs - 1]; DeployLog prev = currentLogs[numLogs - 2]; DeployLog build_x86, build_x64; // If these builds aren't using the same perforce changelist, // then the 64-bit version hasn't been deployed yet. There is // usually a ~5 minute gap between the new 32-bit version being // deployed, and the 64-bit version proceeding it. if (prev.Changelist != latest.Changelist) { build_x86 = latest; build_x64 = prev; } else { build_x86 = prev; build_x64 = latest; } var info = new ClientVersionInfo(); if (binaryType == "WindowsStudio64") { info.Version = build_x64.ToString(); info.Guid = build_x64.VersionGuid; } else { info.Version = build_x86.ToString(); info.Guid = build_x86.VersionGuid; } versionRegistry.SetValue("LatestGuid_x86", build_x86.VersionGuid); versionRegistry.SetValue("LatestGuid_x64", build_x64.VersionGuid); return(info); }
public static async Task <ClientVersionInfo> GetCurrentVersionInfo(string branch, string fastGuid = "") { string targetVersion = Program.GetString("TargetVersion"); if (targetVersion != "") { return(await GetTargetVersionInfo(branch, targetVersion)); } string binaryType = GetStudioBinaryType(); bool is64Bit = Environment.Is64BitOperatingSystem; if (branch == "roblox") { return(await ClientVersionInfo.Get(binaryType)); } if (fastGuid == "") { fastGuid = await GetFastVersionGuid(branch); } string latestFastGuid = versionRegistry.GetString("LatestFastGuid"); var info = new ClientVersionInfo(); if (latestFastGuid == fastGuid) { string version = versionRegistry.GetString("Version"); info.Version = version; string latest_x86 = versionRegistry.GetString("LatestGuid_x86"); string latest_x64 = versionRegistry.GetString("LatestGuid_x64"); if (latestFastGuid == latest_x64 && is64Bit) { info.Guid = latest_x64; return(info); } if (latestFastGuid == latest_x86 && !is64Bit) { info.Guid = latest_x86; return(info); } } // Unfortunately the ClientVersionInfo end-point on sitetest // isn't available to the public, so I have to parse the // DeployHistory.txt file on their setup s3 bucket. var logData = await StudioDeployLogs.Get(branch); DeployLog build_x86 = logData.CurrentLogs_x86.Last(); DeployLog build_x64 = logData.CurrentLogs_x64.Last(); if (is64Bit) { info.Version = build_x64.VersionId; info.Guid = build_x64.VersionGuid; } else { info.Version = build_x86.VersionId; info.Guid = build_x86.VersionGuid; } versionRegistry.SetValue("LatestFastGuid", fastGuid); versionRegistry.SetValue("LatestGuid_x86", build_x86.VersionGuid); versionRegistry.SetValue("LatestGuid_x64", build_x64.VersionGuid); return(info); }
private void UpdateLogs(string deployHistory, int maxVersion) { var now = DateTime.Now; var matches = Regex.Matches(deployHistory, LogPattern); CurrentLogs_x86.Clear(); CurrentLogs_x64.Clear(); foreach (Match match in matches) { string[] data = match.Groups.Cast <Group>() .Select(group => group.Value) .Where(value => value.Length != 0) .ToArray(); string buildType = data[1]; bool is64Bit = buildType.EndsWith("64", Program.StringFormat); DeployLog deployLog = new DeployLog() { Is64Bit = is64Bit, VersionGuid = data[2], TimeStamp = DateTime.Parse(data[3], DateTimeFormatInfo.InvariantInfo), MajorRev = int.Parse(data[4], Program.NumberFormat), Version = int.Parse(data[5], Program.NumberFormat), Patch = int.Parse(data[6], Program.NumberFormat), Changelist = int.Parse(data[7], Program.NumberFormat) }; if (deployLog.Changelist < EarliestChangelist || deployLog.Version > maxVersion) { continue; } // olive71 (Ganesh) said we should expect builds older than ~3 months to be deleted. // Although in practice this isn't consistently done, it's better to be safe than sorry. // https://devforum.roblox.com/t/previous-roblox-builds-missing-from-deployment-server/469698/3 var timespan = now - deployLog.TimeStamp; if (timespan.TotalDays > 90) { continue; } // Unverified builds might need a moment. if (timespan.TotalMinutes < 5) { continue; } HashSet <DeployLog> targetList; if (deployLog.Is64Bit) { targetList = CurrentLogs_x64; } else { targetList = CurrentLogs_x86; } targetList.Add(deployLog); } MakeDistinct(CurrentLogs_x64); MakeDistinct(CurrentLogs_x86); }