From b298733b3febc676058c25f85891c9ae5a97d0d6 Mon Sep 17 00:00:00 2001 From: Erik Wilson Date: Tue, 12 Nov 2019 16:05:09 -0700 Subject: [PATCH] Use lexical (sorted) order for file deployments --- pkg/deploy/controller.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pkg/deploy/controller.go b/pkg/deploy/controller.go index f768c092d7..a111c81ecd 100644 --- a/pkg/deploy/controller.go +++ b/pkg/deploy/controller.go @@ -10,6 +10,7 @@ import ( "io/ioutil" "os" "path/filepath" + "sort" "strings" "time" @@ -97,15 +98,20 @@ func (w *watcher) listFilesIn(base string, force bool) error { } skips := map[string]bool{} - for _, file := range files { + keys := make([]string, len(files)) + keyIndex := 0 + for path, file := range files { if strings.HasSuffix(file.Name(), ".skip") { skips[strings.TrimSuffix(file.Name(), ".skip")] = true } + keys[keyIndex] = path + keyIndex++ } + sort.Strings(keys) var errs []error - for path, file := range files { - if skipFile(file.Name(), skips) { + for _, path := range keys { + if skipFile(files[path].Name(), skips) { continue } if err := w.deploy(path, !force); err != nil {