Expose native session planning and artifact catalogs
This commit is contained in:
@@ -65,6 +65,18 @@ func checkExecutionInput(input *executionInput) error {
|
||||
}
|
||||
|
||||
func executionCommand(name, summary string, regenerate bool, deps commandDependencies, executor pipelineExecutor) commandkit.Command {
|
||||
spec := executionCommandSpec(name, summary, regenerate)
|
||||
spec.Run = func(invocation commandkit.Invocation, input *executionInput) commandkit.Outcome {
|
||||
report, err := executeSelectedPipeline(invocation.Context, input, deps, executor)
|
||||
if report != nil {
|
||||
err = errors.Join(err, invocation.Reporter().Report(commandkit.Report{Value: report}))
|
||||
}
|
||||
return operationOutcome(err)
|
||||
}
|
||||
return commandkit.NewCommand(spec)
|
||||
}
|
||||
|
||||
func executionCommandSpec(name, summary string, regenerate bool) commandkit.CommandSpec[*executionInput] {
|
||||
common := newConfigurationFlags(func(input **executionInput) *configurationSelection { return &(*input).Selection })
|
||||
flags := []commandkit.Flag[*executionInput]{common.Config, common.Overlay, common.Campaign, common.CampaignFile, common.SessionFile, common.PartyFile, common.SecretsDir,
|
||||
commandkit.ValueFlag(commandkit.FlagMeta{Name: "previous-session-id", Usage: "Assert the previous session identity."}, nil, stringValue, func(input **executionInput, value commandkit.Supplied[string]) { (*input).PreviousSession = value }),
|
||||
@@ -78,7 +90,7 @@ func executionCommand(name, summary string, regenerate bool, deps commandDepende
|
||||
commandkit.BoolFlag(commandkit.FlagMeta{Name: "force", Usage: "Rerun selected stages."}, false, func(input **executionInput, value commandkit.Supplied[bool]) { (*input).Force = value }),
|
||||
)
|
||||
}
|
||||
return commandkit.NewCommand(commandkit.CommandSpec[*executionInput]{
|
||||
return commandkit.CommandSpec[*executionInput]{
|
||||
Name: name, Summary: summary, NewInput: func() *executionInput { return &executionInput{} }, Flags: flags,
|
||||
Arguments: []commandkit.Argument[*executionInput]{commandkit.ValueArgument(commandkit.ArgumentMeta{Name: "SESSION", Usage: "Session identity."}, true, stringValue, func(input **executionInput, value commandkit.Supplied[string]) { (*input).Selection.Session = value })},
|
||||
CheckInput: func(input *executionInput) error {
|
||||
@@ -89,14 +101,7 @@ func executionCommand(name, summary string, regenerate bool, deps commandDepende
|
||||
}
|
||||
return checkExecutionInput(input)
|
||||
},
|
||||
Run: func(invocation commandkit.Invocation, input *executionInput) commandkit.Outcome {
|
||||
report, err := executeSelectedPipeline(invocation.Context, input, deps, executor)
|
||||
if report != nil {
|
||||
err = errors.Join(err, invocation.Reporter().Report(commandkit.Report{Value: report}))
|
||||
}
|
||||
return operationOutcome(err)
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func executeSelectedPipeline(ctx context.Context, input *executionInput, deps commandDependencies, executor pipelineExecutor) (report *runReport, err error) {
|
||||
|
||||
Reference in New Issue
Block a user