Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kapp app-group deploy should order based on folder names #850

20 changes: 11 additions & 9 deletions pkg/kapp/cmd/appgroup/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,12 @@ func (o *DeployOptions) Run() error {

// Delete apps that no longer are present in directories
for _, app := range existingAppsInGroup {
if _, found := updatedApps[app.Name()]; !found {
err := o.deleteApp(app.Name())
if err != nil {
return err
for _, v := range updatedApps {
if app.Name() == v.Name {
err := o.deleteApp(app.Name())
if err != nil {
return err
}
}
}
}
Expand All @@ -117,8 +119,9 @@ type appGroupApp struct {
Path string
}

func (o *DeployOptions) appsToUpdate() (map[string]appGroupApp, error) {
result := map[string]appGroupApp{}
func (o *DeployOptions) appsToUpdate() ([]appGroupApp, error) {
var applications []appGroupApp

dir := o.DeployFlags.Directory

fileInfos, err := os.ReadDir(dir)
Expand All @@ -134,10 +137,9 @@ func (o *DeployOptions) appsToUpdate() (map[string]appGroupApp, error) {
Name: fmt.Sprintf("%s-%s", o.AppGroupFlags.Name, fi.Name()),
Path: filepath.Join(dir, fi.Name()),
}
result[app.Name] = app
applications = append(applications, app)
}

return result, nil
return applications, nil
}

func (o *DeployOptions) deployApp(app appGroupApp) error {
Expand Down
Loading