- 
                Notifications
    You must be signed in to change notification settings 
- Fork 94
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededkind/featureCategorizes issue or PR as related to a new featureCategorizes issue or PR as related to a new feature
Milestone
Description
What would you like to be added?
Currently, Kusion will throw a nil with logging No resource change found in this stack... for an empty spec during preview and apply.
However, passing an empty spec during the preview is a possible user path, and the result of the preview should indicate that all resources will be deleted.
Related Code: 
kusion/pkg/server/manager/stack/execute.go
Lines 201 to 207 in a738404
| // return immediately if no resource found in stack | |
| // todo: if there is no resource, should still do diff job; for now, if output is json format, there is no hint | |
| if sp == nil || len(sp.Resources) == 0 { | |
| logutil.LogToAll(logger, runLogger, "Info", "No resource change found in this stack...") | |
| return nil, nil | |
| } | |
kusion/pkg/cmd/preview/preview.go
Lines 243 to 249 in a738404
| // return immediately if no resource found in stack | |
| if spec == nil || len(spec.Resources) == 0 { | |
| if o.Output != jsonOutput { | |
| fmt.Println(pretty.GreenBold("\nNo resource found in this stack.")) | |
| } | |
| return nil | |
| } | 
Why is this needed?
It is actually valid to pass an empty spec for a preview, and Kusion should handle the preview result correctly.
This change should not affect how apply and destroy handle an empty spec.
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededkind/featureCategorizes issue or PR as related to a new featureCategorizes issue or PR as related to a new feature