Skip to content

Commit

Permalink
fix verbose breaks jsonl logger (#474)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherHX authored Dec 11, 2024
1 parent a3e8d49 commit 5716f86
Show file tree
Hide file tree
Showing 2 changed files with 145 additions and 124 deletions.
22 changes: 11 additions & 11 deletions src/Runner.Client/ExternalToolHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private static string runnerOfficialUrl(string runner_URL, string runner12_VERSI
return $"{runner_URL}/v{runner12_VERSION}/runner-v{runner12_VERSION}-{os}-{arch}.{suffix}";
}

private static async Task DownloadTool(string link, string destDirectory, CancellationToken token, string tarextraopts = "", bool unwrap = false) {
private static async Task DownloadTool(Program.Parameters parameters, string link, string destDirectory, CancellationToken token, string tarextraopts = "", bool unwrap = false) {
Console.WriteLine($"Downloading from {link} to {destDirectory}");
string tempDirectory = Path.Combine(GitHub.Runner.Sdk.GharunUtil.GetLocalStorage(), "temp" + System.Guid.NewGuid().ToString());
var stagingDirectory = Path.Combine(tempDirectory, "_staging");
Expand Down Expand Up @@ -117,7 +117,7 @@ private static async Task DownloadTool(string link, string destDirectory, Cancel
string tar = WhichUtil.Which("tar", require: true);

// tar -xzf
using (var processInvoker = new ProcessInvoker(new Program.TraceWriter()))
using (var processInvoker = new ProcessInvoker(new Program.TraceWriter(parameters)))
{
processInvoker.OutputDataReceived += new EventHandler<ProcessDataReceivedEventArgs>((sender, args) =>
{
Expand Down Expand Up @@ -164,7 +164,7 @@ private static async Task DownloadTool(string link, string destDirectory, Cancel
IOUtil.DeleteDirectory(tempDirectory, CancellationToken.None);
}
}
public static async Task<string> GetAgent(string name, string version, CancellationToken token) {
internal static async Task<string> GetAgent(Program.Parameters parameters, string name, string version, CancellationToken token) {
// Allow versions like v3.0.0 and not only 3.0.0
version = version.Substring(version.IndexOf("v") + 1);
var azagent = name == "azagent";
Expand All @@ -180,14 +180,14 @@ public static async Task<string> GetAgent(string name, string version, Cancellat
// Note use the vsts package, because container operations have node6 hardcoded as trampoline
Func<string, string, string> AURL = azagent ? (arch, ext) => $"https://vstsagentpackage.azureedge.net/agent/{version}/vsts-agent-{arch}-{version}.{ext}" : (arch, ext) => $"https://github.com/actions/runner/releases/download/v{version}/actions-runner-{arch}-{version}.{ext}";
var _tools = new Dictionary<string, Func<string, Task>> {
{ "windows/386", dest => DownloadTool(AURL("win-x86", "zip"), dest, token, unwrap: false)},
{ "windows/amd64", dest => DownloadTool(AURL("win-x64", "zip"), dest, token, unwrap: false)},
{ "windows/arm64", dest => DownloadTool(AURL("win-arm64", "zip"), dest, token, unwrap: false)},
{ "linux/amd64", dest => DownloadTool(AURL("linux-x64", "tar.gz"), dest, token, unwrap: false)},
{ "linux/arm", dest => DownloadTool(AURL("linux-arm", "tar.gz"), dest, token, unwrap: false)},
{ "linux/arm64", dest => DownloadTool(AURL("linux-arm64", "tar.gz"), dest, token, unwrap: false)},
{ "osx/amd64", dest => DownloadTool(AURL("osx-x64", "tar.gz"), dest, token, unwrap: false)},
{ "osx/arm64", dest => DownloadTool(AURL("osx-arm64", "tar.gz"), dest, token, unwrap: false)},
{ "windows/386", dest => DownloadTool(parameters, AURL("win-x86", "zip"), dest, token, unwrap: false)},
{ "windows/amd64", dest => DownloadTool(parameters, AURL("win-x64", "zip"), dest, token, unwrap: false)},
{ "windows/arm64", dest => DownloadTool(parameters, AURL("win-arm64", "zip"), dest, token, unwrap: false)},
{ "linux/amd64", dest => DownloadTool(parameters, AURL("linux-x64", "tar.gz"), dest, token, unwrap: false)},
{ "linux/arm", dest => DownloadTool(parameters, AURL("linux-arm", "tar.gz"), dest, token, unwrap: false)},
{ "linux/arm64", dest => DownloadTool(parameters, AURL("linux-arm64", "tar.gz"), dest, token, unwrap: false)},
{ "osx/amd64", dest => DownloadTool(parameters, AURL("osx-x64", "tar.gz"), dest, token, unwrap: false)},
{ "osx/arm64", dest => DownloadTool(parameters, AURL("osx-arm64", "tar.gz"), dest, token, unwrap: false)},
};
if(_tools.TryGetValue(platform, out Func<string, Task> download)) {
await download(Path.Combine(externalsPath, name, version));
Expand Down
Loading

0 comments on commit 5716f86

Please sign in to comment.