Skip to content
Merged
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: 2 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ load("@gazelle//:def.bzl", "gazelle")
# gazelle:resolve proto go pkg/proto/configuration/global/global.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/global
# gazelle:resolve proto pkg/proto/configuration/http/http.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/http:http_proto
# gazelle:resolve proto go pkg/proto/configuration/http/http.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/http
# gazelle:resolve proto pkg/proto/configuration/jmespath/jmespath.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/jmespath:jmespath_proto
# gazelle:resolve proto go pkg/proto/configuration/jmespath/jmespath.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/jmespath
gazelle(
name = "gazelle",
)
Expand Down
3 changes: 2 additions & 1 deletion cmd/bb_browser/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ go_library(
"@com_github_buildbarn_bb_storage//pkg/auth/configuration",
"@com_github_buildbarn_bb_storage//pkg/blobstore",
"@com_github_buildbarn_bb_storage//pkg/blobstore/configuration",
"@com_github_buildbarn_bb_storage//pkg/clock",
"@com_github_buildbarn_bb_storage//pkg/digest",
"@com_github_buildbarn_bb_storage//pkg/filesystem/path",
"@com_github_buildbarn_bb_storage//pkg/global",
"@com_github_buildbarn_bb_storage//pkg/http",
"@com_github_buildbarn_bb_storage//pkg/jmespath",
"@com_github_buildbarn_bb_storage//pkg/program",
"@com_github_buildbarn_bb_storage//pkg/proto/auth",
"@com_github_buildbarn_bb_storage//pkg/proto/fsac",
Expand All @@ -52,7 +54,6 @@ go_library(
"@com_github_buildkite_terminal_to_html//:terminal-to-html",
"@com_github_dustin_go_humanize//:go-humanize",
"@com_github_gorilla_mux//:mux",
"@com_github_jmespath_go_jmespath//:go-jmespath",
"@com_github_kballard_go_shellquote//:go-shellquote",
"@org_golang_google_grpc//codes",
"@org_golang_google_grpc//metadata",
Expand Down
11 changes: 8 additions & 3 deletions cmd/bb_browser/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@ import (
auth_configuration "github.com/buildbarn/bb-storage/pkg/auth/configuration"
"github.com/buildbarn/bb-storage/pkg/blobstore"
blobstore_configuration "github.com/buildbarn/bb-storage/pkg/blobstore/configuration"
"github.com/buildbarn/bb-storage/pkg/clock"
"github.com/buildbarn/bb-storage/pkg/digest"
"github.com/buildbarn/bb-storage/pkg/global"
"github.com/buildbarn/bb-storage/pkg/http"
"github.com/buildbarn/bb-storage/pkg/jmespath"
"github.com/buildbarn/bb-storage/pkg/program"
auth_pb "github.com/buildbarn/bb-storage/pkg/proto/auth"
"github.com/buildbarn/bb-storage/pkg/proto/iscc"
"github.com/buildbarn/bb-storage/pkg/util"
"github.com/dustin/go-humanize"
"github.com/gorilla/mux"
"github.com/jmespath/go-jmespath"
"github.com/kballard/go-shellquote"

"google.golang.org/grpc/codes"
Expand Down Expand Up @@ -131,7 +132,11 @@ func main() {
routePrefix += "/"
}

requestMetadataLinksJmespathExpression, err := jmespath.Compile(configuration.RequestMetadataLinksJmespathExpression)
requestMetadataLinksJmespathExpression, err := jmespath.NewExpressionFromConfiguration(
configuration.RequestMetadataLinksJmespathExpression,
dependenciesGroup,
clock.SystemClock,
)
if err != nil {
return util.StatusWrap(err, "Failed to compile request metadata links JMESPath expression")
}
Expand Down Expand Up @@ -159,7 +164,7 @@ func main() {
if err != nil {
return nil, util.StatusWrap(err, "Failed to marshal request metadata")
}
var rawRequestMetadata any
var rawRequestMetadata map[string]any
if err := json.Unmarshal(marshaledRequestMetadata, &rawRequestMetadata); err != nil {
return nil, util.StatusWrap(err, "Failed to unmarshal request metadata")
}
Expand Down
2 changes: 1 addition & 1 deletion config/browser.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
authorizer: {
allow: {},
},
requestMetadataLinksJmespathExpression: '`{}`',
requestMetadataLinksJmespathExpression: { expression: '`{}`' },
}
2 changes: 2 additions & 0 deletions pkg/proto/configuration/bb_browser/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ proto_library(
"@com_github_buildbarn_bb_storage//pkg/proto/configuration/blobstore:blobstore_proto",
"@com_github_buildbarn_bb_storage//pkg/proto/configuration/global:global_proto",
"@com_github_buildbarn_bb_storage//pkg/proto/configuration/http:http_proto",
"@com_github_buildbarn_bb_storage//pkg/proto/configuration/jmespath:jmespath_proto",
],
)

Expand All @@ -24,6 +25,7 @@ go_proto_library(
"@com_github_buildbarn_bb_storage//pkg/proto/configuration/blobstore",
"@com_github_buildbarn_bb_storage//pkg/proto/configuration/global",
"@com_github_buildbarn_bb_storage//pkg/proto/configuration/http",
"@com_github_buildbarn_bb_storage//pkg/proto/configuration/jmespath",
],
)

Expand Down
25 changes: 14 additions & 11 deletions pkg/proto/configuration/bb_browser/bb_browser.pb.go

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

4 changes: 3 additions & 1 deletion pkg/proto/configuration/bb_browser/bb_browser.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import "pkg/proto/configuration/auth/auth.proto";
import "pkg/proto/configuration/blobstore/blobstore.proto";
import "pkg/proto/configuration/global/global.proto";
import "pkg/proto/configuration/http/http.proto";
import "pkg/proto/configuration/jmespath/jmespath.proto";

option go_package = "github.com/buildbarn/bb-browser/pkg/proto/configuration/bb_browser";

Expand Down Expand Up @@ -87,5 +88,6 @@ message ApplicationConfiguration {
//
// If no links to external services need to be provided, you may use
// expression `{}` (including the backticks).
string request_metadata_links_jmespath_expression = 11;
buildbarn.configuration.jmespath.Expression
request_metadata_links_jmespath_expression = 11;
}