Skip to content

Commit

Permalink
fix(api): compute workflow v3 preview (#6346)
Browse files Browse the repository at this point in the history
richardlt authored Oct 21, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 382bf78 commit 0bc7a67
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions engine/api/workflow.go
Original file line number Diff line number Diff line change
@@ -219,6 +219,9 @@ func (api *API) getWorkflowHandler() service.Handler {
vars := mux.Vars(r)
key := vars["key"]
name := vars["permWorkflowNameAdvanced"]
if name == "" {
name = vars["permWorkflowName"] // Useful for workflowv3 routes
}
withUsage := service.FormBool(r, "withUsage")
withAudits := service.FormBool(r, "withAudits")
withLabels := service.FormBool(r, "withLabels")
4 changes: 4 additions & 0 deletions engine/api/workflow/dao.go
Original file line number Diff line number Diff line change
@@ -257,6 +257,10 @@ func Load(ctx context.Context, db gorp.SqlExecutor, _ cache.Store, proj sdk.Proj
ctx, end := telemetry.Span(ctx, "workflow.Load")
defer end()

if name == "" {
return nil, sdk.NewErrorFrom(sdk.ErrInvalidData, "invalid given workflow name")
}

dao := opts.GetWorkflowDAO()
dao.Filters.ProjectKey = proj.Key
dao.Filters.WorkflowName = name
3 changes: 3 additions & 0 deletions engine/api/workflow_run.go
Original file line number Diff line number Diff line change
@@ -266,6 +266,9 @@ func (api *API) getWorkflowRunHandler() service.Handler {
vars := mux.Vars(r)
key := vars["key"]
name := vars["permWorkflowNameAdvanced"]
if name == "" {
name = vars["permWorkflowName"] // Useful for workflowv3 routes
}
number, err := requestVarInt(r, "number")
if err != nil {
return err

0 comments on commit 0bc7a67

Please sign in to comment.