mirror of
https://github.com/actions/runner.git
synced 2025-12-11 12:57:05 +00:00
Log template errors as debug messages under feature flag
This commit is contained in:
@@ -155,6 +155,7 @@ namespace GitHub.Runner.Common
|
||||
{
|
||||
public static readonly string DiskSpaceWarning = "runner.diskspace.warning";
|
||||
public static readonly string Node12Warning = "DistributedTask.AddWarningToNode12Action";
|
||||
public static readonly string LogTemplateErrorsAsDebugMessage = "DistributedTask.LogTemplateErrorsAsDebugMessage";
|
||||
public static readonly string UseContainerPathForTemplate = "DistributedTask.UseContainerPathForTemplate";
|
||||
public static readonly string AllowRunnerContainerHooks = "DistributedTask.AllowRunnerContainerHooks";
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ using Newtonsoft.Json;
|
||||
using Sdk.RSWebApi.Contracts;
|
||||
using ObjectTemplating = GitHub.DistributedTask.ObjectTemplating;
|
||||
using Pipelines = GitHub.DistributedTask.Pipelines;
|
||||
using constants = GitHub.Runner.Common.Constants;
|
||||
|
||||
namespace GitHub.Runner.Worker
|
||||
{
|
||||
@@ -1401,9 +1402,15 @@ namespace GitHub.Runner.Worker
|
||||
|
||||
public void Error(string format, params Object[] args)
|
||||
{
|
||||
_executionContext.Error(string.Format(CultureInfo.CurrentCulture, format, args));
|
||||
_executionContext.Global.EnvironmentVariables.TryGetValue(Constants.Runner.Features.LogTemplateErrorsAsDebugMessage, out var logErrorsAsDebug);
|
||||
if (StringUtil.ConvertToBoolean(logErrorsAsDebug, defaultValue: false))
|
||||
{
|
||||
_executionContext.Debug(string.Format(CultureInfo.CurrentCulture, format, args));
|
||||
}
|
||||
else _executionContext.Error(string.Format(CultureInfo.CurrentCulture, format, args));
|
||||
}
|
||||
|
||||
|
||||
public void Info(string format, params Object[] args)
|
||||
{
|
||||
_executionContext.Debug(string.Format(CultureInfo.CurrentCulture, $"{format}", args));
|
||||
|
||||
@@ -152,13 +152,10 @@ namespace GitHub.DistributedTask.ObjectTemplating
|
||||
String message)
|
||||
{
|
||||
var prefix = GetErrorPrefix(fileId, line, column);
|
||||
if (!String.IsNullOrEmpty(prefix))
|
||||
{
|
||||
message = $"{prefix} {message}";
|
||||
}
|
||||
var fullMessage = !String.IsNullOrEmpty(prefix) ? $"{prefix} {message}" : message;
|
||||
|
||||
Errors.Add(message);
|
||||
TraceWriter.Error(message);
|
||||
Errors.Add(fullMessage);
|
||||
TraceWriter.Error(fullMessage);
|
||||
}
|
||||
|
||||
internal INamedValueInfo[] GetExpressionNamedValues()
|
||||
|
||||
Reference in New Issue
Block a user