Monorepo for Tangled
0

Configure Feed

Select the types of activity you want to include in your feed.

spindle: fix newRepoCloneUrl host, self-heal SparseSyncGitRepo, and use alpine:3.24

Signed-off-by: dawn <dawn@tangled.org>

authored by

dawn and committed by
Tangled
(Jul 4, 2026, 8:12 AM +0300) 3be305c8 5240ec97

+19 -7
+1 -1
localinfra/spindle.Dockerfile
··· 21 21 go build -tags libsqlite3 -o /out/spindle ./cmd/spindle && \ 22 22 go build -tags libsqlite3 -o /out/spindle-microvm-run ./cmd/spindle-microvm-run 23 23 24 - FROM alpine:3.20 24 + FROM alpine:3.24 25 25 26 26 RUN apk add --no-cache \ 27 27 bash \
+17 -5
spindle/git/git.go
··· 72 72 if err != nil { 73 73 return err 74 74 } 75 + if exist { 76 + gitDirExist, err := isDir(path + "/.git") 77 + if err != nil { 78 + return err 79 + } 80 + if !gitDirExist { 81 + if err := os.RemoveAll(path); err != nil { 82 + return fmt.Errorf("cleanup invalid git dir: %w", err) 83 + } 84 + exist = false 85 + } 86 + } 75 87 if rev == "" { 76 88 rev = "HEAD" 77 89 } 78 90 if !exist { 79 - if err := exec.Command("git", "clone", "--no-checkout", "--depth=1", "--filter=tree:0", "--revision="+rev, cloneUri, path).Run(); err != nil { 91 + if err := exec.CommandContext(ctx, "git", "clone", "--no-checkout", "--depth=1", "--filter=tree:0", "--revision="+rev, cloneUri, path).Run(); err != nil { 80 92 return fmt.Errorf("git clone: %w", err) 81 93 } 82 - if err := exec.Command("git", "-C", path, "sparse-checkout", "set", "--no-cone", WorkflowDir).Run(); err != nil { 94 + if err := exec.CommandContext(ctx, "git", "-C", path, "sparse-checkout", "set", "--no-cone", WorkflowDir).Run(); err != nil { 83 95 return fmt.Errorf("git sparse-checkout set: %w", err) 84 96 } 85 97 } else { 86 - if err := exec.Command("git", "-C", path, "fetch", "--depth=1", "--filter=tree:0", "origin", rev).Run(); err != nil { 87 - return fmt.Errorf("git pull: %w", err) 98 + if err := exec.CommandContext(ctx, "git", "-C", path, "fetch", "--depth=1", "--filter=tree:0", "origin", rev).Run(); err != nil { 99 + return fmt.Errorf("git fetch: %w", err) 88 100 } 89 101 } 90 - if err := exec.Command("git", "-C", path, "checkout", rev).Run(); err != nil { 102 + if err := exec.CommandContext(ctx, "git", "-C", path, "checkout", rev).Run(); err != nil { 91 103 return fmt.Errorf("git checkout: %w", err) 92 104 } 93 105 return nil
+1 -1
spindle/server.go
··· 424 424 } 425 425 426 426 // NOTE: we are blindly trusting the knot that it will return only repos it own 427 - repoCloneUri := s.newRepoCloneUrl(src.Key(), repoDid) 427 + repoCloneUri := s.newRepoCloneUrl(src.Host, repoDid) 428 428 repoPath := s.newRepoPath(repoDid) 429 429 if err := git.SparseSyncGitRepo(ctx, repoCloneUri, repoPath, event.NewSha); err != nil { 430 430 return fmt.Errorf("sync git repo: %w", err)