Skip to content

Commit

Permalink
Fix missing envs when updating application of content management plug…
Browse files Browse the repository at this point in the history
…in type (argoproj#2331)

Close: argoproj#2330
  • Loading branch information
yujunz authored and Alexander Matyushentsev committed Sep 19, 2019
1 parent affbfe9 commit 06bab51
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion server/application/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ func (s *Server) validateAndNormalizeApp(ctx context.Context, app *appv1.Applica
return err
}

conditions, err := argo.ValidateRepo(ctx, &app.Spec, s.repoClientset, s.db, &kustomizeOptions, plugins, s.kubectl)
conditions, err := argo.ValidateRepo(ctx, app, s.repoClientset, s.db, &kustomizeOptions, plugins, s.kubectl)
if err != nil {
return err
}
Expand Down
10 changes: 6 additions & 4 deletions util/argo/argo.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,14 @@ func WaitForRefresh(ctx context.Context, appIf v1alpha1.ApplicationInterface, na
// * ksonnet: the specified environment exists
func ValidateRepo(
ctx context.Context,
spec *argoappv1.ApplicationSpec,
app *argoappv1.Application,
repoClientset apiclient.Clientset,
db db.ArgoDB,
kustomizeOptions *argoappv1.KustomizeOptions,
plugins []*argoappv1.ConfigManagementPlugin,
kubectl kube.Kubectl,
) ([]argoappv1.ApplicationCondition, error) {
spec := &app.Spec
conditions := make([]argoappv1.ApplicationCondition, 0)

// Test the repo
Expand Down Expand Up @@ -219,7 +220,7 @@ func ValidateRepo(
if err != nil {
return nil, err
}
conditions = append(conditions, verifyGenerateManifests(ctx, repo, repos, spec, repoClient, kustomizeOptions, plugins, cluster.ServerVersion)...)
conditions = append(conditions, verifyGenerateManifests(ctx, repo, repos, app, repoClient, kustomizeOptions, plugins, cluster.ServerVersion)...)

return conditions, nil
}
Expand Down Expand Up @@ -292,13 +293,13 @@ func verifyGenerateManifests(
ctx context.Context,
repoRes *argoappv1.Repository,
repos argoappv1.Repositories,
spec *argoappv1.ApplicationSpec,
app *argoappv1.Application,
repoClient apiclient.RepoServerServiceClient,
kustomizeOptions *argoappv1.KustomizeOptions,
plugins []*argoappv1.ConfigManagementPlugin,
kubeVersion string,
) []argoappv1.ApplicationCondition {

spec := &app.Spec
var conditions []argoappv1.ApplicationCondition
if spec.Destination.Server == "" || spec.Destination.Namespace == "" {
conditions = append(conditions, argoappv1.ApplicationCondition{
Expand All @@ -315,6 +316,7 @@ func verifyGenerateManifests(
},
Repos: repos,
Revision: spec.Source.TargetRevision,
AppLabelValue: app.Name,
Namespace: spec.Destination.Namespace,
ApplicationSource: &spec.Source,
Plugins: plugins,
Expand Down

0 comments on commit 06bab51

Please sign in to comment.