Skip to content

Commit

Permalink
fix(api): load application no-ascode (#5255)
Browse files Browse the repository at this point in the history
  • Loading branch information
sguiheux authored Jun 15, 2020
1 parent a83e1a2 commit c855935
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions engine/api/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,19 @@ func (api *API) getApplicationHandler() service.Handler {
app.Usage = &usage
}

proj, err := project.Load(api.mustDB(), projectKey)
if err != nil {
return err
}
wkAscodeHolder, err := workflow.LoadByRepo(ctx, api.mustDB(), *proj, app.FromRepository, workflow.LoadOptions{
WithTemplate: true,
})
if err != nil && !sdk.ErrorIs(err, sdk.ErrNotFound) {
return sdk.NewErrorFrom(err, "cannot found workflow holder of the pipeline")
if app.FromRepository != "" {
proj, err := project.Load(api.mustDB(), projectKey)
if err != nil {
return err
}
wkAscodeHolder, err := workflow.LoadByRepo(ctx, api.mustDB(), *proj, app.FromRepository, workflow.LoadOptions{
WithTemplate: true,
})
if err != nil && !sdk.ErrorIs(err, sdk.ErrNotFound) {
return sdk.NewErrorFrom(err, "cannot found workflow holder of the pipeline")
}
app.WorkflowAscodeHolder = wkAscodeHolder
}
app.WorkflowAscodeHolder = wkAscodeHolder

return service.WriteJSON(w, app, http.StatusOK)
}
Expand Down

0 comments on commit c855935

Please sign in to comment.