Skip to content

Commit

Permalink
fix: do not update/sort env vars when nothing changes
Browse files Browse the repository at this point in the history
When updating an app with an unrelated change, we should not sort the
existing env vars as that can trigger an unexpected build. We simply
return the old env vars if the new envs and to delete is empty.
  • Loading branch information
ctrox committed Jul 10, 2024
1 parent 5ee8326 commit 6815ad4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/util/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ func EnvVarsFromMap(env map[string]string) apps.EnvVars {
}

func UpdateEnvVars(oldEnvs []apps.EnvVar, newEnvs map[string]string, toDelete []string) apps.EnvVars {
if len(newEnvs) == 0 && len(toDelete) == 0 {
return oldEnvs
}

envMap := map[string]apps.EnvVar{}
for _, v := range oldEnvs {
envMap[v.Name] = v
Expand Down

0 comments on commit 6815ad4

Please sign in to comment.