added state mismatch check

This commit is contained in:
2023-12-20 09:16:51 +01:00
parent 352ce97b88
commit 55cf1b7eb4
4 changed files with 52 additions and 20 deletions

View File

@@ -259,9 +259,8 @@ func (b *BuildManager) syncWorker(ctx context.Context) error {
log.Fatalf("error creating work dir %s: %v", conf.Basedir.Work, err)
}
gitPath := filepath.Join(conf.Basedir.Work, stateDir)
for {
gitPath := filepath.Join(conf.Basedir.Work, stateDir)
if _, err := os.Stat(gitPath); os.IsNotExist(err) {
cmd := exec.Command("git", "clone", "--depth=1", conf.StateRepo, gitPath) //nolint:gosec
res, err := cmd.CombinedOutput()