mirror of
https://github.com/actions/runner.git
synced 2025-12-12 15:13:30 +00:00
Progress towards passing FileTable or FileID or FileName
This commit is contained in:
@@ -1280,6 +1280,8 @@ namespace GitHub.Runner.Worker
|
|||||||
public override ActionExecutionType ExecutionType => ActionExecutionType.Script;
|
public override ActionExecutionType ExecutionType => ActionExecutionType.Script;
|
||||||
public override bool HasPre => false;
|
public override bool HasPre => false;
|
||||||
public override bool HasPost => false;
|
public override bool HasPost => false;
|
||||||
|
|
||||||
|
// TODO: Maybe add FileID here to pass to ScriptHandler for more helpful error message?
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class CompositeActionExecutionData : ActionExecutionData
|
public sealed class CompositeActionExecutionData : ActionExecutionData
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ namespace GitHub.Runner.Worker
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "runs":
|
case "runs":
|
||||||
actionDefinition.Execution = ConvertRuns(executionContext, context, actionPair.Value, envComposite, fileId);
|
actionDefinition.Execution = ConvertRuns(executionContext, context, actionPair.Value, fileId, envComposite);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -235,7 +235,7 @@ namespace GitHub.Runner.Worker
|
|||||||
var context = CreateContext(executionContext, extraExpressionValues);
|
var context = CreateContext(executionContext, extraExpressionValues);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var evaluateResult = TemplateEvaluator.Evaluate(context, "runs-env", token, 0, fileID, omitHeader: true);
|
var evaluateResult = TemplateEvaluator.Evaluate(context, "runs-env", token, 0, fileID, omitHeader: false);
|
||||||
context.Errors.Check();
|
context.Errors.Check();
|
||||||
|
|
||||||
// Mapping
|
// Mapping
|
||||||
@@ -349,9 +349,12 @@ namespace GitHub.Runner.Worker
|
|||||||
IExecutionContext executionContext,
|
IExecutionContext executionContext,
|
||||||
TemplateContext context,
|
TemplateContext context,
|
||||||
TemplateToken inputsToken,
|
TemplateToken inputsToken,
|
||||||
MappingToken envComposite = null,
|
Int32 fileID,
|
||||||
Int32 fileID = default(Int32))
|
MappingToken envComposite = null
|
||||||
|
)
|
||||||
{
|
{
|
||||||
|
Trace.Info($"COMPOSITE ACTIONS FILEID: {fileID}");
|
||||||
|
|
||||||
var runsMapping = inputsToken.AssertMapping("runs");
|
var runsMapping = inputsToken.AssertMapping("runs");
|
||||||
var usingToken = default(StringToken);
|
var usingToken = default(StringToken);
|
||||||
var imageToken = default(StringToken);
|
var imageToken = default(StringToken);
|
||||||
@@ -415,9 +418,15 @@ namespace GitHub.Runner.Worker
|
|||||||
case "steps":
|
case "steps":
|
||||||
if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("TESTING_COMPOSITE_ACTIONS_ALPHA")))
|
if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("TESTING_COMPOSITE_ACTIONS_ALPHA")))
|
||||||
{
|
{
|
||||||
|
Trace.Info($"COMPOSITE ACTIONS FILEID inside steps case: {fileID}");
|
||||||
|
Trace.Info($"COMPOSITE ACTIONS file name inside steps case {context.GetFileName(fileID)}");
|
||||||
|
// File name is loaded correctly!!
|
||||||
|
// WHY DOESN'T THE CONTEXT GET PASED DOWN CORRECTLY?
|
||||||
var steps = run.Value.AssertSequence("steps");
|
var steps = run.Value.AssertSequence("steps");
|
||||||
var evaluator = executionContext.ToPipelineTemplateEvaluator();
|
var evaluator = executionContext.ToPipelineTemplateEvaluator();
|
||||||
stepsLoaded = evaluator.LoadCompositeSteps(steps, fileID);
|
// stepsLoaded = evaluator.LoadCompositeSteps(steps, context.GetFileTable(), fileID);
|
||||||
|
string fileName = context.GetFileName(fileID);
|
||||||
|
stepsLoaded = evaluator.LoadCompositeSteps(steps, fileName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
throw new Exception("You aren't supposed to be using Composite Actions yet!");
|
throw new Exception("You aren't supposed to be using Composite Actions yet!");
|
||||||
|
|||||||
@@ -275,6 +275,7 @@ namespace GitHub.Runner.Worker
|
|||||||
{
|
{
|
||||||
// TODO: For UI purposes, look at figuring out how to condense steps in one node => maybe use the same previous GUID
|
// TODO: For UI purposes, look at figuring out how to condense steps in one node => maybe use the same previous GUID
|
||||||
var newGuid = Guid.NewGuid();
|
var newGuid = Guid.NewGuid();
|
||||||
|
// TODO: maybe have to use record id to figure out the right place to place the error message?
|
||||||
step.ExecutionContext = Root.CreateChild(newGuid, step.DisplayName, newGuid.ToString("N"), null, null);
|
step.ExecutionContext = Root.CreateChild(newGuid, step.DisplayName, newGuid.ToString("N"), null, null);
|
||||||
step.ExecutionContext.ExpressionValues["inputs"] = inputsData;
|
step.ExecutionContext.ExpressionValues["inputs"] = inputsData;
|
||||||
|
|
||||||
|
|||||||
@@ -291,7 +291,9 @@ namespace GitHub.Runner.Worker.Handlers
|
|||||||
// Error
|
// Error
|
||||||
if (exitCode != 0)
|
if (exitCode != 0)
|
||||||
{
|
{
|
||||||
ExecutionContext.Error($"Process completed with exit code {exitCode}.");
|
// TODO: Maybe add FileID here to pass to ScriptHandler for more helpful error message?
|
||||||
|
// ExecutionContext.Error($"Process completed with exit code {exitCode} erroring in {GetFileName(Data.FileID)}");
|
||||||
|
ExecutionContext.Error($"Process completed with exit code {exitCode}");
|
||||||
ExecutionContext.Result = TaskResult.Failed;
|
ExecutionContext.Result = TaskResult.Failed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,9 +137,11 @@ namespace GitHub.DistributedTask.ObjectTemplating
|
|||||||
Int32? fileId,
|
Int32? fileId,
|
||||||
Int32? line,
|
Int32? line,
|
||||||
Int32? column,
|
Int32? column,
|
||||||
Exception ex)
|
Exception ex,
|
||||||
|
String fileName = default(string))
|
||||||
{
|
{
|
||||||
var prefix = GetErrorPrefix(fileId, line, column);
|
TraceWriter.Info($"Error fileId: {fileId}");
|
||||||
|
var prefix = GetErrorPrefix(fileId, line, column, fileName: fileName);
|
||||||
Errors.Add(prefix, ex);
|
Errors.Add(prefix, ex);
|
||||||
TraceWriter.Error(prefix, ex);
|
TraceWriter.Error(prefix, ex);
|
||||||
}
|
}
|
||||||
@@ -203,9 +205,16 @@ namespace GitHub.DistributedTask.ObjectTemplating
|
|||||||
private String GetErrorPrefix(
|
private String GetErrorPrefix(
|
||||||
Int32? fileId,
|
Int32? fileId,
|
||||||
Int32? line,
|
Int32? line,
|
||||||
Int32? column)
|
Int32? column,
|
||||||
|
string fileName = default(string))
|
||||||
{
|
{
|
||||||
var fileName = fileId.HasValue ? GetFileName(fileId.Value) : null;
|
TraceWriter.Info($"GetErrorPrefix FileID: {fileId}");
|
||||||
|
|
||||||
|
// if (String.IsNullOrEmpty(fileName)) {
|
||||||
|
// fileName = fileId.HasValue ? GetFileName(fileId.Value) : null;
|
||||||
|
// }
|
||||||
|
// var fileName = fileId.HasValue ? GetFileName(fileId.Value) : null;
|
||||||
|
fileName = "TESTING";
|
||||||
if (!String.IsNullOrEmpty(fileName))
|
if (!String.IsNullOrEmpty(fileName))
|
||||||
{
|
{
|
||||||
if (line != null && column != null)
|
if (line != null && column != null)
|
||||||
|
|||||||
@@ -28,10 +28,11 @@ namespace GitHub.DistributedTask.ObjectTemplating
|
|||||||
TemplateToken template,
|
TemplateToken template,
|
||||||
Int32 removeBytes,
|
Int32 removeBytes,
|
||||||
Int32? fileId,
|
Int32? fileId,
|
||||||
Boolean omitHeader = false)
|
Boolean omitHeader = false,
|
||||||
|
String fileName = default(string))
|
||||||
{
|
{
|
||||||
TemplateToken result;
|
TemplateToken result;
|
||||||
|
context.TraceWriter.Info("I'm in Evaluate!");
|
||||||
if (!omitHeader)
|
if (!omitHeader)
|
||||||
{
|
{
|
||||||
if (fileId != null)
|
if (fileId != null)
|
||||||
@@ -67,7 +68,7 @@ namespace GitHub.DistributedTask.ObjectTemplating
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
context.Error(fileId, null, null, ex);
|
context.Error(fileId, null, null, ex, fileName: fileName);
|
||||||
result = null;
|
result = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -159,19 +159,33 @@ namespace GitHub.DistributedTask.Pipelines.ObjectTemplating
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public List<ActionStep> LoadCompositeSteps(
|
||||||
|
// TemplateToken token,
|
||||||
|
// IReadOnlyList<String> fileTable,
|
||||||
|
// Int32 fileID)
|
||||||
|
// {
|
||||||
public List<ActionStep> LoadCompositeSteps(
|
public List<ActionStep> LoadCompositeSteps(
|
||||||
TemplateToken token,
|
TemplateToken token,
|
||||||
Int32 fileID
|
String fileName)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
|
// HOW DO WE LOG INFORMATION IN THIS FILE??????
|
||||||
var result = default(List<ActionStep>);
|
var result = default(List<ActionStep>);
|
||||||
if (token != null && token.Type != TokenType.Null)
|
if (token != null && token.Type != TokenType.Null)
|
||||||
{
|
{
|
||||||
|
// Create New Context Object
|
||||||
var context = CreateContext(null, null, setMissingContext: false);
|
var context = CreateContext(null, null, setMissingContext: false);
|
||||||
|
|
||||||
|
// Pass original filetable to the context:
|
||||||
|
// foreach (var f in fileTable) {
|
||||||
|
// context.GetFileId(f);
|
||||||
|
// }
|
||||||
|
|
||||||
// TODO: we might want to to have a bool to prevent it from filling in with missing context w/ dummy variables
|
// TODO: we might want to to have a bool to prevent it from filling in with missing context w/ dummy variables
|
||||||
|
|
||||||
|
// TODO: context does not have the fileTable associated with it!!!
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
token = TemplateEvaluator.Evaluate(context, PipelineTemplateConstants.StepsInTemplate, token, 0, fileID, omitHeader: true);
|
token = TemplateEvaluator.Evaluate(context, PipelineTemplateConstants.StepsInTemplate, token, 0, null, omitHeader: false, fileName: fileName);
|
||||||
context.Errors.Check();
|
context.Errors.Check();
|
||||||
result = PipelineTemplateConverter.ConvertToSteps(context, token);
|
result = PipelineTemplateConverter.ConvertToSteps(context, token);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user