mirror of https://github.com/k3s-io/k3s
Merge pull request #1054 from erikwilson/sort-deployments
Use lexical (sorted) order for file deploymentspull/1057/head
commit
d383d1b47e
|
@ -10,6 +10,7 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -97,15 +98,20 @@ func (w *watcher) listFilesIn(base string, force bool) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
skips := map[string]bool{}
|
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") {
|
if strings.HasSuffix(file.Name(), ".skip") {
|
||||||
skips[strings.TrimSuffix(file.Name(), ".skip")] = true
|
skips[strings.TrimSuffix(file.Name(), ".skip")] = true
|
||||||
}
|
}
|
||||||
|
keys[keyIndex] = path
|
||||||
|
keyIndex++
|
||||||
}
|
}
|
||||||
|
sort.Strings(keys)
|
||||||
|
|
||||||
var errs []error
|
var errs []error
|
||||||
for path, file := range files {
|
for _, path := range keys {
|
||||||
if skipFile(file.Name(), skips) {
|
if skipFile(files[path].Name(), skips) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if err := w.deploy(path, !force); err != nil {
|
if err := w.deploy(path, !force); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue