Skip to content

Commit

Permalink
kapp app-group deploy should order based on folder names (#850)
Browse files Browse the repository at this point in the history
* kapp app-group deploy should order based on folder names #755

Signed-off-by: rjtch <[email protected]>

* fix(#755) - removed map and used slice instead for sorting apps

Signed-off-by: rjtch <[email protected]>

* feat/755 - removed unecessary printf

Signed-off-by: rjtch <[email protected]>

* feat/755 - removed unecessary signoff

Signed-off-by: rjtch <[email protected]>

* signoff error

Signed-off-by: rjtch <[email protected]>

* signoff error

Signed-off-by: rjtch <[email protected]>

* tried to fix CDo

Signed-off-by: rjtch <[email protected]>

* signed-off last request

Signed-off-by: rjtch <[email protected]>

* signoff-last message and fixed unsigned commits

Signed-off-by: rjtch <[email protected]>

* get back deleted changed

Signed-off-by: rjtch <[email protected]>

* removed unnessary printf

Signed-off-by: rjtch <[email protected]>

---------

Signed-off-by: rjtch <[email protected]>
Co-authored-by: Hergy Fongue <[email protected]>
  • Loading branch information
rjtch and Hergy Fongue authored Nov 4, 2023
1 parent 0610c41 commit 39761d2
Showing 1 changed file with 11 additions and 9 deletions.
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

0 comments on commit 39761d2

Please sign in to comment.