Skip to content

Commit

Permalink
fix(api): load application with variables when running wf from repo (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
fsamin authored and bnjjj committed Jun 28, 2018
1 parent 58aae1c commit 8ce66f2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion engine/api/workflow/workflow_importer.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func Import(db gorp.SqlExecutor, store cache.Store, proj *sdk.Project, w *sdk.Wo
if _, has := n.Application(); !has {
return
}
app, err := application.LoadByName(db, store, proj.Key, n.Context.Application.Name, u, application.LoadOptions.WithClearDeploymentStrategies)
app, err := application.LoadByName(db, store, proj.Key, n.Context.Application.Name, u, application.LoadOptions.WithClearDeploymentStrategies, application.LoadOptions.WithVariables)
if err != nil {
log.Warning("workflow.Import> %s > Application %s not found: %v", w.Name, n.Context.Application.Name, err)
mError.Append(fmt.Errorf("application %s/%s not found", proj.Key, n.Context.Application.Name))
Expand Down
12 changes: 10 additions & 2 deletions engine/api/workflow_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,13 @@ func (api *API) postWorkflowRunHandler() Handler {
u := getUser(ctx)

_, next := tracing.Span(ctx, "project.Load")
p, errP := project.Load(api.mustDB(), api.Cache, key, u, project.LoadOptions.WithVariables, project.LoadOptions.WithFeatures, project.LoadOptions.WithPlatforms)
p, errP := project.Load(api.mustDB(), api.Cache, key, u,
project.LoadOptions.WithVariables,
project.LoadOptions.WithFeatures,
project.LoadOptions.WithPlatforms,
project.LoadOptions.WithApplicationVariables,
project.LoadOptions.WithApplicationWithDeploymentStrategies,
)
next()
if errP != nil {
return sdk.WrapError(errP, "postWorkflowRunHandler> Cannot load project")
Expand Down Expand Up @@ -649,10 +655,12 @@ func (api *API) postWorkflowRunHandler() Handler {
}
proj, errp := project.Load(api.mustDB(), api.Cache, key, u,
project.LoadOptions.WithGroups,
project.LoadOptions.WithApplications,
project.LoadOptions.WithApplicationVariables,
project.LoadOptions.WithApplicationWithDeploymentStrategies,
project.LoadOptions.WithEnvironments,
project.LoadOptions.WithPipelines,
project.LoadOptions.WithClearKeys,
project.LoadOptions.WithClearPlatforms,
)

if errp != nil {
Expand Down

0 comments on commit 8ce66f2

Please sign in to comment.