From 24895e4b3098c7b6548d70c35ec42ebc5835fc7c Mon Sep 17 00:00:00 2001 From: Yushan Lin Date: Tue, 14 Jul 2026 15:18:13 -0700 Subject: [PATCH 1/2] config: remove fields not documented in config/README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Drops RepositoryConfig.FullHashRepos/ExcludedFiles/ExcludeExternalTargets/ StreamBazelLogs and ServiceConfig's settable WorkerRootPath override — none are documented in config/README.md, and WorkerRootPath is now always computed by Parse as workspaces_root_path/.workers rather than optionally overridden. graphrunner/native.go's Bzlmod query construction is adjusted so external-target querying no longer depends on the removed ExcludeExternalTargets field. Also fixes make test-integration on macOS: excludes @bazel_tools's platform-specific files (e.g. a Windows-only test wrapper) from disk-based hashing via RequestOptions.ExtraExcludeFilesRegex, since a prior config-side exclusion (excluded_files) was just removed as undocumented. --- config/config.go | 4 ---- config/repository_config.go | 13 ++----------- config/service_config.go | 11 ++++++----- example/tango-config.yaml | 7 ------- graphrunner/native.go | 16 ++++++++-------- integration/integration_test.go | 11 +++++++++++ integration/testdata/tango-config.yaml.tmpl | 4 ---- orchestrator/native_orchestrator.go | 1 - orchestrator/testdata/config.yaml | 6 ------ 9 files changed, 27 insertions(+), 46 deletions(-) diff --git a/config/config.go b/config/config.go index ceb52c1c..debc9228 100644 --- a/config/config.go +++ b/config/config.go @@ -17,7 +17,6 @@ package config import ( "fmt" "os" - "path/filepath" yaml "github.com/goccy/go-yaml" ) @@ -65,9 +64,6 @@ func Parse(configFilePath string) (*Config, error) { if config.Service.WorkspacesRootPath == "" { return nil, fmt.Errorf("service.workspaces_root_path must be set") } - if config.Service.WorkerRootPath == "" { - config.Service.WorkerRootPath = filepath.Join(config.Service.WorkspacesRootPath, ".workers") - } if config.Service.MaxWorkerPoolSize <= 0 { return nil, fmt.Errorf("service.max_worker_pool_size must be > 0, got %d", config.Service.MaxWorkerPoolSize) } diff --git a/config/repository_config.go b/config/repository_config.go index 71cb0e39..f7adbb4b 100644 --- a/config/repository_config.go +++ b/config/repository_config.go @@ -21,12 +21,6 @@ type RepositoryConfig struct { // unique across all entries and match exactly what clients send in // BuildDescription.remote. Remote string `yaml:"remote"` - // TODO: FullHashRepos, ExcludedFiles, and ExcludeExternalTargets are not - // documented in config/README.md. Delete them if they turn out to be unneeded, - // otherwise document them there. - FullHashRepos []string `yaml:"full_hash_repos"` - ExcludedFiles []string `yaml:"excluded_files"` - ExcludeExternalTargets bool `yaml:"exclude_external_targets"` // BzlmodEnabled indicates whether this repository uses Bzlmod for external // dependency management. Defaults to true if unset. Set to false only for // repositories still using WORKSPACE. @@ -34,14 +28,11 @@ type RepositoryConfig struct { // BazelCommandPath overrides the Bazel binary path. When empty, Tango // automatically downloads and caches Bazelisk from GitHub. BazelCommandPath string `yaml:"bazel_command_path"` - // QueryTimeoutSeconds is the Bazel query timeout in seconds. Defaults to 600. - QueryTimeoutSeconds int64 `yaml:"query_timeout_seconds"` // BazelExtraArgs are extra arguments passed to `bazel query` invocations, // inserted between the `query` subcommand and the query expression. BazelExtraArgs []string `yaml:"bazel_extra_args"` - // TODO: StreamBazelLogs is not documented in config/README.md. Delete it if - // it turns out to be unneeded, otherwise document it there. - StreamBazelLogs bool `yaml:"stream_bazel_logs"` + // QueryTimeoutSeconds is the Bazel query timeout in seconds. Defaults to 600. + QueryTimeoutSeconds int64 `yaml:"query_timeout_seconds"` } // RepositoryConfigProvider looks up per-repository configuration by remote. diff --git a/config/service_config.go b/config/service_config.go index 733126b3..41fbcbde 100644 --- a/config/service_config.go +++ b/config/service_config.go @@ -24,11 +24,12 @@ type ServiceConfig struct { // and worker checkouts. Required. Layout: // for // origin clones and /.workers//worker-{1..N}/ for // worker checkouts. - WorkspacesRootPath string `yaml:"workspaces_root_path"` - // TODO: WorkerRootPath is not documented in config/README.md. Delete it if - // it turns out to be unneeded, otherwise document it there. - WorkerRootPath string `yaml:"worker_root_path"` // root directory for worker workspace checkouts; defaults to workspaces_root_path/.workers - Streaming ChunkConfig `yaml:"streaming"` // streaming chunk sizes; zero values fall back to package defaults + WorkspacesRootPath string `yaml:"workspaces_root_path"` + Streaming ChunkConfig `yaml:"streaming"` // streaming chunk sizes; zero values fall back to package defaults + + // WorkerRootPath is the root directory for worker workspace checkouts, + // set by Parse to /.workers. Not settable via YAML. + WorkerRootPath string `yaml:"-"` } // ChunkConfig controls the number of entries per gRPC stream message. diff --git a/example/tango-config.yaml b/example/tango-config.yaml index 86059963..b453057b 100644 --- a/example/tango-config.yaml +++ b/example/tango-config.yaml @@ -9,11 +9,6 @@ storage: # Repository configuration repository: - remote: "https://github.com/uber/tango.git" - full_hash_repos: - - "" - excluded_files: - - "^@@?bazel_tools/" - exclude_external_targets: true bzlmod_enabled: true query_timeout_seconds: 300 @@ -22,5 +17,3 @@ service: max_worker_pool_size: 5 # root for origin clones; required workspaces_root_path: "/tmp/tango-repo-manager" - # root for worker checkouts; defaults to workspaces_root_path/.workers - worker_root_path: "/tmp/tango/workers" diff --git a/graphrunner/native.go b/graphrunner/native.go index 0eb1c0af..5cb415be 100644 --- a/graphrunner/native.go +++ b/graphrunner/native.go @@ -58,9 +58,12 @@ func NewNativeGraphRunner(p NativeGraphRunnerParams) GraphRunner { } func (g *nativeGraphRunner) Compute(ctx context.Context, ws workspace.Workspace) (targethasher.Result, error) { - query := "//external:all-targets + deps(//...:all-targets)" - if g.config.ExcludeExternalTargets { - query = "deps(//...:all-targets)" + bzlmodEnabled := g.config.BzlmodEnabled == nil || *g.config.BzlmodEnabled + query := "deps(//...:all-targets)" + if !bzlmodEnabled { + // //external is only queryable under legacy WORKSPACE resolution; + // Bzlmod repos resolve external deps under @@ instead. + query = "//external:all-targets + " + query } additionalArgs := append( []string{"--order_output=no", "--proto:locations", "--noproto:default_values"}, @@ -74,8 +77,6 @@ func (g *nativeGraphRunner) Compute(ctx context.Context, ws workspace.Workspace) // --proto:locations: we need to get external file location to make CTC more accurate // --noproto: parameters exclude fields from the output that are not used for hashing anyways, making // proto blob smaller and serialization/deserialization faster - // TODO: pass in --enable_workspace or --enable_bzlmod based on the config - AdditionalArgs: additionalArgs, }) g.scope.Timer("bazel_query_duration").Record(time.Since(bazelStart)) @@ -92,9 +93,8 @@ func (g *nativeGraphRunner) Compute(ctx context.Context, ws workspace.Workspace) hashConfig := targethasher.HashConfig{ KnownSourceHashes: knownSourceHashes, - FullHashRepos: g.config.FullHashRepos, - ExcludedRegex: append(g.config.ExcludedFiles, g.extraExcludedFiles...), - UseBzlmod: g.config.BzlmodEnabled == nil || *g.config.BzlmodEnabled, + ExcludedRegex: g.extraExcludedFiles, + UseBzlmod: bzlmodEnabled, } hashStart := time.Now() diff --git a/integration/integration_test.go b/integration/integration_test.go index c3373596..8d4ca164 100644 --- a/integration/integration_test.go +++ b/integration/integration_test.go @@ -48,6 +48,11 @@ const ( configTemplateFile = "testdata/tango-config.yaml.tmpl" ) +// bazelToolsExcludeRegex excludes @bazel_tools's source files from disk-based hashing. +// It ships platform-specific files (e.g. tools/test/tw.exe, a Windows-only test wrapper) +// that don't exist on every OS, so stat-ing them to hash fails on machines missing them. +var bazelToolsExcludeRegex = []string{"^@@?bazel_tools/"} + func repoRemote(t *testing.T) string { t.Helper() remote := os.Getenv("TANGO_REPO_REMOTE") @@ -266,6 +271,9 @@ func getChangedTargets(t *testing.T, client pb.TangoYARPCClient, remote, firstSH Remote: remote, BaseSha: secondSHA, }, + RequestOptions: &pb.RequestOptions{ + ExtraExcludeFilesRegex: bazelToolsExcludeRegex, + }, }) require.NoError(t, err, "failed to initiate GetChangedTargets stream") @@ -361,6 +369,9 @@ func TestIntegration_GetTargetGraph(t *testing.T) { Remote: remote, BaseSha: pinnedSHA, }, + RequestOptions: &pb.RequestOptions{ + ExtraExcludeFilesRegex: bazelToolsExcludeRegex, + }, }) require.NoError(t, err, "failed to initiate GetTargetGraph stream") diff --git a/integration/testdata/tango-config.yaml.tmpl b/integration/testdata/tango-config.yaml.tmpl index a6bfb93c..7edf0396 100644 --- a/integration/testdata/tango-config.yaml.tmpl +++ b/integration/testdata/tango-config.yaml.tmpl @@ -7,13 +7,9 @@ repository: {{- if .BazelCommand}} bazel_command_path: {{.BazelCommand}} {{- end}} - full_hash_repos: [""] - excluded_files: ["^@@?bazel_tools/"] - exclude_external_targets: true bzlmod_enabled: true query_timeout_seconds: 600 service: max_worker_pool_size: 2 workspaces_root_path: {{.ClonePath}} - worker_root_path: {{.WorkerPath}} diff --git a/orchestrator/native_orchestrator.go b/orchestrator/native_orchestrator.go index ff7701b0..3f9ab40a 100644 --- a/orchestrator/native_orchestrator.go +++ b/orchestrator/native_orchestrator.go @@ -191,7 +191,6 @@ func (b *nativeOrchestrator) GetTargetGraph(ctx context.Context, req entity.GetT Logger: b.logger, BazelCommand: repoCfg.BazelCommandPath, QueryTimeout: time.Duration(repoCfg.QueryTimeoutSeconds) * time.Second, - StreamLogs: repoCfg.StreamBazelLogs, }) if err != nil { return nil, fmt.Errorf("create bazel client: %w", err) diff --git a/orchestrator/testdata/config.yaml b/orchestrator/testdata/config.yaml index 4f3d045e..93f44392 100644 --- a/orchestrator/testdata/config.yaml +++ b/orchestrator/testdata/config.yaml @@ -1,11 +1,5 @@ repository: - remote: "git@github:uber/tango" - full_hash_repos: - - "//" - - "//external" - excluded_files: - - "*.gen.go" - exclude_external_targets: true bzlmod_enabled: true query_timeout_seconds: 15 From 2224a38ca1d3cd01b38e1102e6ec6a2baed1becb Mon Sep 17 00:00:00 2001 From: Yushan Lin Date: Tue, 14 Jul 2026 16:10:21 -0700 Subject: [PATCH 2/2] repomanager: derive worker root from clone path, drop config knob entirely MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removes ServiceConfig.WorkerRootPath()/the settable worker_root_path field along with repomanager.Params.WorkerRootPath — none of it is documented in config/README.md, and RepoManager already owns RepoManagerClonePath, so it can derive its own .workers subdirectory (/.workers//worker-{1..N}/) instead of being handed a second, independently-configurable path for the same tree. --- config/config_test.go | 37 --------------------------- config/service_config.go | 4 --- core/repomanager/repo_manager.go | 5 +--- core/repomanager/repo_manager_test.go | 22 ++++++++-------- example/main.go | 6 ----- integration/integration_test.go | 8 ++---- 6 files changed, 14 insertions(+), 68 deletions(-) diff --git a/config/config_test.go b/config/config_test.go index 77213d5d..ce7ff74f 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -70,43 +70,6 @@ repository: } } -func TestParse_ServiceDefaults(t *testing.T) { - tests := []struct { - name string - give string - wantWorkerRootPath string - }{ - { - name: "worker_root_path defaults when unset", - give: _baseServiceYAML + ` -repository: - - remote: "r1" -`, - wantWorkerRootPath: filepath.Join("/tmp/x", ".workers"), - }, - { - name: "worker_root_path explicit value preserved", - give: ` -service: - workspaces_root_path: "/tmp/x" - worker_root_path: "/tmp/custom-workers" - max_worker_pool_size: 1 -repository: - - remote: "r1" -`, - wantWorkerRootPath: "/tmp/custom-workers", - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - cfg, err := Parse(writeConfig(t, tt.give)) - require.NoError(t, err) - assert.Equal(t, tt.wantWorkerRootPath, cfg.Service.WorkerRootPath) - }) - } -} - func TestParse_RepositoryDefaults(t *testing.T) { tests := []struct { name string diff --git a/config/service_config.go b/config/service_config.go index 41fbcbde..4c0aa09e 100644 --- a/config/service_config.go +++ b/config/service_config.go @@ -26,10 +26,6 @@ type ServiceConfig struct { // worker checkouts. WorkspacesRootPath string `yaml:"workspaces_root_path"` Streaming ChunkConfig `yaml:"streaming"` // streaming chunk sizes; zero values fall back to package defaults - - // WorkerRootPath is the root directory for worker workspace checkouts, - // set by Parse to /.workers. Not settable via YAML. - WorkerRootPath string `yaml:"-"` } // ChunkConfig controls the number of entries per gRPC stream message. diff --git a/core/repomanager/repo_manager.go b/core/repomanager/repo_manager.go index 4b7aff0e..bd76a6a6 100644 --- a/core/repomanager/repo_manager.go +++ b/core/repomanager/repo_manager.go @@ -36,7 +36,6 @@ type RepoManager interface { type repoManager struct { git git.Interface repoManagerClonePath string - workerRootPath string logger *zap.SugaredLogger poolSize int @@ -77,7 +76,6 @@ type Params struct { Git git.Interface Logger *zap.SugaredLogger RepoManagerClonePath string - WorkerRootPath string PoolSize int } @@ -93,7 +91,6 @@ func NewRepoManager(appCtx context.Context, p Params) (RepoManager, error) { return &repoManager{ git: p.Git, repoManagerClonePath: p.RepoManagerClonePath, - workerRootPath: p.WorkerRootPath, logger: p.Logger, poolSize: p.PoolSize, pools: make(map[string]*workerPool), @@ -115,7 +112,7 @@ func (r *repoManager) poolFor(repo string) *workerPool { // Pre-allocate fixed worker slots. Existing directories from a previous // run are detected and reused without re-cloning. - workersDir := filepath.Join(r.workerRootPath, repo) + workersDir := filepath.Join(r.repoManagerClonePath, ".workers", repo) for i := 1; i <= r.poolSize; i++ { dir := filepath.Join(workersDir, fmt.Sprintf("worker-%d", i)) slot := &workerSlot{dir: dir} diff --git a/core/repomanager/repo_manager_test.go b/core/repomanager/repo_manager_test.go index 56a73194..5d3291f4 100644 --- a/core/repomanager/repo_manager_test.go +++ b/core/repomanager/repo_manager_test.go @@ -59,7 +59,7 @@ func TestLease_ClonesOriginAndCreatesWorker(t *testing.T) { g.EXPECT().Clone(gomock.Any(), remote, originDir, "-c", "gc.auto=0").Return(nil) g.EXPECT().Clone(gomock.Any(), originDir, workerDir, "--local", "-c", "gc.auto=0").Return(nil) - rm := newTestRepoManager(t, context.Background(), Params{Git: g, Logger: zap.NewNop().Sugar(), RepoManagerClonePath: root, WorkerRootPath: filepath.Join(root, ".workers"), PoolSize: 1}) + rm := newTestRepoManager(t, context.Background(), Params{Git: g, Logger: zap.NewNop().Sugar(), RepoManagerClonePath: root, PoolSize: 1}) ws, err := rm.Lease(context.Background(), entity.BuildDescription{Remote: remote}) require.NoError(t, err) assert.Equal(t, workerDir, ws.Path()) @@ -81,7 +81,7 @@ func TestLease_SkipsOriginClone_WhenExists(t *testing.T) { // Only worker clone expected g.EXPECT().Clone(gomock.Any(), originDir, workerDir, "--local", "-c", "gc.auto=0").Return(nil) - rm := newTestRepoManager(t, context.Background(), Params{Git: g, Logger: zap.NewNop().Sugar(), RepoManagerClonePath: root, WorkerRootPath: filepath.Join(root, ".workers"), PoolSize: 1}) + rm := newTestRepoManager(t, context.Background(), Params{Git: g, Logger: zap.NewNop().Sugar(), RepoManagerClonePath: root, PoolSize: 1}) ws, err := rm.Lease(context.Background(), entity.BuildDescription{Remote: remote}) require.NoError(t, err) assert.Equal(t, workerDir, ws.Path()) @@ -102,7 +102,7 @@ func TestLease_ReusesWorker_AfterRelease(t *testing.T) { g.EXPECT().Clone(gomock.Any(), remote, originDir, "-c", "gc.auto=0").Return(nil) g.EXPECT().Clone(gomock.Any(), originDir, workerDir, "--local", "-c", "gc.auto=0").Return(nil) - rm := newTestRepoManager(t, context.Background(), Params{Git: g, Logger: zap.NewNop().Sugar(), RepoManagerClonePath: root, WorkerRootPath: filepath.Join(root, ".workers"), PoolSize: 1}) + rm := newTestRepoManager(t, context.Background(), Params{Git: g, Logger: zap.NewNop().Sugar(), RepoManagerClonePath: root, PoolSize: 1}) ctx := context.Background() ws1, err := rm.Lease(ctx, entity.BuildDescription{Remote: remote}) @@ -131,7 +131,7 @@ func TestLease_CreatesMultipleWorkers(t *testing.T) { g.EXPECT().Clone(gomock.Any(), originDir, dir, "--local", "-c", "gc.auto=0").Return(nil) } - rm := newTestRepoManager(t, context.Background(), Params{Git: g, Logger: zap.NewNop().Sugar(), RepoManagerClonePath: root, WorkerRootPath: filepath.Join(root, ".workers"), PoolSize: 2}) + rm := newTestRepoManager(t, context.Background(), Params{Git: g, Logger: zap.NewNop().Sugar(), RepoManagerClonePath: root, PoolSize: 2}) ctx := context.Background() ws1, err := rm.Lease(ctx, entity.BuildDescription{Remote: remote}) @@ -157,7 +157,7 @@ func TestLease_BlocksUntilReturn(t *testing.T) { g.EXPECT().Clone(gomock.Any(), remote, originDir, "-c", "gc.auto=0").Return(nil) g.EXPECT().Clone(gomock.Any(), originDir, workerDir, "--local", "-c", "gc.auto=0").Return(nil) - rm := newTestRepoManager(t, context.Background(), Params{Git: g, Logger: zap.NewNop().Sugar(), RepoManagerClonePath: root, WorkerRootPath: filepath.Join(root, ".workers"), PoolSize: 1}) + rm := newTestRepoManager(t, context.Background(), Params{Git: g, Logger: zap.NewNop().Sugar(), RepoManagerClonePath: root, PoolSize: 1}) ctx := context.Background() ws1, err := rm.Lease(ctx, entity.BuildDescription{Remote: remote}) @@ -203,7 +203,7 @@ func TestLease_CtxCanceled(t *testing.T) { g.EXPECT().Clone(gomock.Any(), remote, originDir, "-c", "gc.auto=0").Return(nil) g.EXPECT().Clone(gomock.Any(), originDir, workerDir, "--local", "-c", "gc.auto=0").Return(nil) - rm := newTestRepoManager(t, context.Background(), Params{Git: g, Logger: zap.NewNop().Sugar(), RepoManagerClonePath: root, WorkerRootPath: filepath.Join(root, ".workers"), PoolSize: 1}) + rm := newTestRepoManager(t, context.Background(), Params{Git: g, Logger: zap.NewNop().Sugar(), RepoManagerClonePath: root, PoolSize: 1}) ws1, err := rm.Lease(context.Background(), entity.BuildDescription{Remote: remote}) require.NoError(t, err) @@ -225,7 +225,7 @@ func TestLease_OriginCloneFails(t *testing.T) { remote := "git@github.com:org/repo" g.EXPECT().Clone(gomock.Any(), remote, filepath.Join(root, "org/repo"), "-c", "gc.auto=0").Return(assert.AnError) - rm := newTestRepoManager(t, context.Background(), Params{Git: g, Logger: zap.NewNop().Sugar(), RepoManagerClonePath: root, WorkerRootPath: filepath.Join(root, ".workers"), PoolSize: 1}) + rm := newTestRepoManager(t, context.Background(), Params{Git: g, Logger: zap.NewNop().Sugar(), RepoManagerClonePath: root, PoolSize: 1}) _, err := rm.Lease(context.Background(), entity.BuildDescription{Remote: remote}) require.Error(t, err) assert.Contains(t, err.Error(), "clone origin") @@ -244,7 +244,7 @@ func TestLease_WorkerCloneFails(t *testing.T) { g.EXPECT().Clone(gomock.Any(), remote, originDir, "-c", "gc.auto=0").Return(nil) g.EXPECT().Clone(gomock.Any(), originDir, workerDir, "--local", "-c", "gc.auto=0").Return(assert.AnError) - rm := newTestRepoManager(t, context.Background(), Params{Git: g, Logger: zap.NewNop().Sugar(), RepoManagerClonePath: root, WorkerRootPath: filepath.Join(root, ".workers"), PoolSize: 1}) + rm := newTestRepoManager(t, context.Background(), Params{Git: g, Logger: zap.NewNop().Sugar(), RepoManagerClonePath: root, PoolSize: 1}) _, err := rm.Lease(context.Background(), entity.BuildDescription{Remote: remote}) require.Error(t, err) assert.Contains(t, err.Error(), "create worker") @@ -263,7 +263,7 @@ func TestLease_DiscoversExistingWorker(t *testing.T) { require.NoError(t, os.MkdirAll(filepath.Join(root, ".workers", "org/repo", "worker-1", ".git"), 0o755)) // No Clone calls — everything already exists - rm := newTestRepoManager(t, context.Background(), Params{Git: g, Logger: zap.NewNop().Sugar(), RepoManagerClonePath: root, WorkerRootPath: filepath.Join(root, ".workers"), PoolSize: 1}) + rm := newTestRepoManager(t, context.Background(), Params{Git: g, Logger: zap.NewNop().Sugar(), RepoManagerClonePath: root, PoolSize: 1}) ws, err := rm.Lease(context.Background(), entity.BuildDescription{Remote: remote}) require.NoError(t, err) assert.Contains(t, ws.Path(), "worker-1") @@ -289,7 +289,7 @@ func TestLease_DifferentRepos_IndependentPools(t *testing.T) { g.EXPECT().Clone(gomock.Any(), remote2, origin2, "-c", "gc.auto=0").Return(nil) g.EXPECT().Clone(gomock.Any(), origin2, worker2, "--local", "-c", "gc.auto=0").Return(nil) - rm := newTestRepoManager(t, context.Background(), Params{Git: g, Logger: zap.NewNop().Sugar(), RepoManagerClonePath: root, WorkerRootPath: filepath.Join(root, ".workers"), PoolSize: 1}) + rm := newTestRepoManager(t, context.Background(), Params{Git: g, Logger: zap.NewNop().Sugar(), RepoManagerClonePath: root, PoolSize: 1}) ctx := context.Background() // Both repos can be leased concurrently even with pool size 1 @@ -322,7 +322,7 @@ func TestLease_WorkerCloneFails_SlotReturnedToPool(t *testing.T) { g.EXPECT().Clone(gomock.Any(), originDir, workerDir, "--local", "-c", "gc.auto=0").Return(nil), ) - rm := newTestRepoManager(t, context.Background(), Params{Git: g, Logger: zap.NewNop().Sugar(), RepoManagerClonePath: root, WorkerRootPath: filepath.Join(root, ".workers"), PoolSize: 1}) + rm := newTestRepoManager(t, context.Background(), Params{Git: g, Logger: zap.NewNop().Sugar(), RepoManagerClonePath: root, PoolSize: 1}) ctx := context.Background() // First attempt fails diff --git a/example/main.go b/example/main.go index 6aba8d0c..83043a61 100644 --- a/example/main.go +++ b/example/main.go @@ -72,21 +72,15 @@ func run() error { // Repo manager and orchestrator repoManagerClonePath := cfg.Service.WorkspacesRootPath - workerRootPath := cfg.Service.WorkerRootPath if err := os.MkdirAll(repoManagerClonePath, 0o755); err != nil { return fmt.Errorf("failed to create repo manager clone path: %w", err) } defer os.RemoveAll(repoManagerClonePath) - if err := os.MkdirAll(workerRootPath, 0o755); err != nil { - return fmt.Errorf("failed to create worker root path: %w", err) - } - defer os.RemoveAll(workerRootPath) rm, err := repomanager.NewRepoManager(appCtx, repomanager.Params{ Git: git.New(repoManagerClonePath, logger), Logger: logger, RepoManagerClonePath: repoManagerClonePath, - WorkerRootPath: workerRootPath, PoolSize: cfg.Service.MaxWorkerPoolSize, }) if err != nil { diff --git a/integration/integration_test.go b/integration/integration_test.go index 8d4ca164..a85d4d82 100644 --- a/integration/integration_test.go +++ b/integration/integration_test.go @@ -60,7 +60,7 @@ func repoRemote(t *testing.T) string { return remote } -func writeConfig(t *testing.T, dir, remote, clonePath, workerPath string) string { +func writeConfig(t *testing.T, dir, remote, clonePath string) string { t.Helper() tmpl, err := template.ParseFiles(configTemplateFile) @@ -74,12 +74,10 @@ func writeConfig(t *testing.T, dir, remote, clonePath, workerPath string) string err = tmpl.Execute(f, struct { Remote string ClonePath string - WorkerPath string BazelCommand string }{ Remote: remote, ClonePath: clonePath, - WorkerPath: workerPath, BazelCommand: filepath.Join(remote, "tools", "bazel"), }) require.NoError(t, err, "failed to render config template") @@ -92,9 +90,8 @@ func startServer(t *testing.T, remote string) string { configDir := t.TempDir() clonePath := t.TempDir() - workerPath := t.TempDir() - configPath := writeConfig(t, configDir, remote, clonePath, workerPath) + configPath := writeConfig(t, configDir, remote, clonePath) zl := zaptest.NewLogger(t) logger := zl.Sugar() @@ -108,7 +105,6 @@ func startServer(t *testing.T, remote string) string { Git: git.New(clonePath, logger), Logger: logger, RepoManagerClonePath: clonePath, - WorkerRootPath: workerPath, PoolSize: 2, }) require.NoError(t, err, "failed to create repo manager")