mirror of
https://github.com/actions/runner.git
synced 2025-12-12 23:46:12 +00:00
Pass fileID to all children token of root action token
This commit is contained in:
@@ -70,7 +70,8 @@ namespace GitHub.Runner.Worker
|
|||||||
var fileContent = File.ReadAllText(manifestFile);
|
var fileContent = File.ReadAllText(manifestFile);
|
||||||
using (var stringReader = new StringReader(fileContent))
|
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 _);
|
token = TemplateReader.Read(context, "action-root", yamlObjectReader, fileId, out _);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -418,15 +419,9 @@ 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, context.GetFileTable(), fileID);
|
stepsLoaded = evaluator.LoadCompositeSteps(steps, context.GetFileTable());
|
||||||
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!");
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
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.Common;
|
||||||
using GitHub.Runner.Sdk;
|
using GitHub.Runner.Sdk;
|
||||||
using GitHub.DistributedTask.WebApi;
|
|
||||||
using Pipelines = GitHub.DistributedTask.Pipelines;
|
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
|
namespace GitHub.Runner.Worker.Handlers
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -137,11 +137,9 @@ namespace GitHub.DistributedTask.ObjectTemplating
|
|||||||
Int32? fileId,
|
Int32? fileId,
|
||||||
Int32? line,
|
Int32? line,
|
||||||
Int32? column,
|
Int32? column,
|
||||||
Exception ex,
|
Exception ex)
|
||||||
String fileName = default(string))
|
|
||||||
{
|
{
|
||||||
TraceWriter.Info($"Error fileId: {fileId}");
|
var prefix = GetErrorPrefix(fileId, line, column);
|
||||||
var prefix = GetErrorPrefix(fileId, line, column, fileName: fileName);
|
|
||||||
Errors.Add(prefix, ex);
|
Errors.Add(prefix, ex);
|
||||||
TraceWriter.Error(prefix, ex);
|
TraceWriter.Error(prefix, ex);
|
||||||
}
|
}
|
||||||
@@ -205,16 +203,9 @@ 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))
|
|
||||||
{
|
{
|
||||||
TraceWriter.Info($"GetErrorPrefix FileID: {fileId}");
|
var fileName = fileId.HasValue ? GetFileName(fileId.Value) : null;
|
||||||
|
|
||||||
// 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,11 +28,9 @@ 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)
|
||||||
@@ -68,7 +66,7 @@ namespace GitHub.DistributedTask.ObjectTemplating
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
context.Error(fileId, null, null, ex, fileName: fileName);
|
context.Error(fileId, null, null, ex);
|
||||||
result = null;
|
result = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -159,33 +159,24 @@ 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,
|
||||||
String fileName)
|
IReadOnlyList<String> fileTable)
|
||||||
{
|
{
|
||||||
// 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
|
// Create New Context Object
|
||||||
var context = CreateContext(null, null, setMissingContext: false);
|
var context = CreateContext(null, null, setMissingContext: false);
|
||||||
|
|
||||||
// Pass original filetable to the context:
|
// Pass original filetable to the new context:
|
||||||
// foreach (var f in fileTable) {
|
foreach (var f in fileTable) {
|
||||||
// context.GetFileId(f);
|
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
|
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();
|
context.Errors.Check();
|
||||||
result = PipelineTemplateConverter.ConvertToSteps(context, token);
|
result = PipelineTemplateConverter.ConvertToSteps(context, token);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user