Skip to content

Commit 8ce66f2

Browse files
fsaminbnjjj
authored andcommitted
fix(api): load application with variables when running wf from repo (#2971)
1 parent 58aae1c commit 8ce66f2

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

engine/api/workflow/workflow_importer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func Import(db gorp.SqlExecutor, store cache.Store, proj *sdk.Project, w *sdk.Wo
3737
if _, has := n.Application(); !has {
3838
return
3939
}
40-
app, err := application.LoadByName(db, store, proj.Key, n.Context.Application.Name, u, application.LoadOptions.WithClearDeploymentStrategies)
40+
app, err := application.LoadByName(db, store, proj.Key, n.Context.Application.Name, u, application.LoadOptions.WithClearDeploymentStrategies, application.LoadOptions.WithVariables)
4141
if err != nil {
4242
log.Warning("workflow.Import> %s > Application %s not found: %v", w.Name, n.Context.Application.Name, err)
4343
mError.Append(fmt.Errorf("application %s/%s not found", proj.Key, n.Context.Application.Name))

engine/api/workflow_run.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,13 @@ func (api *API) postWorkflowRunHandler() Handler {
601601
u := getUser(ctx)
602602

603603
_, next := tracing.Span(ctx, "project.Load")
604-
p, errP := project.Load(api.mustDB(), api.Cache, key, u, project.LoadOptions.WithVariables, project.LoadOptions.WithFeatures, project.LoadOptions.WithPlatforms)
604+
p, errP := project.Load(api.mustDB(), api.Cache, key, u,
605+
project.LoadOptions.WithVariables,
606+
project.LoadOptions.WithFeatures,
607+
project.LoadOptions.WithPlatforms,
608+
project.LoadOptions.WithApplicationVariables,
609+
project.LoadOptions.WithApplicationWithDeploymentStrategies,
610+
)
605611
next()
606612
if errP != nil {
607613
return sdk.WrapError(errP, "postWorkflowRunHandler> Cannot load project")
@@ -649,10 +655,12 @@ func (api *API) postWorkflowRunHandler() Handler {
649655
}
650656
proj, errp := project.Load(api.mustDB(), api.Cache, key, u,
651657
project.LoadOptions.WithGroups,
652-
project.LoadOptions.WithApplications,
658+
project.LoadOptions.WithApplicationVariables,
659+
project.LoadOptions.WithApplicationWithDeploymentStrategies,
653660
project.LoadOptions.WithEnvironments,
654661
project.LoadOptions.WithPipelines,
655662
project.LoadOptions.WithClearKeys,
663+
project.LoadOptions.WithClearPlatforms,
656664
)
657665

658666
if errp != nil {

0 commit comments

Comments
 (0)