do not trucate error message from template evaluation (#1038)

This commit is contained in:
eric sciple
2021-04-06 15:45:40 -05:00
committed by TingluoHuang
parent 91755dee3f
commit 50ff391290
3 changed files with 6 additions and 3 deletions

View File

@@ -311,7 +311,7 @@ namespace GitHub.Runner.Worker
var result = new TemplateContext var result = new TemplateContext
{ {
CancellationToken = CancellationToken.None, CancellationToken = CancellationToken.None,
Errors = new TemplateValidationErrors(10, 500), Errors = new TemplateValidationErrors(10, int.MaxValue), // Don't truncate error messages otherwise we might not scrub secrets correctly
Memory = new TemplateMemory( Memory = new TemplateMemory(
maxDepth: 100, maxDepth: 100,
maxEvents: 1000000, maxEvents: 1000000,

View File

@@ -979,7 +979,10 @@ namespace GitHub.Runner.Worker
traceWriter = context.ToTemplateTraceWriter(); traceWriter = context.ToTemplateTraceWriter();
} }
var schema = PipelineTemplateSchemaFactory.GetSchema(); var schema = PipelineTemplateSchemaFactory.GetSchema();
return new PipelineTemplateEvaluator(traceWriter, schema, context.Global.FileTable); return new PipelineTemplateEvaluator(traceWriter, schema, context.Global.FileTable)
{
MaxErrorMessageLength = int.MaxValue, // Don't truncate error messages otherwise we might not scrub secrets correctly
};
} }
public static ObjectTemplating.ITraceWriter ToTemplateTraceWriter(this IExecutionContext context) public static ObjectTemplating.ITraceWriter ToTemplateTraceWriter(this IExecutionContext context)

View File

@@ -40,7 +40,7 @@ namespace GitHub.DistributedTask.Pipelines.ObjectTemplating
/// <summary> /// <summary>
/// Gets the maximum error message length before the message will be truncated. /// Gets the maximum error message length before the message will be truncated.
/// </summary> /// </summary>
public Int32 MaxErrorMessageLength => 500; public Int32 MaxErrorMessageLength { get; set; } = 500;
/// <summary> /// <summary>
/// Gets the maximum number of errors that can be recorded when parsing a pipeline. /// Gets the maximum number of errors that can be recorded when parsing a pipeline.