From 10b339da6324b00efb3e8a7cfb95f2f3790bed7f Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Sun, 10 Mar 2024 10:43:37 +0100 Subject: [PATCH] Upgrade to the latest version of bb-{storage,remote-execution} There have been some changes to bb-storage's pkg/filesystem/path that also affect some of the path handling logic in bb-browser. --- .github/workflows/master.yaml | 10 +--------- .github/workflows/pull-requests.yaml | 10 +--------- cmd/bb_browser/browser_service.go | 18 +++++++++--------- go.mod | 6 +++--- go.sum | 5 +++++ go_dependencies.bzl | 13 ++++++------- 6 files changed, 25 insertions(+), 37 deletions(-) diff --git a/.github/workflows/master.yaml b/.github/workflows/master.yaml index f681954..1463516 100644 --- a/.github/workflows/master.yaml +++ b/.github/workflows/master.yaml @@ -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" @@ -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", diff --git a/.github/workflows/pull-requests.yaml b/.github/workflows/pull-requests.yaml index f5eaa77..d7f7409 100644 --- a/.github/workflows/pull-requests.yaml +++ b/.github/workflows/pull-requests.yaml @@ -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" @@ -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", diff --git a/cmd/bb_browser/browser_service.go b/cmd/bb_browser/browser_service.go index 64deba1..0f5473a 100644 --- a/cmd/bb_browser/browser_service.go +++ b/cmd/bb_browser/browser_service.go @@ -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) { @@ -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 @@ -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 { @@ -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 { @@ -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 == '/' }) { @@ -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( diff --git a/go.mod b/go.mod index 811d3c5..12433e2 100644 --- a/go.mod +++ b/go.mod @@ -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 @@ -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 diff --git a/go.sum b/go.sum index 391a9f0..b3692a8 100644 --- a/go.sum +++ b/go.sum @@ -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= @@ -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= diff --git a/go_dependencies.bzl b/go_dependencies.bzl index f7a56d6..c7e829f 100644 --- a/go_dependencies.bzl +++ b/go_dependencies.bzl @@ -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", @@ -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",