diff --git a/pkg/environment/apply.go b/pkg/environment/apply.go index c5801eb4..ff2f2355 100644 --- a/pkg/environment/apply.go +++ b/pkg/environment/apply.go @@ -184,11 +184,6 @@ func (a *Apply) ApplyBatch() error { func (a *Apply) applyNamespaceDirs(chunkFolder []string) error { erroredNs := []string{} - err := util.GetLatestGitPull() - if err != nil { - return err - } - done := make(chan bool) defer close(done) @@ -232,6 +227,15 @@ func (a *Apply) runApply(done <-chan bool, dirStream <-chan string) <-chan strin ns := strings.Split(dir, "/") namespace := ns[2] + pullErr := util.GetLatestGitPull() + if pullErr != nil { + if strings.Contains(pullErr.Error(), "index.lock") { + fmt.Printf("ignoring git lock error during parallel run\n") + } else { + return pullErr.Error() + } + } + err := a.applyNamespace(namespace) if err != nil { return "Error in namespace: " + namespace + "\n" + err.Error() diff --git a/pkg/util/util.go b/pkg/util/util.go index 0b59d633..b4172373 100644 --- a/pkg/util/util.go +++ b/pkg/util/util.go @@ -74,22 +74,20 @@ func GetLatestGitPull() error { fmt.Println("Executing git reset") resetErr := reset.Run() if resetErr != nil { - fmt.Println(fmt.Sprint(resetErr) + ": " + stderr.String()) - return resetErr + return errors.New(resetErr.Error() + ": " + stderr.String()) } fmt.Println("Executing git pull") err := pull.Run() if err != nil { - fmt.Println(fmt.Sprint(err) + ": " + stderr.String()) - return err + return errors.New(fmt.Sprint(err) + ": " + stderr.String()) } return nil } // Redacted reads bytes of data for any sensitive strings and print REDACTED -// This functiion is used to prevent slack webhooks URLS from being output in pipeline logs +// This function is used to prevent slack webhooks URLS from being output in pipeline logs func Redacted(w io.Writer, output string, redact bool) { re := regexp2.MustCompile(`^.*https://hooks\.slack\.com.*$`, 0) scanner := bufio.NewScanner(strings.NewReader(output))