-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Composite Run Steps Outputs #568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
116 commits
Select commit
Hold shift + click to select a range
038e5e2
Composite Action Run Steps
ethanchewy e56b243
Env Flow => Able to get env variables and overwrite current env varia…
ethanchewy 6552263
clean up
ethanchewy 180a687
Clean up trace messages + add Trace debug in ActionManager
ethanchewy 66cadeb
Merge branch 'users/ethanchewy/compositetest2' of https://github.com/…
ethanchewy 96e0037
Add debugging message
ethanchewy 496064f
Optimize runtime of code
ethanchewy 5843362
Change String to string
ethanchewy 941a24e
Add comma to Composite
ethanchewy 28be3df
Merge branch 'users/ethanchewy/compositetest2' of https://github.com/…
ethanchewy 9939cf5
Change JobSteps to a List, Change Register Step function name
ethanchewy 5988076
Add TODO, remove unn. content
ethanchewy 00a736d
Remove unnecessary code
ethanchewy e4dfd0e
Fix unit tests
ethanchewy f8054f9
Add/Merge changes from Multiple Steps PR
ethanchewy 45ddd42
Fix env format
ethanchewy 37849dc
Remove comment
ethanchewy 94e7b47
Remove TODO message for context
ethanchewy a254442
Add verbose trace logs which are only viewable by devs
ethanchewy fbef557
Merge branch 'users/ethanchewy/compositetest2' of https://github.com/…
ethanchewy 43a3006
Initial Start for FileTable stuff
ethanchewy 58d11ef
Progress towards passing FileTable or FileID or FileName
ethanchewy 0d5e84b
Sort usings in Composite Action Handler
ethanchewy 9ec7047
Change 0 to location
ethanchewy 8aadbbd
Update context variables in composite action yaml
ethanchewy f9b28c7
Add helpful error message for null steps
ethanchewy da2da85
Pass fileID to all children token of root action token
ethanchewy ba4ce9c
Change confusing term context => templateContext, Eliminate _fileTabl…
ethanchewy 9c60f1a
Merge branch 'users/ethanchewy/compositetest2' of https://github.com/…
ethanchewy 368b625
Remove unnessary FileID attribute from CompositeActionExecutionData
ethanchewy 0a6453e
Clean up file path for error message
ethanchewy 54ed6ea
Remove todo
ethanchewy 1f6518d
Merge branch 'users/ethanchewy/compositetest2' of https://github.com/…
ethanchewy 9464607
Initial start/framework for output handling
ethanchewy de37aad
Outline different class vs Handler approach
ethanchewy 26f17d9
Remove InitializeScope
ethanchewy f73507c
Remove InitializeScope
ethanchewy 25b798b
Merge branch 'users/ethanchewy/compositeOutputsStep' of https://githu…
ethanchewy 57d59fc
Fix Workflow Step Env overiding Parent Env
ethanchewy 0bd97d6
Merge branch 'users/ethanchewy/compositeenv' of https://github.com/ac…
ethanchewy 7ca2caf
Merge branch 'users/ethanchewy/compositeFileTable' of https://github.…
ethanchewy e38339f
First Approach for Attaching ID + Group ID to each Composite Action Step
ethanchewy 1151e61
Add GroupID to the ActionDefinitionData
ethanchewy 4371a45
starting foundation for handling clean up outputs step
ethanchewy f1d8655
Pass outputs data to each composite action step to enable set-output …
ethanchewy a8ba61a
Create ScopeName for whole composite action.
ethanchewy d87f515
Hook up composite output step to handler => tmmrw implement composite…
ethanchewy 452bec9
Add post composite action step to cleanup outputs => triggers composi…
ethanchewy 9e1f0e9
Fix Outputs Token handling start. Add individual step scope names.
ethanchewy 13911b5
Set up Scope Name and Context Name naming system{
ethanchewy 717e25a
Figured out how to pass Parent Execution Context to clean up step
ethanchewy d8ba084
Figured out how to pass Parent Execution Context and scope names to
ethanchewy 63b60bd
Merge branch 'users/ethanchewy/compositeOutputsStep' of https://githu…
ethanchewy 84389e1
Add GetOutput function for StepsContext
ethanchewy 196d30a
Generate child scope name correctly if parent scope name is null
ethanchewy d016c62
Simplify InitializeScope()
ethanchewy ef42239
Outputs are set correctly and able to get all final outputs in handler
ethanchewy c92fd34
Parse through Action Outputs
ethanchewy 69a8600
Fix null ScopeName + ContextName in CompositeOutputHandler
ethanchewy 60ff826
Shift over handling of Action Outputs to output handler
ethanchewy e67cc57
First attempt to fix null retrievals for output variables
ethanchewy d607f51
Basic Support for Outputs Done.
ethanchewy 43da602
Clean up pt.1
ethanchewy a277d81
Refactor outputs to avoid using Action Reference
ethanchewy c1ea7af
Clean up code
ethanchewy 08d873a
Clean up part 2
ethanchewy 9f30200
Add clarifying comments for the output handler
ethanchewy b94f8e7
Remove TODO
ethanchewy b63f987
Remove env in composite action scope
ethanchewy da1e2b0
Clean up
ethanchewy 5d61145
Revert back
ethanchewy 4ccac8c
revert back
ethanchewy 0041023
add back envToken
ethanchewy 4b3ec9f
Remove unnecessary code
ethanchewy 191a096
Merge branch 'users/ethanchewy/compositeenv' of https://github.com/ac…
ethanchewy 20bc6a9
Add file length check
ethanchewy 14a2cbd
Clean up
ethanchewy d1814f2
Merge branch 'users/ethanchewy/compositeFileTable' of https://github.…
ethanchewy 96bff6a
Figure out how to handle set-env edge cases
ethanchewy 11b9cac
formatting
ethanchewy b712ba2
Merge branch 'master' into users/ethanchewy/compositeenv
ethanchewy a58ac2e
fix unit tests
ethanchewy 5178468
Merge branch 'users/ethanchewy/compositeenv' of https://github.com/ac…
ethanchewy 881e8e7
Fix windows unit test syntax error
ethanchewy b6526db
Merge branch 'users/ethanchewy/compositeenv' of https://github.com/ac…
ethanchewy 3836574
Fix period
ethanchewy 9a1dd80
Sanity check for fileTable add + remove unn. code
ethanchewy d2d0ecf
revert back
ethanchewy 41a8c8c
Add back line break
ethanchewy 7c57d41
Merge branch 'master' of https://github.com/actions/runner into users…
ethanchewy 35879fc
Fix null errors
ethanchewy 8828263
Address situation if FileTable is null + add sanity check for adding …
ethanchewy 6d7efa9
add line
ethanchewy 9a2b3e2
Revert
ethanchewy b3eea21
Fix unit tests to instantiate a FileTable
ethanchewy af9202b
Fix logic for trimming manifestfile path
ethanchewy 635baa5
Add null check
ethanchewy 6122303
Merge branch 'users/ethanchewy/compositeFileTable' of https://github.…
ethanchewy dd1ee45
Revert
ethanchewy 7d8c3a7
Revert
ethanchewy 71c064d
revert
ethanchewy 5bc2334
spacing
ethanchewy 68b05f6
Add filetable to testing file, remove ? since we know filetable shoul…
ethanchewy bcba214
Merge branch 'users/ethanchewy/compositeFileTable' of https://github.…
ethanchewy 3536aba
Merge branch 'master' into users/ethanchewy/compositeOutputsStep
ethanchewy d01e74d
Fix Throw logic
ethanchewy 4a0cb61
Clarify template outputs token
ethanchewy 308c064
Add another type support for outputs to avoid container unit tests er…
ethanchewy c3c71e9
Add mapping for parity
ethanchewy cea3756
Build support for new outputs format
ethanchewy 90d5cb9
Refactor to avoid duplication of action yaml for workflow yaml
ethanchewy 6b51394
Move SDK work in ActionManifestManager, Condense Code
ethanchewy 1b4c399
Defer runs evaluation till after for loop to ensure order doesn't matter
ethanchewy 53ef29e
Fix logic error in setting scope and context names
ethanchewy 618ff0f
Add Regex + Add Child Context name null resolution
ethanchewy 732e274
move private function to bottom of class
ethanchewy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |
| using System.IO; | ||
| using System.Linq; | ||
| using System.Text; | ||
| using System.Text.RegularExpressions; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
| using System.Web; | ||
|
|
@@ -52,7 +53,6 @@ public interface IExecutionContext : IRunnerService | |
| IDictionary<String, IDictionary<String, String>> JobDefaults { get; } | ||
| Dictionary<string, VariableValue> JobOutputs { get; } | ||
| IDictionary<String, String> EnvironmentVariables { get; } | ||
| IDictionary<String, ContextScope> Scopes { get; } | ||
| IList<String> FileTable { get; } | ||
| StepsContext StepsContext { get; } | ||
| DictionaryContextData ExpressionValues { get; } | ||
|
|
@@ -70,6 +70,8 @@ public interface IExecutionContext : IRunnerService | |
|
|
||
| bool EchoOnActionCommand { get; set; } | ||
|
|
||
| IExecutionContext FinalizeContext { get; set; } | ||
|
|
||
| // Initialize | ||
| void InitializeJob(Pipelines.AgentJobRequestMessage message, CancellationToken token); | ||
| void CancelToken(); | ||
|
|
@@ -105,7 +107,7 @@ public interface IExecutionContext : IRunnerService | |
| // others | ||
| void ForceTaskComplete(); | ||
| void RegisterPostJobStep(IStep step); | ||
| void RegisterNestedStep(IStep step, DictionaryContextData inputsData, int location, Dictionary<string, string> envData); | ||
| IStep RegisterNestedStep(IActionRunner step, DictionaryContextData inputsData, int location, Dictionary<string, string> envData, bool cleanUp = false); | ||
| } | ||
|
|
||
| public sealed class ExecutionContext : RunnerService, IExecutionContext | ||
|
|
@@ -120,6 +122,9 @@ public sealed class ExecutionContext : RunnerService, IExecutionContext | |
|
|
||
| private event OnMatcherChanged _onMatcherChanged; | ||
|
|
||
| // Regex used for checking if ScopeName meets the condition that shows that its id is null. | ||
| private readonly static Regex _generatedContextNamePattern = new Regex("^__[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); | ||
|
|
||
| private IssueMatcherConfig[] _matchers; | ||
|
|
||
| private IPagingLogger _logger; | ||
|
|
@@ -149,7 +154,6 @@ public sealed class ExecutionContext : RunnerService, IExecutionContext | |
| public IDictionary<String, IDictionary<String, String>> JobDefaults { get; private set; } | ||
| public Dictionary<string, VariableValue> JobOutputs { get; private set; } | ||
| public IDictionary<String, String> EnvironmentVariables { get; private set; } | ||
| public IDictionary<String, ContextScope> Scopes { get; private set; } | ||
| public IList<String> FileTable { get; private set; } | ||
| public StepsContext StepsContext { get; private set; } | ||
| public DictionaryContextData ExpressionValues { get; } = new DictionaryContextData(); | ||
|
|
@@ -170,6 +174,8 @@ public sealed class ExecutionContext : RunnerService, IExecutionContext | |
|
|
||
| public bool EchoOnActionCommand { get; set; } | ||
|
|
||
| public IExecutionContext FinalizeContext { get; set; } | ||
|
|
||
| public TaskResult? Result | ||
| { | ||
| get | ||
|
|
@@ -270,17 +276,36 @@ public void RegisterPostJobStep(IStep step) | |
| /// Helper function used in CompositeActionHandler::RunAsync to | ||
| /// add a child node, aka a step, to the current job to the Root.JobSteps based on the location. | ||
| /// </summary> | ||
| public void RegisterNestedStep(IStep step, DictionaryContextData inputsData, int location, Dictionary<string, string> envData) | ||
| public IStep RegisterNestedStep( | ||
| IActionRunner step, | ||
| DictionaryContextData inputsData, | ||
| int location, | ||
| Dictionary<string, string> 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(); | ||
| step.ExecutionContext = Root.CreateChild(newGuid, step.DisplayName, newGuid.ToString("N"), null, null); | ||
|
|
||
| // 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>" | ||
| var safeContextName = !string.IsNullOrEmpty(ContextName) ? ContextName : $"__{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 | ||
| var childScopeName = !string.IsNullOrEmpty(ScopeName) ? $"{ScopeName}.{safeContextName}" : safeContextName; | ||
|
|
||
| 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.ExpressionValues["inputs"] = inputsData; | ||
|
|
||
| // Set Parent Attribute for Clean Up Step | ||
| if (cleanUp) | ||
| { | ||
| step.ExecutionContext.FinalizeContext = this; | ||
| } | ||
|
|
||
| // Add the composite action environment variables to each step. | ||
| // If the key already exists, we override it since the composite action env variables will have higher precedence | ||
| // Note that for each composite action step, it's environment variables will be set in the StepRunner automatically | ||
| // step.ExecutionContext.SetEnvironmentVariables(envData); | ||
| #if OS_WINDOWS | ||
| var envContext = new DictionaryContextData(); | ||
| #else | ||
|
|
@@ -293,6 +318,8 @@ public void RegisterNestedStep(IStep step, DictionaryContextData inputsData, int | |
| step.ExecutionContext.ExpressionValues["env"] = envContext; | ||
|
|
||
| Root.JobSteps.Insert(location, step); | ||
|
|
||
| return step; | ||
| } | ||
|
|
||
| public IExecutionContext CreateChild(Guid recordId, string displayName, string refName, string scopeName, string contextName, Dictionary<string, string> intraActionState = null, int? recordOrder = null) | ||
|
|
@@ -317,7 +344,6 @@ public IExecutionContext CreateChild(Guid recordId, string displayName, string r | |
| } | ||
| child.EnvironmentVariables = EnvironmentVariables; | ||
| child.JobDefaults = JobDefaults; | ||
| child.Scopes = Scopes; | ||
| child.FileTable = FileTable; | ||
| child.StepsContext = StepsContext; | ||
| foreach (var pair in ExpressionValues) | ||
|
|
@@ -466,7 +492,8 @@ public void SetOutput(string name, string value, out string reference) | |
| { | ||
| ArgUtil.NotNullOrEmpty(name, nameof(name)); | ||
|
|
||
| if (String.IsNullOrEmpty(ContextName)) | ||
| // if the ContextName follows the __GUID format which is set as the default value for ContextName if null for Composite Actions. | ||
| if (String.IsNullOrEmpty(ContextName) || _generatedContextNamePattern.IsMatch(ContextName)) | ||
| { | ||
| reference = null; | ||
| return; | ||
|
|
@@ -633,16 +660,6 @@ public void InitializeJob(Pipelines.AgentJobRequestMessage message, Cancellation | |
| // Steps context (StepsRunner manages adding the scoped steps context) | ||
| StepsContext = new StepsContext(); | ||
|
|
||
| // Scopes | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i love seeing dead code deleted :) |
||
| Scopes = new Dictionary<String, ContextScope>(StringComparer.OrdinalIgnoreCase); | ||
| if (message.Scopes?.Count > 0) | ||
| { | ||
| foreach (var scope in message.Scopes) | ||
| { | ||
| Scopes[scope.Name] = scope; | ||
| } | ||
| } | ||
|
|
||
| // File table | ||
| FileTable = new List<String>(message.FileTable ?? new string[0]); | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we'll be able to clean this up when the handler performs the steps-runner-ish things