Validate providers and retain complete run debugging context
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -75,6 +76,9 @@ func Handler(ctx context.Context, stores ...*pipeline.Store) http.Handler {
|
||||
} else if request.Type == protocol.ListTemplates {
|
||||
response.Type = protocol.Templates
|
||||
response.Templates = examples.Catalog()
|
||||
for i := range response.Templates {
|
||||
response.Templates[i].Source = pipeline.WithDefaultModel(response.Templates[i].Source, os.Getenv("PIPELINES_DEFAULT_MODEL"))
|
||||
}
|
||||
} else if request.Type == protocol.Validate {
|
||||
graph, err := pipeline.Parse(request.Source)
|
||||
response.Type = protocol.Validated
|
||||
@@ -118,6 +122,7 @@ func Handler(ctx context.Context, stores ...*pipeline.Store) http.Handler {
|
||||
}
|
||||
} else if request.Type == protocol.List && len(stores) > 0 {
|
||||
response.Type = protocol.PipelineList
|
||||
response.DefaultModel = os.Getenv("PIPELINES_DEFAULT_MODEL")
|
||||
items, err := stores[0].List(ctx)
|
||||
if err != nil {
|
||||
response.Type = protocol.Error
|
||||
@@ -125,9 +130,12 @@ func Handler(ctx context.Context, stores ...*pipeline.Store) http.Handler {
|
||||
} else {
|
||||
response.Pipelines = items
|
||||
}
|
||||
} else if runs != nil && (request.Type == protocol.RunPipeline || request.Type == protocol.RetryRun || request.Type == protocol.ListRuns || request.Type == protocol.GetRun || request.Type == protocol.CancelRun) {
|
||||
} else if runs != nil && (request.Type == protocol.RunPipeline || request.Type == protocol.RetryRun || request.Type == protocol.ListRuns || request.Type == protocol.GetRun || request.Type == protocol.CancelRun || request.Type == protocol.GetRunEvidence) {
|
||||
var err error
|
||||
switch request.Type {
|
||||
case protocol.GetRunEvidence:
|
||||
response.Type = protocol.RunEvidence
|
||||
response.Evidence, err = runs.evidence(ctx, request.RunID)
|
||||
case protocol.RunPipeline:
|
||||
response.Type = protocol.RunStarted
|
||||
response.RunDetail, err = runs.start(request)
|
||||
|
||||
Reference in New Issue
Block a user