Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6792966801 | |||
| 8d231aaf86 |
+2
-28
@@ -1,33 +1,7 @@
|
|||||||
## What's Changed
|
## What's Changed
|
||||||
* Log inner exception message. by @TingluoHuang in https://github.com/actions/runner/pull/4265
|
* Remove AllowCaseFunction feature flag by @ericsciple in https://github.com/actions/runner/pull/4316
|
||||||
* Fix composite post-step marker display names by @ericsciple in https://github.com/actions/runner/pull/4267
|
|
||||||
* Bump actions/download-artifact from 7 to 8 by @dependabot[bot] in https://github.com/actions/runner/pull/4269
|
|
||||||
* chore: update Node versions by @github-actions[bot] in https://github.com/actions/runner/pull/4272
|
|
||||||
* Avoid throw in SelfUpdaters. by @TingluoHuang in https://github.com/actions/runner/pull/4274
|
|
||||||
* Fix parser comparison mismatches by @ericsciple in https://github.com/actions/runner/pull/4273
|
|
||||||
* Devcontainer: bump base image Ubuntu version by @MaxHorstmann in https://github.com/actions/runner/pull/4277
|
|
||||||
* Support `entrypoint` and `command` for service containers by @ericsciple in https://github.com/actions/runner/pull/4276
|
|
||||||
* Bump actions/upload-artifact from 6 to 7 by @dependabot[bot] in https://github.com/actions/runner/pull/4270
|
|
||||||
* Bump docker/login-action from 3 to 4 by @dependabot[bot] in https://github.com/actions/runner/pull/4278
|
|
||||||
* Fix positional arg bug in ExpressionParser.CreateTree by @ericsciple in https://github.com/actions/runner/pull/4279
|
|
||||||
* Bump docker/build-push-action from 6 to 7 by @dependabot[bot] in https://github.com/actions/runner/pull/4283
|
|
||||||
* Bump docker/setup-buildx-action from 3 to 4 by @dependabot[bot] in https://github.com/actions/runner/pull/4282
|
|
||||||
* Bump actions/attest-build-provenance from 3 to 4 by @dependabot[bot] in https://github.com/actions/runner/pull/4266
|
|
||||||
* Bump @stylistic/eslint-plugin from 5.9.0 to 5.10.0 in /src/Misc/expressionFunc/hashFiles by @dependabot[bot] in https://github.com/actions/runner/pull/4281
|
|
||||||
* Update Docker to v29.3.0 and Buildx to v0.32.1 by @github-actions[bot] in https://github.com/actions/runner/pull/4286
|
|
||||||
* chore: update Node versions by @github-actions[bot] in https://github.com/actions/runner/pull/4287
|
|
||||||
* Fix cancellation token race during parser comparison by @ericsciple in https://github.com/actions/runner/pull/4280
|
|
||||||
* Bump @typescript-eslint/eslint-plugin from 8.47.0 to 8.54.0 in /src/Misc/expressionFunc/hashFiles by @dependabot[bot] in https://github.com/actions/runner/pull/4230
|
|
||||||
* Exit with specified exit code when runner is outdated by @nikola-jokic in https://github.com/actions/runner/pull/4285
|
|
||||||
* Report infra_error for action download failures. by @TingluoHuang in https://github.com/actions/runner/pull/4294
|
|
||||||
* Update dotnet sdk to latest version @8.0.419 by @github-actions[bot] in https://github.com/actions/runner/pull/4301
|
|
||||||
* Node 24 enforcement + Linux ARM32 deprecation support by @salmanmkc in https://github.com/actions/runner/pull/4303
|
|
||||||
* Bump @typescript-eslint/eslint-plugin from 8.54.0 to 8.57.1 in /src/Misc/expressionFunc/hashFiles by @dependabot[bot] in https://github.com/actions/runner/pull/4304
|
|
||||||
|
|
||||||
## New Contributors
|
**Full Changelog**: https://github.com/actions/runner/compare/v2.333.0...v2.333.1
|
||||||
* @MaxHorstmann made their first contribution in https://github.com/actions/runner/pull/4277
|
|
||||||
|
|
||||||
**Full Changelog**: https://github.com/actions/runner/compare/v2.332.0...v2.333.0
|
|
||||||
|
|
||||||
_Note: Actions Runner follows a progressive release policy, so the latest release might not be available to your enterprise, organization, or repository yet.
|
_Note: Actions Runner follows a progressive release policy, so the latest release might not be available to your enterprise, organization, or repository yet.
|
||||||
To confirm which version of the Actions Runner you should expect, please view the download instructions for your enterprise, organization, or repository.
|
To confirm which version of the Actions Runner you should expect, please view the download instructions for your enterprise, organization, or repository.
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
<Update to ./src/runnerversion when creating release>
|
2.333.1
|
||||||
@@ -316,7 +316,6 @@ namespace GitHub.Runner.Worker
|
|||||||
Schema = _actionManifestSchema,
|
Schema = _actionManifestSchema,
|
||||||
// TODO: Switch to real tracewriter for cutover
|
// TODO: Switch to real tracewriter for cutover
|
||||||
TraceWriter = new GitHub.Actions.WorkflowParser.ObjectTemplating.EmptyTraceWriter(),
|
TraceWriter = new GitHub.Actions.WorkflowParser.ObjectTemplating.EmptyTraceWriter(),
|
||||||
AllowCaseFunction = false,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Expression values from execution context
|
// Expression values from execution context
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@@ -315,7 +315,6 @@ namespace GitHub.Runner.Worker
|
|||||||
maxBytes: 10 * 1024 * 1024),
|
maxBytes: 10 * 1024 * 1024),
|
||||||
Schema = _actionManifestSchema,
|
Schema = _actionManifestSchema,
|
||||||
TraceWriter = executionContext.ToTemplateTraceWriter(),
|
TraceWriter = executionContext.ToTemplateTraceWriter(),
|
||||||
AllowCaseFunction = false,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Expression values from execution context
|
// Expression values from execution context
|
||||||
|
|||||||
@@ -17,10 +17,9 @@ namespace GitHub.DistributedTask.Expressions2
|
|||||||
String expression,
|
String expression,
|
||||||
ITraceWriter trace,
|
ITraceWriter trace,
|
||||||
IEnumerable<INamedValueInfo> namedValues,
|
IEnumerable<INamedValueInfo> namedValues,
|
||||||
IEnumerable<IFunctionInfo> functions,
|
IEnumerable<IFunctionInfo> functions)
|
||||||
Boolean allowCaseFunction = true)
|
|
||||||
{
|
{
|
||||||
var context = new ParseContext(expression, trace, namedValues, functions, allowCaseFunction: allowCaseFunction);
|
var context = new ParseContext(expression, trace, namedValues, functions);
|
||||||
context.Trace.Info($"Parsing expression: <{expression}>");
|
context.Trace.Info($"Parsing expression: <{expression}>");
|
||||||
return CreateTree(context);
|
return CreateTree(context);
|
||||||
}
|
}
|
||||||
@@ -416,12 +415,6 @@ namespace GitHub.DistributedTask.Expressions2
|
|||||||
String name,
|
String name,
|
||||||
out IFunctionInfo functionInfo)
|
out IFunctionInfo functionInfo)
|
||||||
{
|
{
|
||||||
if (String.Equals(name, "case", StringComparison.OrdinalIgnoreCase) && !context.AllowCaseFunction)
|
|
||||||
{
|
|
||||||
functionInfo = null;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ExpressionConstants.WellKnownFunctions.TryGetValue(name, out functionInfo) ||
|
return ExpressionConstants.WellKnownFunctions.TryGetValue(name, out functionInfo) ||
|
||||||
context.ExtensionFunctions.TryGetValue(name, out functionInfo);
|
context.ExtensionFunctions.TryGetValue(name, out functionInfo);
|
||||||
}
|
}
|
||||||
@@ -429,7 +422,6 @@ namespace GitHub.DistributedTask.Expressions2
|
|||||||
private sealed class ParseContext
|
private sealed class ParseContext
|
||||||
{
|
{
|
||||||
public Boolean AllowUnknownKeywords;
|
public Boolean AllowUnknownKeywords;
|
||||||
public Boolean AllowCaseFunction;
|
|
||||||
public readonly String Expression;
|
public readonly String Expression;
|
||||||
public readonly Dictionary<String, IFunctionInfo> ExtensionFunctions = new Dictionary<String, IFunctionInfo>(StringComparer.OrdinalIgnoreCase);
|
public readonly Dictionary<String, IFunctionInfo> ExtensionFunctions = new Dictionary<String, IFunctionInfo>(StringComparer.OrdinalIgnoreCase);
|
||||||
public readonly Dictionary<String, INamedValueInfo> ExtensionNamedValues = new Dictionary<String, INamedValueInfo>(StringComparer.OrdinalIgnoreCase);
|
public readonly Dictionary<String, INamedValueInfo> ExtensionNamedValues = new Dictionary<String, INamedValueInfo>(StringComparer.OrdinalIgnoreCase);
|
||||||
@@ -445,8 +437,7 @@ namespace GitHub.DistributedTask.Expressions2
|
|||||||
ITraceWriter trace,
|
ITraceWriter trace,
|
||||||
IEnumerable<INamedValueInfo> namedValues,
|
IEnumerable<INamedValueInfo> namedValues,
|
||||||
IEnumerable<IFunctionInfo> functions,
|
IEnumerable<IFunctionInfo> functions,
|
||||||
Boolean allowUnknownKeywords = false,
|
Boolean allowUnknownKeywords = false)
|
||||||
Boolean allowCaseFunction = true)
|
|
||||||
{
|
{
|
||||||
Expression = expression ?? String.Empty;
|
Expression = expression ?? String.Empty;
|
||||||
if (Expression.Length > ExpressionConstants.MaxLength)
|
if (Expression.Length > ExpressionConstants.MaxLength)
|
||||||
@@ -467,7 +458,6 @@ namespace GitHub.DistributedTask.Expressions2
|
|||||||
|
|
||||||
LexicalAnalyzer = new LexicalAnalyzer(Expression);
|
LexicalAnalyzer = new LexicalAnalyzer(Expression);
|
||||||
AllowUnknownKeywords = allowUnknownKeywords;
|
AllowUnknownKeywords = allowUnknownKeywords;
|
||||||
AllowCaseFunction = allowCaseFunction;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class NoOperationTraceWriter : ITraceWriter
|
private class NoOperationTraceWriter : ITraceWriter
|
||||||
|
|||||||
@@ -86,12 +86,6 @@ namespace GitHub.DistributedTask.ObjectTemplating
|
|||||||
|
|
||||||
internal ITraceWriter TraceWriter { get; set; }
|
internal ITraceWriter TraceWriter { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets a value indicating whether the case expression function is allowed.
|
|
||||||
/// Defaults to true. Set to false to disable the case function.
|
|
||||||
/// </summary>
|
|
||||||
internal Boolean AllowCaseFunction { get; set; } = true;
|
|
||||||
|
|
||||||
private IDictionary<String, Int32> FileIds
|
private IDictionary<String, Int32> FileIds
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ namespace GitHub.DistributedTask.ObjectTemplating.Tokens
|
|||||||
var originalBytes = context.Memory.CurrentBytes;
|
var originalBytes = context.Memory.CurrentBytes;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var tree = new ExpressionParser().CreateTree(expression, null, context.GetExpressionNamedValues(), context.ExpressionFunctions, allowCaseFunction: context.AllowCaseFunction);
|
var tree = new ExpressionParser().CreateTree(expression, null, context.GetExpressionNamedValues(), context.ExpressionFunctions);
|
||||||
var options = new EvaluationOptions
|
var options = new EvaluationOptions
|
||||||
{
|
{
|
||||||
MaxMemory = context.Memory.MaxBytes,
|
MaxMemory = context.Memory.MaxBytes,
|
||||||
@@ -94,7 +94,7 @@ namespace GitHub.DistributedTask.ObjectTemplating.Tokens
|
|||||||
var originalBytes = context.Memory.CurrentBytes;
|
var originalBytes = context.Memory.CurrentBytes;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var tree = new ExpressionParser().CreateTree(expression, null, context.GetExpressionNamedValues(), context.ExpressionFunctions, allowCaseFunction: context.AllowCaseFunction);
|
var tree = new ExpressionParser().CreateTree(expression, null, context.GetExpressionNamedValues(), context.ExpressionFunctions);
|
||||||
var options = new EvaluationOptions
|
var options = new EvaluationOptions
|
||||||
{
|
{
|
||||||
MaxMemory = context.Memory.MaxBytes,
|
MaxMemory = context.Memory.MaxBytes,
|
||||||
@@ -123,7 +123,7 @@ namespace GitHub.DistributedTask.ObjectTemplating.Tokens
|
|||||||
var originalBytes = context.Memory.CurrentBytes;
|
var originalBytes = context.Memory.CurrentBytes;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var tree = new ExpressionParser().CreateTree(expression, null, context.GetExpressionNamedValues(), context.ExpressionFunctions, allowCaseFunction: context.AllowCaseFunction);
|
var tree = new ExpressionParser().CreateTree(expression, null, context.GetExpressionNamedValues(), context.ExpressionFunctions);
|
||||||
var options = new EvaluationOptions
|
var options = new EvaluationOptions
|
||||||
{
|
{
|
||||||
MaxMemory = context.Memory.MaxBytes,
|
MaxMemory = context.Memory.MaxBytes,
|
||||||
@@ -152,7 +152,7 @@ namespace GitHub.DistributedTask.ObjectTemplating.Tokens
|
|||||||
var originalBytes = context.Memory.CurrentBytes;
|
var originalBytes = context.Memory.CurrentBytes;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var tree = new ExpressionParser().CreateTree(expression, null, context.GetExpressionNamedValues(), context.ExpressionFunctions, allowCaseFunction: context.AllowCaseFunction);
|
var tree = new ExpressionParser().CreateTree(expression, null, context.GetExpressionNamedValues(), context.ExpressionFunctions);
|
||||||
var options = new EvaluationOptions
|
var options = new EvaluationOptions
|
||||||
{
|
{
|
||||||
MaxMemory = context.Memory.MaxBytes,
|
MaxMemory = context.Memory.MaxBytes,
|
||||||
|
|||||||
@@ -681,7 +681,7 @@ namespace GitHub.DistributedTask.Pipelines.ObjectTemplating
|
|||||||
var node = default(ExpressionNode);
|
var node = default(ExpressionNode);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
node = expressionParser.CreateTree(condition, null, namedValues, functions, allowCaseFunction: context.AllowCaseFunction) as ExpressionNode;
|
node = expressionParser.CreateTree(condition, null, namedValues, functions) as ExpressionNode;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#nullable disable // Consider removing in the future to minimize likelihood of NullReferenceException; refer https://learn.microsoft.com/en-us/dotnet/csharp/nullable-references
|
#nullable disable // Consider removing in the future to minimize likelihood of NullReferenceException; refer https://learn.microsoft.com/en-us/dotnet/csharp/nullable-references
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -17,10 +17,9 @@ namespace GitHub.Actions.Expressions
|
|||||||
String expression,
|
String expression,
|
||||||
ITraceWriter trace,
|
ITraceWriter trace,
|
||||||
IEnumerable<INamedValueInfo> namedValues,
|
IEnumerable<INamedValueInfo> namedValues,
|
||||||
IEnumerable<IFunctionInfo> functions,
|
IEnumerable<IFunctionInfo> functions)
|
||||||
Boolean allowCaseFunction = true)
|
|
||||||
{
|
{
|
||||||
var context = new ParseContext(expression, trace, namedValues, functions, allowCaseFunction: allowCaseFunction);
|
var context = new ParseContext(expression, trace, namedValues, functions);
|
||||||
context.Trace.Info($"Parsing expression: <{expression}>");
|
context.Trace.Info($"Parsing expression: <{expression}>");
|
||||||
return CreateTree(context);
|
return CreateTree(context);
|
||||||
}
|
}
|
||||||
@@ -416,12 +415,6 @@ namespace GitHub.Actions.Expressions
|
|||||||
String name,
|
String name,
|
||||||
out IFunctionInfo functionInfo)
|
out IFunctionInfo functionInfo)
|
||||||
{
|
{
|
||||||
if (String.Equals(name, "case", StringComparison.OrdinalIgnoreCase) && !context.AllowCaseFunction)
|
|
||||||
{
|
|
||||||
functionInfo = null;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ExpressionConstants.WellKnownFunctions.TryGetValue(name, out functionInfo) ||
|
return ExpressionConstants.WellKnownFunctions.TryGetValue(name, out functionInfo) ||
|
||||||
context.ExtensionFunctions.TryGetValue(name, out functionInfo);
|
context.ExtensionFunctions.TryGetValue(name, out functionInfo);
|
||||||
}
|
}
|
||||||
@@ -429,7 +422,6 @@ namespace GitHub.Actions.Expressions
|
|||||||
private sealed class ParseContext
|
private sealed class ParseContext
|
||||||
{
|
{
|
||||||
public Boolean AllowUnknownKeywords;
|
public Boolean AllowUnknownKeywords;
|
||||||
public Boolean AllowCaseFunction;
|
|
||||||
public readonly String Expression;
|
public readonly String Expression;
|
||||||
public readonly Dictionary<String, IFunctionInfo> ExtensionFunctions = new Dictionary<String, IFunctionInfo>(StringComparer.OrdinalIgnoreCase);
|
public readonly Dictionary<String, IFunctionInfo> ExtensionFunctions = new Dictionary<String, IFunctionInfo>(StringComparer.OrdinalIgnoreCase);
|
||||||
public readonly Dictionary<String, INamedValueInfo> ExtensionNamedValues = new Dictionary<String, INamedValueInfo>(StringComparer.OrdinalIgnoreCase);
|
public readonly Dictionary<String, INamedValueInfo> ExtensionNamedValues = new Dictionary<String, INamedValueInfo>(StringComparer.OrdinalIgnoreCase);
|
||||||
@@ -445,8 +437,7 @@ namespace GitHub.Actions.Expressions
|
|||||||
ITraceWriter trace,
|
ITraceWriter trace,
|
||||||
IEnumerable<INamedValueInfo> namedValues,
|
IEnumerable<INamedValueInfo> namedValues,
|
||||||
IEnumerable<IFunctionInfo> functions,
|
IEnumerable<IFunctionInfo> functions,
|
||||||
Boolean allowUnknownKeywords = false,
|
Boolean allowUnknownKeywords = false)
|
||||||
Boolean allowCaseFunction = true)
|
|
||||||
{
|
{
|
||||||
Expression = expression ?? String.Empty;
|
Expression = expression ?? String.Empty;
|
||||||
if (Expression.Length > ExpressionConstants.MaxLength)
|
if (Expression.Length > ExpressionConstants.MaxLength)
|
||||||
@@ -467,7 +458,6 @@ namespace GitHub.Actions.Expressions
|
|||||||
|
|
||||||
LexicalAnalyzer = new LexicalAnalyzer(Expression);
|
LexicalAnalyzer = new LexicalAnalyzer(Expression);
|
||||||
AllowUnknownKeywords = allowUnknownKeywords;
|
AllowUnknownKeywords = allowUnknownKeywords;
|
||||||
AllowCaseFunction = allowCaseFunction;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class NoOperationTraceWriter : ITraceWriter
|
private class NoOperationTraceWriter : ITraceWriter
|
||||||
|
|||||||
@@ -1828,7 +1828,7 @@ namespace GitHub.Actions.WorkflowParser.Conversion
|
|||||||
var node = default(ExpressionNode);
|
var node = default(ExpressionNode);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
node = expressionParser.CreateTree(condition, null, namedValues, functions, allowCaseFunction: context.AllowCaseFunction) as ExpressionNode;
|
node = expressionParser.CreateTree(condition, null, namedValues, functions) as ExpressionNode;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#nullable disable // Consider removing in the future to minimize likelihood of NullReferenceException; refer https://learn.microsoft.com/en-us/dotnet/csharp/nullable-references
|
#nullable disable // Consider removing in the future to minimize likelihood of NullReferenceException; refer https://learn.microsoft.com/en-us/dotnet/csharp/nullable-references
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -113,12 +113,6 @@ namespace GitHub.Actions.WorkflowParser.ObjectTemplating
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal Boolean StrictJsonParsing { get; set; }
|
internal Boolean StrictJsonParsing { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets a value indicating whether the case expression function is allowed.
|
|
||||||
/// Defaults to true. Set to false to disable the case function.
|
|
||||||
/// </summary>
|
|
||||||
internal Boolean AllowCaseFunction { get; set; } = true;
|
|
||||||
|
|
||||||
internal ITraceWriter TraceWriter { get; set; }
|
internal ITraceWriter TraceWriter { get; set; }
|
||||||
|
|
||||||
private IDictionary<String, Int32> FileIds
|
private IDictionary<String, Int32> FileIds
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#nullable disable // Consider removing in the future to minimize likelihood of NullReferenceException; refer https://learn.microsoft.com/en-us/dotnet/csharp/nullable-references
|
#nullable disable // Consider removing in the future to minimize likelihood of NullReferenceException; refer https://learn.microsoft.com/en-us/dotnet/csharp/nullable-references
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -55,7 +55,7 @@ namespace GitHub.Actions.WorkflowParser.ObjectTemplating.Tokens
|
|||||||
var originalBytes = context.Memory.CurrentBytes;
|
var originalBytes = context.Memory.CurrentBytes;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var tree = new ExpressionParser().CreateTree(expression, null, context.GetExpressionNamedValues(), context.ExpressionFunctions, allowCaseFunction: context.AllowCaseFunction);
|
var tree = new ExpressionParser().CreateTree(expression, null, context.GetExpressionNamedValues(), context.ExpressionFunctions);
|
||||||
var options = new EvaluationOptions
|
var options = new EvaluationOptions
|
||||||
{
|
{
|
||||||
MaxMemory = context.Memory.MaxBytes,
|
MaxMemory = context.Memory.MaxBytes,
|
||||||
@@ -93,7 +93,7 @@ namespace GitHub.Actions.WorkflowParser.ObjectTemplating.Tokens
|
|||||||
var originalBytes = context.Memory.CurrentBytes;
|
var originalBytes = context.Memory.CurrentBytes;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var tree = new ExpressionParser().CreateTree(expression, null, context.GetExpressionNamedValues(), context.ExpressionFunctions, allowCaseFunction: context.AllowCaseFunction);
|
var tree = new ExpressionParser().CreateTree(expression, null, context.GetExpressionNamedValues(), context.ExpressionFunctions);
|
||||||
var options = new EvaluationOptions
|
var options = new EvaluationOptions
|
||||||
{
|
{
|
||||||
MaxMemory = context.Memory.MaxBytes,
|
MaxMemory = context.Memory.MaxBytes,
|
||||||
@@ -123,7 +123,7 @@ namespace GitHub.Actions.WorkflowParser.ObjectTemplating.Tokens
|
|||||||
var originalBytes = context.Memory.CurrentBytes;
|
var originalBytes = context.Memory.CurrentBytes;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var tree = new ExpressionParser().CreateTree(expression, null, context.GetExpressionNamedValues(), context.ExpressionFunctions, allowCaseFunction: context.AllowCaseFunction);
|
var tree = new ExpressionParser().CreateTree(expression, null, context.GetExpressionNamedValues(), context.ExpressionFunctions);
|
||||||
var options = new EvaluationOptions
|
var options = new EvaluationOptions
|
||||||
{
|
{
|
||||||
MaxMemory = context.Memory.MaxBytes,
|
MaxMemory = context.Memory.MaxBytes,
|
||||||
@@ -153,7 +153,7 @@ namespace GitHub.Actions.WorkflowParser.ObjectTemplating.Tokens
|
|||||||
var originalBytes = context.Memory.CurrentBytes;
|
var originalBytes = context.Memory.CurrentBytes;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var tree = new ExpressionParser().CreateTree(expression, null, context.GetExpressionNamedValues(), context.ExpressionFunctions, allowCaseFunction: context.AllowCaseFunction);
|
var tree = new ExpressionParser().CreateTree(expression, null, context.GetExpressionNamedValues(), context.ExpressionFunctions);
|
||||||
var options = new EvaluationOptions
|
var options = new EvaluationOptions
|
||||||
{
|
{
|
||||||
MaxMemory = context.Memory.MaxBytes,
|
MaxMemory = context.Memory.MaxBytes,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using GitHub.DistributedTask.Expressions2;
|
using GitHub.DistributedTask.Expressions2;
|
||||||
using GitHub.DistributedTask.Expressions2.Sdk;
|
using GitHub.DistributedTask.Expressions2.Sdk;
|
||||||
using GitHub.DistributedTask.ObjectTemplating;
|
using GitHub.DistributedTask.ObjectTemplating;
|
||||||
using System;
|
using System;
|
||||||
@@ -9,7 +9,7 @@ namespace GitHub.Runner.Common.Tests.Sdk
|
|||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Regression tests for ExpressionParser.CreateTree to verify that
|
/// Regression tests for ExpressionParser.CreateTree to verify that
|
||||||
/// allowCaseFunction does not accidentally set allowUnknownKeywords.
|
/// the case function does not accidentally set allowUnknownKeywords.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class ExpressionParserL0
|
public sealed class ExpressionParserL0
|
||||||
{
|
{
|
||||||
@@ -18,7 +18,7 @@ namespace GitHub.Runner.Common.Tests.Sdk
|
|||||||
[Trait("Category", "Sdk")]
|
[Trait("Category", "Sdk")]
|
||||||
public void CreateTree_RejectsUnrecognizedNamedValue()
|
public void CreateTree_RejectsUnrecognizedNamedValue()
|
||||||
{
|
{
|
||||||
// Regression: allowCaseFunction was passed positionally into
|
// Regression: the case function parameter was passed positionally into
|
||||||
// the allowUnknownKeywords parameter, causing all named values
|
// the allowUnknownKeywords parameter, causing all named values
|
||||||
// to be silently accepted.
|
// to be silently accepted.
|
||||||
var parser = new ExpressionParser();
|
var parser = new ExpressionParser();
|
||||||
@@ -52,7 +52,7 @@ namespace GitHub.Runner.Common.Tests.Sdk
|
|||||||
[Fact]
|
[Fact]
|
||||||
[Trait("Level", "L0")]
|
[Trait("Level", "L0")]
|
||||||
[Trait("Category", "Sdk")]
|
[Trait("Category", "Sdk")]
|
||||||
public void CreateTree_CaseFunctionWorks_WhenAllowed()
|
public void CreateTree_CaseFunctionWorks()
|
||||||
{
|
{
|
||||||
var parser = new ExpressionParser();
|
var parser = new ExpressionParser();
|
||||||
var namedValues = new List<INamedValueInfo>
|
var namedValues = new List<INamedValueInfo>
|
||||||
@@ -60,35 +60,17 @@ namespace GitHub.Runner.Common.Tests.Sdk
|
|||||||
new NamedValueInfo<ContextValueNode>("github"),
|
new NamedValueInfo<ContextValueNode>("github"),
|
||||||
};
|
};
|
||||||
|
|
||||||
var node = parser.CreateTree("case(github.event_name, 'push', 'Push Event')", null, namedValues, null, allowCaseFunction: true);
|
var node = parser.CreateTree("case(github.event_name, 'push', 'Push Event')", null, namedValues, null);
|
||||||
|
|
||||||
Assert.NotNull(node);
|
Assert.NotNull(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
|
||||||
[Trait("Level", "L0")]
|
|
||||||
[Trait("Category", "Sdk")]
|
|
||||||
public void CreateTree_CaseFunctionRejected_WhenDisallowed()
|
|
||||||
{
|
|
||||||
var parser = new ExpressionParser();
|
|
||||||
var namedValues = new List<INamedValueInfo>
|
|
||||||
{
|
|
||||||
new NamedValueInfo<ContextValueNode>("github"),
|
|
||||||
};
|
|
||||||
|
|
||||||
var ex = Assert.Throws<ParseException>(() =>
|
|
||||||
parser.CreateTree("case(github.event_name, 'push', 'Push Event')", null, namedValues, null, allowCaseFunction: false));
|
|
||||||
|
|
||||||
Assert.Contains("Unrecognized function", ex.Message);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
[Trait("Level", "L0")]
|
[Trait("Level", "L0")]
|
||||||
[Trait("Category", "Sdk")]
|
[Trait("Category", "Sdk")]
|
||||||
public void CreateTree_CaseFunctionDoesNotAffectUnknownKeywords()
|
public void CreateTree_CaseFunctionDoesNotAffectUnknownKeywords()
|
||||||
{
|
{
|
||||||
// The key regression test: with allowCaseFunction=true (default),
|
// The key regression test: unrecognized named values must still be rejected.
|
||||||
// unrecognized named values must still be rejected.
|
|
||||||
var parser = new ExpressionParser();
|
var parser = new ExpressionParser();
|
||||||
var namedValues = new List<INamedValueInfo>
|
var namedValues = new List<INamedValueInfo>
|
||||||
{
|
{
|
||||||
@@ -96,7 +78,7 @@ namespace GitHub.Runner.Common.Tests.Sdk
|
|||||||
};
|
};
|
||||||
|
|
||||||
var ex = Assert.Throws<ParseException>(() =>
|
var ex = Assert.Throws<ParseException>(() =>
|
||||||
parser.CreateTree("github.ref", null, namedValues, null, allowCaseFunction: true));
|
parser.CreateTree("github.ref", null, namedValues, null));
|
||||||
|
|
||||||
Assert.Contains("Unrecognized named-value", ex.Message);
|
Assert.Contains("Unrecognized named-value", ex.Message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -504,7 +504,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
[Trait("Level", "L0")]
|
[Trait("Level", "L0")]
|
||||||
[Trait("Category", "Worker")]
|
[Trait("Category", "Worker")]
|
||||||
public void Load_Node24Action()
|
public void Load_Node24Action()
|
||||||
@@ -1006,6 +1006,45 @@ namespace GitHub.Runner.Common.Tests.Worker
|
|||||||
_ec.Setup(x => x.AddIssue(It.IsAny<Issue>(), It.IsAny<ExecutionContextLogOptions>())).Callback((Issue issue, ExecutionContextLogOptions logOptions) => { _hc.GetTrace().Info($"[{issue.Type}]{logOptions.LogMessageOverride ?? issue.Message}"); });
|
_ec.Setup(x => x.AddIssue(It.IsAny<Issue>(), It.IsAny<ExecutionContextLogOptions>())).Callback((Issue issue, ExecutionContextLogOptions logOptions) => { _hc.GetTrace().Info($"[{issue.Type}]{logOptions.LogMessageOverride ?? issue.Message}"); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
[Trait("Level", "L0")]
|
||||||
|
[Trait("Category", "Worker")]
|
||||||
|
public void Evaluate_Default_Input_Case_Function()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
Setup();
|
||||||
|
|
||||||
|
var actionManifest = new ActionManifestManager();
|
||||||
|
actionManifest.Initialize(_hc);
|
||||||
|
|
||||||
|
_ec.Object.ExpressionValues["github"] = new LegacyContextData.DictionaryContextData
|
||||||
|
{
|
||||||
|
{ "ref", new LegacyContextData.StringContextData("refs/heads/main") },
|
||||||
|
};
|
||||||
|
_ec.Object.ExpressionValues["strategy"] = new LegacyContextData.DictionaryContextData();
|
||||||
|
_ec.Object.ExpressionValues["matrix"] = new LegacyContextData.DictionaryContextData();
|
||||||
|
_ec.Object.ExpressionValues["steps"] = new LegacyContextData.DictionaryContextData();
|
||||||
|
_ec.Object.ExpressionValues["job"] = new LegacyContextData.DictionaryContextData();
|
||||||
|
_ec.Object.ExpressionValues["runner"] = new LegacyContextData.DictionaryContextData();
|
||||||
|
_ec.Object.ExpressionValues["env"] = new LegacyContextData.DictionaryContextData();
|
||||||
|
_ec.Object.ExpressionFunctions.Add(new LegacyExpressions.FunctionInfo<GitHub.Runner.Worker.Expressions.HashFilesFunction>("hashFiles", 1, 255));
|
||||||
|
|
||||||
|
// Act — evaluate a case() expression as a default input value.
|
||||||
|
// The feature flag is set, so this should succeed.
|
||||||
|
var token = new BasicExpressionToken(null, null, null, "case(true, 'matched', 'default')");
|
||||||
|
var result = actionManifest.EvaluateDefaultInput(_ec.Object, "testInput", token);
|
||||||
|
|
||||||
|
// Assert — case() should evaluate successfully
|
||||||
|
Assert.Equal("matched", result);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Teardown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Teardown()
|
private void Teardown()
|
||||||
{
|
{
|
||||||
_hc?.Dispose();
|
_hc?.Dispose();
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
2.333.0
|
2.333.1
|
||||||
Reference in New Issue
Block a user