mirror of
https://github.com/actions/runner.git
synced 2025-12-10 12:36:23 +00:00
Composite Actions UI (#578)
* Composite Action Run Steps
* Env Flow => Able to get env variables and overwrite current env variables => but it doesn't 'stick'
* clean up
* Clean up trace messages + add Trace debug in ActionManager
* Add debugging message
* Optimize runtime of code
* Change String to string
* Add comma to Composite
* Change JobSteps to a List, Change Register Step function name
* Add TODO, remove unn. content
* Remove unnecessary code
* Fix unit tests
* Fix env format
* Remove comment
* Remove TODO message for context
* Add verbose trace logs which are only viewable by devs
* Initial Start for FileTable stuff
* Progress towards passing FileTable or FileID or FileName
* Sort usings in Composite Action Handler
* Change 0 to location
* Update context variables in composite action yaml
* Add helpful error message for null steps
* Pass fileID to all children token of root action token
* Change confusing term context => templateContext, Eliminate _fileTable and only use ExecutionContext.FileTable + update this table when need be
* Remove unnessary FileID attribute from CompositeActionExecutionData
* Clean up file path for error message
* Remove todo
* Initial start/framework for output handling
* Outline different class vs Handler approach
* Remove InitializeScope
* Remove InitializeScope
* Fix Workflow Step Env overiding Parent Env
* First Approach for Attaching ID + Group ID to each Composite Action Step
* Add GroupID to the ActionDefinitionData
* starting foundation for handling clean up outputs step
* Pass outputs data to each composite action step to enable set-output functionality
* Create ScopeName for whole composite action.
This will enable us to add to the StepsContext[ScopeName] for the composite action which will allow us to use all these outputs in the cleanup step
* Hook up composite output step to handler => tmmrw implement composite output handler
* Add post composite action step to cleanup outputs => triggers composite output cleanup handler
* Fix Outputs Token handling start. Add individual step scope names.
* Set up Scope Name and Context Name naming system{
* Figured out how to pass Parent Execution Context to clean up step
* Figured out how to pass Parent Execution Context and scope names to
clean up step
* Add GetOutput function for StepsContext
* Generate child scope name correctly if parent scope name is null
* Simplify InitializeScope()
* Outputs are set correctly and able to get all final outputs in handler
* Parse through Action Outputs
* Fix null ScopeName + ContextName in CompositeOutputHandler
* Shift over handling of Action Outputs to output handler
* First attempt to fix null retrievals for output variables
* Basic Support for Outputs Done.
* Clean up pt.1
* Refactor outputs to avoid using Action Reference
* Clean up code
* Clean up part 2
* Add clarifying comments for the output handler
* Remove TODO
* Remove env in composite action scope
* Clean up
* Revert back
* revert back
* add back envToken
* Remove unnecessary code
* Add file length check
* Clean up
* Fix logging issue
* Figure out how to handle set-env edge cases
* formatting
* fix unit tests
* Fix windows unit test syntax error
* Fix period
* Sanity check for fileTable add + remove unn. code
* revert back
* Add back line break
* Fix null errors
* Address situation if FileTable is null + add sanity check for adding file to fileTable
* add line
* Revert
* Fix unit tests to instantiate a FileTable
* Fix logic for trimming manifestfile path
* Add null check
* Revert
* Revert
* revert
* spacing
* Add filetable to testing file, remove ? since we know filetable should never be non null
* Fix Throw logic
* Clarify template outputs token
* Add another type support for outputs to avoid container unit tests errors
* Add mapping for parity
* Build support for new outputs format
* Build support for new outputs format
* Refactor to avoid duplication of action yaml for workflow yaml
* revert
* revert
* revert
* spacing
This commit is contained in:
@@ -75,7 +75,7 @@ namespace GitHub.Runner.Worker
|
|||||||
// Initialize
|
// Initialize
|
||||||
void InitializeJob(Pipelines.AgentJobRequestMessage message, CancellationToken token);
|
void InitializeJob(Pipelines.AgentJobRequestMessage message, CancellationToken token);
|
||||||
void CancelToken();
|
void CancelToken();
|
||||||
IExecutionContext CreateChild(Guid recordId, string displayName, string refName, string scopeName, string contextName, Dictionary<string, string> intraActionState = null, int? recordOrder = null);
|
IExecutionContext CreateChild(Guid recordId, string displayName, string refName, string scopeName, string contextName, Dictionary<string, string> intraActionState = null, int? recordOrder = null, IPagingLogger logger = null);
|
||||||
|
|
||||||
// logging
|
// logging
|
||||||
bool WriteDebug { get; }
|
bool WriteDebug { get; }
|
||||||
@@ -283,12 +283,9 @@ namespace GitHub.Runner.Worker
|
|||||||
Dictionary<string, string> envData,
|
Dictionary<string, string> envData,
|
||||||
bool cleanUp = false)
|
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:
|
// 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:
|
||||||
// "__<GUID>"
|
// "__<GUID>"
|
||||||
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
|
// 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
|
// 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()}";
|
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;
|
step.ExecutionContext.ExpressionValues["inputs"] = inputsData;
|
||||||
|
|
||||||
// Set Parent Attribute for Clean Up Step
|
// Set Parent Attribute for Clean Up Step
|
||||||
@@ -322,7 +320,7 @@ namespace GitHub.Runner.Worker
|
|||||||
return step;
|
return step;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IExecutionContext CreateChild(Guid recordId, string displayName, string refName, string scopeName, string contextName, Dictionary<string, string> intraActionState = null, int? recordOrder = null)
|
public IExecutionContext CreateChild(Guid recordId, string displayName, string refName, string scopeName, string contextName, Dictionary<string, string> intraActionState = null, int? recordOrder = null, IPagingLogger logger = null)
|
||||||
{
|
{
|
||||||
Trace.Entering();
|
Trace.Entering();
|
||||||
|
|
||||||
@@ -370,9 +368,15 @@ namespace GitHub.Runner.Worker
|
|||||||
{
|
{
|
||||||
child.InitializeTimelineRecord(_mainTimelineId, recordId, _record.Id, ExecutionContextType.Task, displayName, refName, ++_childTimelineRecordOrder);
|
child.InitializeTimelineRecord(_mainTimelineId, recordId, _record.Id, ExecutionContextType.Task, displayName, refName, ++_childTimelineRecordOrder);
|
||||||
}
|
}
|
||||||
|
if (logger != null)
|
||||||
child._logger = HostContext.CreateService<IPagingLogger>();
|
{
|
||||||
child._logger.Setup(_mainTimelineId, recordId);
|
child._logger = logger;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
child._logger = HostContext.CreateService<IPagingLogger>();
|
||||||
|
child._logger.Setup(_mainTimelineId, recordId);
|
||||||
|
}
|
||||||
|
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ namespace GitHub.Runner.Worker.Handlers
|
|||||||
actionRunner.Action = aStep;
|
actionRunner.Action = aStep;
|
||||||
actionRunner.Stage = stage;
|
actionRunner.Stage = stage;
|
||||||
actionRunner.Condition = aStep.Condition;
|
actionRunner.Condition = aStep.Condition;
|
||||||
actionRunner.DisplayName = aStep.DisplayName;
|
|
||||||
|
|
||||||
var step = ExecutionContext.RegisterNestedStep(actionRunner, inputsData, location, Environment);
|
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
|
// Create a step that handles all the composite action steps' outputs
|
||||||
Pipelines.ActionStep cleanOutputsStep = new Pipelines.ActionStep();
|
Pipelines.ActionStep cleanOutputsStep = new Pipelines.ActionStep();
|
||||||
cleanOutputsStep.ContextName = ExecutionContext.ContextName;
|
cleanOutputsStep.ContextName = ExecutionContext.ContextName;
|
||||||
cleanOutputsStep.DisplayName = "Composite Action Steps Cleanup";
|
|
||||||
// Use the same reference type as our composite steps.
|
// Use the same reference type as our composite steps.
|
||||||
cleanOutputsStep.Reference = Action;
|
cleanOutputsStep.Reference = Action;
|
||||||
|
|
||||||
@@ -104,7 +102,6 @@ namespace GitHub.Runner.Worker.Handlers
|
|||||||
actionRunner2.Action = cleanOutputsStep;
|
actionRunner2.Action = cleanOutputsStep;
|
||||||
actionRunner2.Stage = ActionRunStage.Main;
|
actionRunner2.Stage = ActionRunStage.Main;
|
||||||
actionRunner2.Condition = "always()";
|
actionRunner2.Condition = "always()";
|
||||||
actionRunner2.DisplayName = "Composite Action Steps Cleanup";
|
|
||||||
ExecutionContext.RegisterNestedStep(actionRunner2, inputsData, location, Environment, true);
|
ExecutionContext.RegisterNestedStep(actionRunner2, inputsData, location, Environment, true);
|
||||||
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
|
|||||||
Reference in New Issue
Block a user