Compare commits

..

3 Commits

Author SHA1 Message Date
JoannaaKL
302aad97c5 Add solution suggested by @fhammerl 2023-05-17 15:10:16 +00:00
JoannaaKL
17975e3491 Use PascalCase for methods 2023-05-17 09:21:06 +00:00
JoannaaKL
e1e7fde7bc Remove duplicated issues 2023-05-17 08:59:04 +00:00
8 changed files with 5 additions and 70 deletions

View File

@@ -2,7 +2,7 @@ FROM mcr.microsoft.com/dotnet/runtime-deps:6.0 as build
ARG RUNNER_VERSION
ARG RUNNER_ARCH="x64"
ARG RUNNER_CONTAINER_HOOKS_VERSION=0.3.2
ARG RUNNER_CONTAINER_HOOKS_VERSION=0.3.1
ARG DOCKER_VERSION=20.10.23
RUN apt update -y && apt install curl unzip -y

View File

@@ -818,7 +818,6 @@ namespace GitHub.Runner.Common
return mergedRecords;
}
private async Task UploadFile(UploadFileInfo file)
{
bool uploadSucceed = false;

View File

@@ -137,7 +137,7 @@ namespace GitHub.Runner.Listener.Configuration
GitHubAuthResult authResult = await GetTenantCredential(inputUrl, registerToken, Constants.RunnerEvent.Register);
runnerSettings.ServerUrl = authResult.TenantUrl;
runnerSettings.UseV2Flow = authResult.UseV2Flow;
Trace.Info($"Using V2 flow: {runnerSettings.UseV2Flow}");
_term.WriteLine($"Using V2 flow: {runnerSettings.UseV2Flow}");
creds = authResult.ToVssCredentials();
Trace.Info("cred retrieved via GitHub auth");
}

View File

@@ -83,7 +83,7 @@ namespace GitHub.Runner.Worker.Container.ContainerHooks
public HookContainer(ContainerInfo container)
{
Image = container.ContainerImage;
EntryPointArgs = container.ContainerEntryPointArgs?.Split(' ').Select(arg => arg.Trim()).Where(arg => !string.IsNullOrEmpty(arg)) ?? new List<string>();
EntryPointArgs = container.ContainerEntryPointArgs?.Split(' ').Select(arg => arg.Trim()) ?? new List<string>();
EntryPoint = container.ContainerEntryPoint;
WorkingDirectory = container.ContainerWorkDirectory;
CreateOptions = container.ContainerCreateOptions;

View File

@@ -150,11 +150,6 @@ namespace GitHub.Runner.Worker
_runnerSettings = HostContext.GetService<IConfigurationStore>().GetSettings();
jobContext.SetRunnerContext("name", _runnerSettings.AgentName);
if (jobContext.Global.Variables.TryGetValue(WellKnownDistributedTaskVariables.RunnerEnvironment, out var runnerEnvironment))
{
jobContext.SetRunnerContext("environment", runnerEnvironment);
}
string toolsDirectory = HostContext.GetDirectory(WellKnownDirectory.Tools);
Directory.CreateDirectory(toolsDirectory);
jobContext.SetRunnerContext("tool_cache", toolsDirectory);

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
@@ -163,7 +163,6 @@ namespace GitHub.DistributedTask.ObjectTemplating
message = $"{prefix} {message}";
}
Errors.Add(message);
TraceWriter.Error(message);
}

View File

@@ -1,4 +1,4 @@
using System;
using System;
namespace GitHub.DistributedTask.WebApi
{
@@ -6,6 +6,5 @@ namespace GitHub.DistributedTask.WebApi
{
public static readonly String JobId = "system.jobId";
public static readonly String RunnerLowDiskspaceThreshold = "system.runner.lowdiskspacethreshold";
public static readonly String RunnerEnvironment = "system.runnerEnvironment";
}
}

View File

@@ -1,57 +0,0 @@
using System;
using System.Collections.Generic;
using GitHub.DistributedTask.ObjectTemplating.Tokens;
using Xunit;
namespace GitHub.DistributedTask.ObjectTemplating.Tests
{
public sealed class TemplateContextL0
{
[Fact]
[Trait("Level", "L0")]
[Trait("Category", "Common")]
public void VerifyError()
{
TemplateContext context = buildContext();
TemplateToken value = new StringToken(1, 1, 1, "some-token");
System.Exception ex = new System.Exception();
List<TemplateValidationError> expectedErrors = new();
expectedErrors.Add(new TemplateValidationError("(Line: 1, Col: 1): Exception of type 'System.Exception' was thrown."));
context.Error(value, ex);
Assert.True(expectedErrors.SequenceEqual(toList(context.Errors.GetEnumerator())));
Assert.True(true);
}
private TemplateContext buildContext()
{
return new TemplateContext
{
// CancellationToken = CancellationToken.None,
Errors = new TemplateValidationErrors(10, int.MaxValue), // Don't truncate error messages otherwise we might not scrub secrets correctly
Memory = new TemplateMemory(
maxDepth: 100,
maxEvents: 1000000,
maxBytes: 10 * 1024 * 1024),
Schema = null,
TraceWriter = new EmptyTraceWriter(),
};
}
private List<TemplateValidationError> toList(IEnumerator<TemplateValidationError> enumerator)
{
List<TemplateValidationError> result = new();
while (enumerator.MoveNext())
{
TemplateValidationError err = enumerator.Current;
result.Add(err);
}
return result;
}
}
}