diff --git a/src/Runner.Worker/ExecutionContext.cs b/src/Runner.Worker/ExecutionContext.cs index 23b26aee1..b31dc97e4 100644 --- a/src/Runner.Worker/ExecutionContext.cs +++ b/src/Runner.Worker/ExecutionContext.cs @@ -75,7 +75,7 @@ namespace GitHub.Runner.Worker // Initialize void InitializeJob(Pipelines.AgentJobRequestMessage message, CancellationToken token); void CancelToken(); - IExecutionContext CreateChild(Guid recordId, string displayName, string refName, string scopeName, string contextName, Dictionary intraActionState = null, int? recordOrder = null); + IExecutionContext CreateChild(Guid recordId, string displayName, string refName, string scopeName, string contextName, Dictionary intraActionState = null, int? recordOrder = null, IPagingLogger logger = null); // logging bool WriteDebug { get; } @@ -283,12 +283,9 @@ namespace GitHub.Runner.Worker Dictionary envData, bool cleanUp = false) { - // 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(); - // If the context name is empty and the scope name is empty, we would generate a unique scope name for this child in the following format: // "__" - var safeContextName = !string.IsNullOrEmpty(ContextName) ? ContextName : $"__{newGuid}"; + var safeContextName = !string.IsNullOrEmpty(ContextName) ? ContextName : $"__{Guid.NewGuid()}"; // Set Scope Name. Note, for our design, we consider each step in a composite action to have the same scope // This makes it much simpler to handle their outputs at the end of the Composite Action @@ -296,7 +293,8 @@ namespace GitHub.Runner.Worker var childContextName = !string.IsNullOrEmpty(step.Action.ContextName) ? step.Action.ContextName : $"__{Guid.NewGuid()}"; - step.ExecutionContext = Root.CreateChild(newGuid, step.DisplayName, newGuid.ToString("N"), childScopeName, childContextName); + step.ExecutionContext = Root.CreateChild(_record.Id, step.DisplayName, _record.Id.ToString("N"), childScopeName, childContextName, logger: _logger); + step.ExecutionContext.ExpressionValues["inputs"] = inputsData; // Set Parent Attribute for Clean Up Step @@ -322,7 +320,7 @@ namespace GitHub.Runner.Worker return step; } - public IExecutionContext CreateChild(Guid recordId, string displayName, string refName, string scopeName, string contextName, Dictionary intraActionState = null, int? recordOrder = null) + public IExecutionContext CreateChild(Guid recordId, string displayName, string refName, string scopeName, string contextName, Dictionary intraActionState = null, int? recordOrder = null, IPagingLogger logger = null) { Trace.Entering(); @@ -370,9 +368,15 @@ namespace GitHub.Runner.Worker { child.InitializeTimelineRecord(_mainTimelineId, recordId, _record.Id, ExecutionContextType.Task, displayName, refName, ++_childTimelineRecordOrder); } - - child._logger = HostContext.CreateService(); - child._logger.Setup(_mainTimelineId, recordId); + if (logger != null) + { + child._logger = logger; + } + else + { + child._logger = HostContext.CreateService(); + child._logger.Setup(_mainTimelineId, recordId); + } return child; } diff --git a/src/Runner.Worker/Handlers/CompositeActionHandler.cs b/src/Runner.Worker/Handlers/CompositeActionHandler.cs index 4b6ebdd3b..d48f922d1 100644 --- a/src/Runner.Worker/Handlers/CompositeActionHandler.cs +++ b/src/Runner.Worker/Handlers/CompositeActionHandler.cs @@ -84,7 +84,6 @@ namespace GitHub.Runner.Worker.Handlers actionRunner.Action = aStep; actionRunner.Stage = stage; actionRunner.Condition = aStep.Condition; - actionRunner.DisplayName = aStep.DisplayName; var step = ExecutionContext.RegisterNestedStep(actionRunner, inputsData, location, Environment); @@ -96,7 +95,6 @@ namespace GitHub.Runner.Worker.Handlers // Create a step that handles all the composite action steps' outputs Pipelines.ActionStep cleanOutputsStep = new Pipelines.ActionStep(); cleanOutputsStep.ContextName = ExecutionContext.ContextName; - cleanOutputsStep.DisplayName = "Composite Action Steps Cleanup"; // Use the same reference type as our composite steps. cleanOutputsStep.Reference = Action; @@ -104,7 +102,6 @@ namespace GitHub.Runner.Worker.Handlers actionRunner2.Action = cleanOutputsStep; actionRunner2.Stage = ActionRunStage.Main; actionRunner2.Condition = "always()"; - actionRunner2.DisplayName = "Composite Action Steps Cleanup"; ExecutionContext.RegisterNestedStep(actionRunner2, inputsData, location, Environment, true); return Task.CompletedTask;