diff --git a/src/Runner.Worker/ActionManifestManager.cs b/src/Runner.Worker/ActionManifestManager.cs index 255b0ac9c..72aa1271b 100644 --- a/src/Runner.Worker/ActionManifestManager.cs +++ b/src/Runner.Worker/ActionManifestManager.cs @@ -70,7 +70,8 @@ namespace GitHub.Runner.Worker var fileContent = File.ReadAllText(manifestFile); using (var stringReader = new StringReader(fileContent)) { - var yamlObjectReader = new YamlObjectReader(null, stringReader); + // Does setting fileID will help for token to return correct fileerror. + var yamlObjectReader = new YamlObjectReader(fileId, stringReader); token = TemplateReader.Read(context, "action-root", yamlObjectReader, fileId, out _); } @@ -418,15 +419,9 @@ namespace GitHub.Runner.Worker case "steps": 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 evaluator = executionContext.ToPipelineTemplateEvaluator(); - // stepsLoaded = evaluator.LoadCompositeSteps(steps, context.GetFileTable(), fileID); - string fileName = context.GetFileName(fileID); - stepsLoaded = evaluator.LoadCompositeSteps(steps, fileName); + stepsLoaded = evaluator.LoadCompositeSteps(steps, context.GetFileTable()); break; } throw new Exception("You aren't supposed to be using Composite Actions yet!"); diff --git a/src/Runner.Worker/Handlers/CompositeActionHandler.cs b/src/Runner.Worker/Handlers/CompositeActionHandler.cs index 05cc18c48..0634ac20c 100644 --- a/src/Runner.Worker/Handlers/CompositeActionHandler.cs +++ b/src/Runner.Worker/Handlers/CompositeActionHandler.cs @@ -1,15 +1,16 @@ +using System; +using System.Collections.Generic; using System.IO; +using System.Linq; using System.Text; using System.Threading.Tasks; +using GitHub.DistributedTask.ObjectTemplating.Tokens; +using GitHub.DistributedTask.Pipelines.ContextData; +using GitHub.DistributedTask.WebApi; using GitHub.Runner.Common; using GitHub.Runner.Sdk; -using GitHub.DistributedTask.WebApi; using Pipelines = GitHub.DistributedTask.Pipelines; -using System; -using System.Linq; -using GitHub.DistributedTask.ObjectTemplating.Tokens; -using System.Collections.Generic; -using GitHub.DistributedTask.Pipelines.ContextData; + namespace GitHub.Runner.Worker.Handlers { diff --git a/src/Sdk/DTObjectTemplating/ObjectTemplating/TemplateContext.cs b/src/Sdk/DTObjectTemplating/ObjectTemplating/TemplateContext.cs index 5ca06c5f5..af8cf76ec 100644 --- a/src/Sdk/DTObjectTemplating/ObjectTemplating/TemplateContext.cs +++ b/src/Sdk/DTObjectTemplating/ObjectTemplating/TemplateContext.cs @@ -137,11 +137,9 @@ namespace GitHub.DistributedTask.ObjectTemplating Int32? fileId, Int32? line, Int32? column, - Exception ex, - String fileName = default(string)) + Exception ex) { - TraceWriter.Info($"Error fileId: {fileId}"); - var prefix = GetErrorPrefix(fileId, line, column, fileName: fileName); + var prefix = GetErrorPrefix(fileId, line, column); Errors.Add(prefix, ex); TraceWriter.Error(prefix, ex); } @@ -205,16 +203,9 @@ namespace GitHub.DistributedTask.ObjectTemplating private String GetErrorPrefix( Int32? fileId, Int32? line, - Int32? column, - string fileName = default(string)) + Int32? column) { - 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"; + var fileName = fileId.HasValue ? GetFileName(fileId.Value) : null; if (!String.IsNullOrEmpty(fileName)) { if (line != null && column != null) diff --git a/src/Sdk/DTObjectTemplating/ObjectTemplating/TemplateEvaluator.cs b/src/Sdk/DTObjectTemplating/ObjectTemplating/TemplateEvaluator.cs index a27636d0c..1168968aa 100644 --- a/src/Sdk/DTObjectTemplating/ObjectTemplating/TemplateEvaluator.cs +++ b/src/Sdk/DTObjectTemplating/ObjectTemplating/TemplateEvaluator.cs @@ -28,11 +28,9 @@ namespace GitHub.DistributedTask.ObjectTemplating TemplateToken template, Int32 removeBytes, Int32? fileId, - Boolean omitHeader = false, - String fileName = default(string)) + Boolean omitHeader = false) { TemplateToken result; - context.TraceWriter.Info("I'm in Evaluate!"); if (!omitHeader) { if (fileId != null) @@ -68,7 +66,7 @@ namespace GitHub.DistributedTask.ObjectTemplating } catch (Exception ex) { - context.Error(fileId, null, null, ex, fileName: fileName); + context.Error(fileId, null, null, ex); result = null; } diff --git a/src/Sdk/DTPipelines/Pipelines/ObjectTemplating/PipelineTemplateEvaluator.cs b/src/Sdk/DTPipelines/Pipelines/ObjectTemplating/PipelineTemplateEvaluator.cs index 8f15e7364..90d94430e 100644 --- a/src/Sdk/DTPipelines/Pipelines/ObjectTemplating/PipelineTemplateEvaluator.cs +++ b/src/Sdk/DTPipelines/Pipelines/ObjectTemplating/PipelineTemplateEvaluator.cs @@ -159,33 +159,24 @@ namespace GitHub.DistributedTask.Pipelines.ObjectTemplating return result; } - // public List LoadCompositeSteps( - // TemplateToken token, - // IReadOnlyList fileTable, - // Int32 fileID) - // { public List LoadCompositeSteps( TemplateToken token, - String fileName) + IReadOnlyList fileTable) { - // HOW DO WE LOG INFORMATION IN THIS FILE?????? var result = default(List); if (token != null && token.Type != TokenType.Null) { // Create New Context Object var context = CreateContext(null, null, setMissingContext: false); - // Pass original filetable to the context: - // foreach (var f in fileTable) { - // context.GetFileId(f); - // } + // Pass original filetable to the new 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: context does not have the fileTable associated with it!!! try { - token = TemplateEvaluator.Evaluate(context, PipelineTemplateConstants.StepsInTemplate, token, 0, null, omitHeader: false, fileName: fileName); + token = TemplateEvaluator.Evaluate(context, PipelineTemplateConstants.StepsInTemplate, token, 0, null, omitHeader: false); context.Errors.Check(); result = PipelineTemplateConverter.ConvertToSteps(context, token); }