mirror of
https://github.com/actions/runner.git
synced 2025-12-10 12:36:23 +00:00
Starting framework
This commit is contained in:
@@ -325,7 +325,7 @@ namespace GitHub.Runner.Worker
|
||||
var postToken = default(StringToken);
|
||||
var postEntrypointToken = default(StringToken);
|
||||
var postIfToken = default(StringToken);
|
||||
var stepsLoaded = default(List<Pipelines.ActionStep>);
|
||||
var stepsLoaded = default(List<Pipelines.Step>);
|
||||
|
||||
foreach (var run in runsMapping)
|
||||
{
|
||||
|
||||
@@ -48,50 +48,68 @@ namespace GitHub.Runner.Worker.Handlers
|
||||
// Add each composite action step to the front of the queue
|
||||
int location = 0;
|
||||
|
||||
|
||||
|
||||
// While loop till we have reached the last layer?
|
||||
Stack<Pipelines.Step> stepsToAppend = new Stack<Pipelines.Step>();
|
||||
// TODO: Assume that each step is not an actionStep
|
||||
// How do we handle all types of steps?????
|
||||
|
||||
foreach (Pipelines.ActionStep aStep in actionSteps)
|
||||
|
||||
// Append in reverse order since we are using a stack
|
||||
for (int i = actionSteps.Count - 1; i --> 0; )
|
||||
{
|
||||
// Ex:
|
||||
// runs:
|
||||
// using: "composite"
|
||||
// steps:
|
||||
// - uses: example/test-composite@v2 (a)
|
||||
// - run echo hello world (b)
|
||||
// - run echo hello world 2 (c)
|
||||
//
|
||||
// ethanchewy/test-composite/action.yaml
|
||||
// runs:
|
||||
// using: "composite"
|
||||
// steps:
|
||||
// - run echo hello world 3 (d)
|
||||
// - run echo hello world 4 (e)
|
||||
//
|
||||
// Steps processed as follow:
|
||||
// | a |
|
||||
// | a | => | d |
|
||||
// (Run step d)
|
||||
// | a |
|
||||
// | a | => | e |
|
||||
// (Run step e)
|
||||
// | a |
|
||||
// (Run step a)
|
||||
// | b |
|
||||
// (Run step b)
|
||||
// | c |
|
||||
// (Run step c)
|
||||
// Done.
|
||||
|
||||
var actionRunner = HostContext.CreateService<IActionRunner>();
|
||||
actionRunner.Action = aStep;
|
||||
actionRunner.Stage = stage;
|
||||
actionRunner.Condition = aStep.Condition;
|
||||
actionRunner.DisplayName = aStep.DisplayName;
|
||||
|
||||
ExecutionContext.RegisterNestedStep(actionRunner, inputsData, location, Environment);
|
||||
location++;
|
||||
stepsToAppend.Append(actionSteps[i]);
|
||||
}
|
||||
while (stepsToAppend != null)
|
||||
{
|
||||
var currentStep = stepsToAppend.Pop();
|
||||
}
|
||||
|
||||
// foreach (Pipelines.Step aStep in actionSteps)
|
||||
// {
|
||||
// // Ex:
|
||||
// // runs:
|
||||
// // using: "composite"
|
||||
// // steps:
|
||||
// // - uses: example/test-composite@v2 (a)
|
||||
// // - run echo hello world (b)
|
||||
// // - run echo hello world 2 (c)
|
||||
// //
|
||||
// // ethanchewy/test-composite/action.yaml
|
||||
// // runs:
|
||||
// // using: "composite"
|
||||
// // steps:
|
||||
// // - run echo hello world 3 (d)
|
||||
// // - run echo hello world 4 (e)
|
||||
// //
|
||||
// // Steps processed as follow:
|
||||
// // | a |
|
||||
// // | a | => | d |
|
||||
// // (Run step d)
|
||||
// // | a |
|
||||
// // | a | => | e |
|
||||
// // (Run step e)
|
||||
// // | a |
|
||||
// // (Run step a)
|
||||
// // | b |
|
||||
// // (Run step b)
|
||||
// // | c |
|
||||
// // (Run step c)
|
||||
// // Done.
|
||||
|
||||
// // TODO: how are we going to order each step?
|
||||
// // How is this going to look in the UI (will we have a bunch of nesting)
|
||||
// // ^ We need to focus on how we are going to get the steps to run in the right order.
|
||||
|
||||
// var actionRunner = HostContext.CreateService<IActionRunner>();
|
||||
// actionRunner.Action = aStep;
|
||||
// actionRunner.Stage = stage;
|
||||
// actionRunner.Condition = aStep.Condition;
|
||||
// actionRunner.DisplayName = aStep.DisplayName;
|
||||
|
||||
// ExecutionContext.RegisterNestedStep(actionRunner, inputsData, location, Environment);
|
||||
// location++;
|
||||
// }
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
@@ -264,14 +264,13 @@ namespace GitHub.DistributedTask.Pipelines.ObjectTemplating
|
||||
return result;
|
||||
}
|
||||
|
||||
//Note: originally was List<Step> but we need to change to List<ActionStep> to use the "Inputs" attribute
|
||||
internal static List<ActionStep> ConvertToSteps(
|
||||
internal static List<Step> ConvertToSteps(
|
||||
TemplateContext context,
|
||||
TemplateToken steps)
|
||||
{
|
||||
var stepsSequence = steps.AssertSequence($"job {PipelineTemplateConstants.Steps}");
|
||||
|
||||
var result = new List<ActionStep>();
|
||||
var result = new List<Step>();
|
||||
foreach (var stepsItem in stepsSequence)
|
||||
{
|
||||
var step = ConvertToStep(context, stepsItem);
|
||||
@@ -287,7 +286,7 @@ namespace GitHub.DistributedTask.Pipelines.ObjectTemplating
|
||||
return result;
|
||||
}
|
||||
|
||||
private static ActionStep ConvertToStep(
|
||||
private static Step ConvertToStep(
|
||||
TemplateContext context,
|
||||
TemplateToken stepsItem)
|
||||
{
|
||||
|
||||
@@ -159,11 +159,11 @@ namespace GitHub.DistributedTask.Pipelines.ObjectTemplating
|
||||
return result;
|
||||
}
|
||||
|
||||
// Change to return a variety of steps.
|
||||
public List<ActionStep> LoadCompositeSteps(
|
||||
// TODO: Change to return a variety of steps.
|
||||
public List<Step> LoadCompositeSteps(
|
||||
TemplateToken token)
|
||||
{
|
||||
var result = default(List<ActionStep>);
|
||||
var result = default(List<Step>);
|
||||
if (token != null && token.Type != TokenType.Null)
|
||||
{
|
||||
var context = CreateContext(null, null, setMissingContext: false);
|
||||
|
||||
Reference in New Issue
Block a user