Skip to content

Commit

Permalink
Upgrade to the latest version of bb-{storage,remote-execution}
Browse files Browse the repository at this point in the history
There have been some changes to bb-storage's pkg/filesystem/path that
also affect some of the path handling logic in bb-browser.
  • Loading branch information
EdSchouten committed Mar 10, 2024
1 parent ab65d55 commit 10b339d
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 37 deletions.
10 changes: 1 addition & 9 deletions .github/workflows/master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@
"name": "Check out source code",
"uses": "actions/checkout@v1"
},
{
"name": "Restore Bazel cache",
"uses": "actions/cache@v1",
"with": {
"key": "bazel",
"path": "~/.cache/bazel"
}
},
{
"name": "Gazelle",
"run": "bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro go_dependencies.bzl%go_dependencies -prune && bazel run //:gazelle"
Expand All @@ -41,7 +33,7 @@
},
{
"name": "Protobuf generation",
"run": "find . bazel-bin/pkg/proto -name '*.pb.go' -delete || true\nbazel build $(bazel query 'kind(\"go_proto_library\", //...)')\nfind bazel-bin/pkg/proto -name '*.pb.go' | while read f; do\n cat $f > $(echo $f | sed -e 's|.*/pkg/proto/|pkg/proto/|')\ndone\n"
"run": "find . bazel-bin/pkg/proto -name '*.pb.go' -delete || true\nbazel build $(bazel query --output=label 'kind(\"go_proto_library\", //...)')\nfind bazel-bin/pkg/proto -name '*.pb.go' | while read f; do\n cat $f > $(echo $f | sed -e 's|.*/pkg/proto/|pkg/proto/|')\ndone\n"
},
{
"name": "Embedded asset generation",
Expand Down
10 changes: 1 addition & 9 deletions .github/workflows/pull-requests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@
"name": "Check out source code",
"uses": "actions/checkout@v1"
},
{
"name": "Restore Bazel cache",
"uses": "actions/cache@v1",
"with": {
"key": "bazel",
"path": "~/.cache/bazel"
}
},
{
"name": "Gazelle",
"run": "bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro go_dependencies.bzl%go_dependencies -prune && bazel run //:gazelle"
Expand All @@ -41,7 +33,7 @@
},
{
"name": "Protobuf generation",
"run": "find . bazel-bin/pkg/proto -name '*.pb.go' -delete || true\nbazel build $(bazel query 'kind(\"go_proto_library\", //...)')\nfind bazel-bin/pkg/proto -name '*.pb.go' | while read f; do\n cat $f > $(echo $f | sed -e 's|.*/pkg/proto/|pkg/proto/|')\ndone\n"
"run": "find . bazel-bin/pkg/proto -name '*.pb.go' -delete || true\nbazel build $(bazel query --output=label 'kind(\"go_proto_library\", //...)')\nfind bazel-bin/pkg/proto -name '*.pb.go' | while read f; do\n cat $f > $(echo $f | sed -e 's|.*/pkg/proto/|pkg/proto/|')\ndone\n"
},
{
"name": "Embedded asset generation",
Expand Down
18 changes: 9 additions & 9 deletions cmd/bb_browser/browser_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func (s *BrowserService) getBBClientdBlobPath(blobDigest digest.Digest, blobType
// pasted into a shell. It assumes that bb_clientd's FUSE file system is
// mounted at ~/bb_clientd, the default.
func formatBBClientdPath(p *path.Trace) string {
return "~/bb_clientd/cas/" + shellquote.Join(p.String())
return "~/bb_clientd/cas/" + shellquote.Join(p.GetUNIXString())
}

func (s *BrowserService) handleWelcome(w http.ResponseWriter, req *http.Request) {
Expand Down Expand Up @@ -548,13 +548,13 @@ func (s *BrowserService) generateTarballDirectory(ctx context.Context, w *tar.Wr
for _, directoryNode := range directory.Directories {
childName, ok := path.NewComponent(directoryNode.Name)
if !ok {
return status.Errorf(codes.InvalidArgument, "Directory %#v in directory %#v has an invalid name", directoryNode.Name, directoryPath.String())
return status.Errorf(codes.InvalidArgument, "Directory %#v in directory %#v has an invalid name", directoryNode.Name, directoryPath.GetUNIXString())
}
childPath := directoryPath.Append(childName)

if err := w.WriteHeader(&tar.Header{
Typeflag: tar.TypeDir,
Name: childPath.String(),
Name: childPath.GetUNIXString(),
Mode: 0o777,
}); err != nil {
return err
Expand All @@ -576,13 +576,13 @@ func (s *BrowserService) generateTarballDirectory(ctx context.Context, w *tar.Wr
for _, symlinkNode := range directory.Symlinks {
childName, ok := path.NewComponent(symlinkNode.Name)
if !ok {
return status.Errorf(codes.InvalidArgument, "Symbolic link %#v in directory %#v has an invalid name", symlinkNode.Name, directoryPath.String())
return status.Errorf(codes.InvalidArgument, "Symbolic link %#v in directory %#v has an invalid name", symlinkNode.Name, directoryPath.GetUNIXString())
}
childPath := directoryPath.Append(childName)

if err := w.WriteHeader(&tar.Header{
Typeflag: tar.TypeSymlink,
Name: childPath.String(),
Name: childPath.GetUNIXString(),
Linkname: symlinkNode.Target,
Mode: 0o777,
}); err != nil {
Expand All @@ -594,10 +594,10 @@ func (s *BrowserService) generateTarballDirectory(ctx context.Context, w *tar.Wr
for _, fileNode := range directory.Files {
childName, ok := path.NewComponent(fileNode.Name)
if !ok {
return status.Errorf(codes.InvalidArgument, "File %#v in directory %#v has an invalid name", fileNode.Name, directoryPath.String())
return status.Errorf(codes.InvalidArgument, "File %#v in directory %#v has an invalid name", fileNode.Name, directoryPath.GetUNIXString())
}
childPath := directoryPath.Append(childName)
childPathString := childPath.String()
childPathString := childPath.GetUNIXString()

childDigest, err := digestFunction.NewDigestFromProto(fileNode.Digest)
if err != nil {
Expand Down Expand Up @@ -967,7 +967,7 @@ func (s *BrowserService) handleTree(w http.ResponseWriter, req *http.Request) {
bbClientdPath := s.getBBClientdBlobPath(treeDigest, treeDirectoryComponent)
directoryDigest := treeDigest
rootDirectory, scopeWalker := path.EmptyBuilder.Join(path.VoidScopeWalker)
rootDirectoryWalker, _ := scopeWalker.OnScope(false)
rootDirectoryWalker, _ := scopeWalker.OnRelative()
for _, component := range strings.FieldsFunc(
mux.Vars(req)["subdirectory"],
func(r rune) bool { return r == '/' }) {
Expand Down Expand Up @@ -1008,7 +1008,7 @@ func (s *BrowserService) handleTree(w http.ResponseWriter, req *http.Request) {
treeInfo.Directory = childDirectory
}
treeInfo.BBClientdPath = formatBBClientdPath(bbClientdPath)
treeInfo.RootDirectory = rootDirectory.String()
treeInfo.RootDirectory = rootDirectory.GetUNIXString()

if req.URL.Query().Get("format") == "tar" {
s.generateTarball(
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ replace github.com/grpc-ecosystem/grpc-gateway/v2 => github.com/grpc-ecosystem/g

require (
github.com/bazelbuild/remote-apis v0.0.0-20240215191509-9ff14cecffe5
github.com/buildbarn/bb-remote-execution v0.0.0-20240222085313-f5b199467dd6
github.com/buildbarn/bb-storage v0.0.0-20240227100204-0aa40dfdbead
github.com/buildbarn/bb-remote-execution v0.0.0-20240310090416-28dbdbb0a6b0
github.com/buildbarn/bb-storage v0.0.0-20240310075825-20598f43e294
github.com/buildkite/terminal-to-html v3.2.0+incompatible
github.com/dustin/go-humanize v1.0.1
github.com/gorilla/mux v1.8.1
Expand Down Expand Up @@ -95,7 +95,7 @@ require (
golang.org/x/net v0.20.0 // indirect
golang.org/x/oauth2 v0.16.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/api v0.162.0 // indirect
Expand Down
5 changes: 5 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/buildbarn/bb-remote-execution v0.0.0-20240222085313-f5b199467dd6 h1:dgXMsgYgc48Sxb8gcrd+C2ze8Rtn1UvaDMxrUGti50g=
github.com/buildbarn/bb-remote-execution v0.0.0-20240222085313-f5b199467dd6/go.mod h1:qwNvc1PxPWzRzcKiQ/Hq1MQmxB8fjWQ+Lv0h9r8aysU=
github.com/buildbarn/bb-remote-execution v0.0.0-20240310090416-28dbdbb0a6b0 h1:wcGel3yU3FAENqRLzgZkg7xzuwlaY9H+Lphd46u5tyI=
github.com/buildbarn/bb-remote-execution v0.0.0-20240310090416-28dbdbb0a6b0/go.mod h1:q3TGK8PD/HoADYpaOU0lup48IOusUuCoP0ilLi+BX7A=
github.com/buildbarn/bb-storage v0.0.0-20240227100204-0aa40dfdbead h1:fHapKnQQLgJaMxGiBAUCPVHNfD5vV1LDfXqmyClJ6Lc=
github.com/buildbarn/bb-storage v0.0.0-20240227100204-0aa40dfdbead/go.mod h1:gHT0PInDFOV/JZjeeNwvqmn33MKHHyk3V18e4/Cs/jM=
github.com/buildbarn/bb-storage v0.0.0-20240310075825-20598f43e294 h1:Gs3nP150dcZ7Utk7OrYPpoV9/7oGZ9y1It0BGPonDnk=
github.com/buildbarn/bb-storage v0.0.0-20240310075825-20598f43e294/go.mod h1:0uISGKJD6Owt29w2sUlK0TeLtYdLWtBiC43yVHdgMAY=
github.com/buildkite/terminal-to-html v3.2.0+incompatible h1:WdXzl7ZmYzCAz4pElZosPaUlRTW+qwVx/SkQSCa1jXs=
github.com/buildkite/terminal-to-html v3.2.0+incompatible/go.mod h1:BFFdFecOxCgjdcarqI+8izs6v85CU/1RA/4Bqh4GR7E=
github.com/campoy/embedmd v1.0.0 h1:V4kI2qTJJLf4J29RzI/MAt2c3Bl4dQSYPuflzwFH2hY=
Expand Down Expand Up @@ -298,6 +302,7 @@ golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
Expand Down
13 changes: 6 additions & 7 deletions go_dependencies.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,14 @@ def go_dependencies():
go_repository(
name = "com_github_buildbarn_bb_remote_execution",
importpath = "github.com/buildbarn/bb-remote-execution",
sum = "h1:dgXMsgYgc48Sxb8gcrd+C2ze8Rtn1UvaDMxrUGti50g=",
version = "v0.0.0-20240222085313-f5b199467dd6",
sum = "h1:wcGel3yU3FAENqRLzgZkg7xzuwlaY9H+Lphd46u5tyI=",
version = "v0.0.0-20240310090416-28dbdbb0a6b0",
)
go_repository(
name = "com_github_buildbarn_bb_storage",
importpath = "github.com/buildbarn/bb-storage",
sum = "h1:fHapKnQQLgJaMxGiBAUCPVHNfD5vV1LDfXqmyClJ6Lc=",
version = "v0.0.0-20240227100204-0aa40dfdbead",
sum = "h1:Gs3nP150dcZ7Utk7OrYPpoV9/7oGZ9y1It0BGPonDnk=",
version = "v0.0.0-20240310075825-20598f43e294",
)
go_repository(
name = "com_github_buildbarn_go_xdr",
Expand Down Expand Up @@ -1715,9 +1715,8 @@ def go_dependencies():
go_repository(
name = "org_golang_x_sys",
importpath = "golang.org/x/sys",
patches = ["@com_github_buildbarn_bb_storage//:patches/org_golang_x_sys/golang-issue-59357.diff"],
sum = "h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=",
version = "v0.17.0",
sum = "h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=",
version = "v0.18.0",
)
go_repository(
name = "org_golang_x_term",
Expand Down

0 comments on commit 10b339d

Please sign in to comment.