Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
fi

- name: Build
run: bazel build //:client
run: bazel build //...

# Template for future matrix builds
# matrix-build:
Expand Down
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
repos:
- repo: local
hooks:
- id: gofmt-bazel
name: Format Go code via Bazel (rules_go)
entry: bazel run @io_bazel_rules_go//go -- fmt ./...
language: system
pass_filenames: false
types: [go]
9 changes: 0 additions & 9 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,3 @@ go_binary(
embed = [":go_default_library"],
visibility = ["//visibility:public"],
)

go_binary(
name = "test",
srcs = ["test.go"],
deps = [
"@com_github_golang_protobuf//proto:go_default_library",
"@remoteapis//build/bazel/remote/execution/v2:go_default_library",
],
)
53 changes: 53 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
## Contributing

Thank you for helping improve `bf-client`! This guide outlines the basics for making high‑quality contributions that are easy to review and maintain.

### Prerequisites
- Go 1.23 (see `go.mod`)
- Bazel (build/test)
- Git

### Getting started
1. Fork the repo and create a feature branch from the default branch.
2. Make small, focused commits with clear messages.
3. Open a pull request early for feedback; keep PRs scoped and reviewable.

### Build and test
- Bazel (preferred):
- Build: `bazel build //...`
- Test: `bazel test //...`
- Native Go (if helpful locally):
- `go build ./...`
- `go test ./...`

All PRs should pass tests and build cleanly.

### Formatting and static checks
- Always run formatting before committing:
- `go fmt ./...`
- Optionally also: `gofmt -s -w .`
- Prefer to run basic static checks locally:
- `go vet ./...`

CI may reject PRs that aren’t formatted. If you’re unsure, re‑run `go fmt ./...`.


### Pre-commit (optional but encouraged)
Use `pre-commit` to auto‑format and vet changes locally.

Then run:
```bash
pre-commit install
```

### Commit and PR checklist
- [ ] Code compiles and tests pass (`bazel test //...`)
- [ ] Public APIs and non‑obvious logic documented
- [ ] PR description explains the why and the what

### Communication
- Prefer small, iterative PRs; include context and tradeoffs.
- Be kind and constructive in reviews; propose changes with rationale.

Thanks for contributing!

15 changes: 4 additions & 11 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion client/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ func ExecuteOperationMetadata(op *longrunning.Operation) (*reapi.ExecuteOperatio
}
return qm.ExecuteOperationMetadata, nil
}
return nil, errors.New("Unexpected metadata: " + proto.MarshalTextString(op))
// Gracefully handle unexpected or unknown metadata types by returning an
// empty ExecuteOperationMetadata instead of an error to avoid crashing
// callers that expect a non-nil metadata instance.
return &reapi.ExecuteOperationMetadata{}, nil
}

func RequestMetadata(o *longrunning.Operation) *reapi.RequestMetadata {
Expand Down
6 changes: 3 additions & 3 deletions extensions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ def _buildfarm_extension_impl(_ctx):
http_archive(
name = "buildfarm",
build_file = "@//:BUILD.buildfarm",
sha256 = "cf47ea9674bde436cfafdcfc772be0fb5998482185c0e339ee4170370f025cf8",
strip_prefix = "buildfarm-6be2f5e33ca9e3a0c7a2be253d52a53c3df4eddc/src/main/protobuf/build/buildfarm/v1test/",
sha256 = "575c657a565c4e986ba10b55c6e652c6ec7a68c2222b4951a9362dc0e53e3d2d",
strip_prefix = "buildfarm-2.16.0/src/main/protobuf/build/buildfarm/v1test/",
urls = [
"https://github.com/buildfarm/buildfarm/archive/6be2f5e33ca9e3a0c7a2be253d52a53c3df4eddc.zip",
"https://github.com/buildfarm/buildfarm/archive/refs/tags/2.16.0.zip",
],
)

Expand Down
5 changes: 4 additions & 1 deletion view/operation_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func NewOperationList(a *client.App, mode int, v View) *operationList {
start := time.Now()
a.Fetches++
status, err := c.Status(context.Background(), &bfpb.BackplaneStatusRequest{
InstanceName: "shard",
InstanceName: a.Instance,
})
a.LastReapiLatency = time.Since(start)
if err != nil {
Expand Down Expand Up @@ -370,6 +370,8 @@ func (v *operationList) Update() {
if v.opcache.Contains(op.Name) {
continue
}
// avoid concurrent v.a.Ops map read/write
v.a.Mutex.Lock()
if o, ok := v.a.Ops[op.Name]; !ok || o == nil {
m := op.Metadata
if m == nil {
Expand All @@ -378,6 +380,7 @@ func (v *operationList) Update() {
go getExecution(v.a, op.Name, v.a.Conn, &wg)
}
}
v.a.Mutex.Unlock()
}
wg.Wait()
v.opNames = make([]string, 0)
Expand Down
2 changes: 1 addition & 1 deletion view/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ func (v *Queue) Update() {
}
start := time.Now()
st, err := c.Status(context.Background(), &bfpb.BackplaneStatusRequest{
InstanceName: "shard",
InstanceName: v.a.Instance,
})
v.a.LastReapiLatency = time.Since(start)
if err == nil {
Expand Down
10 changes: 8 additions & 2 deletions view/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,12 +554,18 @@ func pausedStyle(p bool) ui.Style {
func (v *worker) Update() {
conn := v.a.GetWorkerConn(v.w, v.a.CA)
workerProfile := bfpb.NewWorkerProfileClient(conn)
profile, err := workerProfile.GetWorkerProfile(context.Background(), &bfpb.WorkerProfileRequest{})
profile, err := workerProfile.GetWorkerProfile(context.Background(), &bfpb.WorkerProfileRequest{
InstanceName: v.a.Instance,
WorkerName: v.w,
})
if err == nil {
v.profile = profile
}
c := bfpb.NewWorkerControlClient(conn)
r, err := c.PipelineChange(context.Background(), &bfpb.WorkerPipelineChangeRequest{})
r, err := c.PipelineChange(context.Background(), &bfpb.WorkerPipelineChangeRequest{
InstanceName: v.a.Instance,
WorkerName: v.w,
})
if err != nil {
panic(err)
}
Expand Down
Loading