diff --git a/BUILD.bazel b/BUILD.bazel index 647896b6..f217e569 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -7,6 +7,8 @@ load("@gazelle//:def.bzl", "gazelle") # gazelle:exclude .claude # Resolve protobuf import ambiguities - use the actual protopb packages, not the proto aliases +# gazelle:resolve go github.com/uber/submitqueue/api/base/change/protopb //api/base/change/protopb +# gazelle:resolve go github.com/uber/submitqueue/api/base/mergestrategy/protopb //api/base/mergestrategy/protopb # gazelle:resolve go github.com/uber/submitqueue/api/submitqueue/gateway/protopb //api/submitqueue/gateway/protopb # gazelle:resolve go github.com/uber/submitqueue/api/submitqueue/orchestrator/protopb //api/submitqueue/orchestrator/protopb # gazelle:resolve go github.com/uber/submitqueue/api/stovepipe/gateway/protopb //api/stovepipe/gateway/protopb diff --git a/MODULE.bazel b/MODULE.bazel index d8c657fa..61bdeb2a 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -5,6 +5,12 @@ bazel_dep(name = "rules_go", version = "0.57.0") bazel_dep(name = "gazelle", version = "0.45.0") bazel_dep(name = "rules_proto", version = "7.1.0") +# Direct dep so the well-known type proto_library targets (e.g. +# @protobuf//:descriptor_proto, needed by the message queue topics option that +# extends google.protobuf.MessageOptions) are visible by apparent name. +# Toolchain resolution is unaffected: toolchains_protoc is registered first. +bazel_dep(name = "protobuf", version = "29.1") + # Use a prebuilt protoc binary instead of compiling protoc (and its abseil/upb # dependencies) from source on every cold build. Requires # --incompatible_enable_proto_toolchain_resolution (set in .bazelrc). diff --git a/Makefile b/Makefile index a1b413ef..49c110bf 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ GOIMPORTS_VERSION ?= v0.33.0 # (the out_dir convention in tool/proto/BUILD.bazel) and copied back here. A # package may hold multiple .proto files (e.g. an RPC contract plus messagequeue # contracts); all generated stubs land in the same protopb/ dir. -PROTO_PACKAGES = api/submitqueue/gateway api/submitqueue/orchestrator api/stovepipe/gateway api/stovepipe/orchestrator +PROTO_PACKAGES = api/base/change api/base/mergestrategy api/base/messagequeue api/submitqueue/gateway api/submitqueue/orchestrator api/stovepipe/gateway api/stovepipe/orchestrator # Set REPO_ROOT for docker-compose export REPO_ROOT := $(shell pwd) @@ -346,8 +346,10 @@ proto: ## Generate protobuf files from .proto definitions @$(BAZEL) build //tool/proto:generated @set -e; for pkg in $(PROTO_PACKAGES); do \ out=$$(echo $$pkg | tr / _); \ + mkdir -p $$pkg/protopb; \ for f in bazel-bin/tool/proto/$$out/*.go; do \ cp -f $$f $$pkg/protopb/$$(basename $$f); \ + chmod 0644 $$pkg/protopb/$$(basename $$f); \ done; \ done @$(BAZEL) run @rules_go//go -- run golang.org/x/tools/cmd/goimports@$(GOIMPORTS_VERSION) -w $(addsuffix /protopb,$(PROTO_PACKAGES)) diff --git a/api/base/change/proto/BUILD.bazel b/api/base/change/proto/BUILD.bazel new file mode 100644 index 00000000..972f2c7c --- /dev/null +++ b/api/base/change/proto/BUILD.bazel @@ -0,0 +1,40 @@ +load("@rules_go//go:def.bzl", "go_library") +load("@rules_go//proto:def.bzl", "go_proto_library") +load("@rules_proto//proto:defs.bzl", "proto_library") + +exports_files( + ["change.proto"], + visibility = ["//tool/proto:__pkg__"], +) + +proto_library( + name = "changepb_proto", + srcs = ["change.proto"], + visibility = ["//visibility:public"], +) + +# keep +go_proto_library( + name = "changepb_go_proto", + compilers = [ + "@rules_go//proto:go_proto", + "@rules_go//proto:go_grpc_v2", + ], + importpath = "github.com/uber/submitqueue/api/base/change/proto", + proto = ":changepb_proto", + visibility = ["//visibility:public"], +) + +go_library( + name = "proto", + embed = [":changepb_go_proto"], + importpath = "github.com/uber/submitqueue/api/base/change/proto", + visibility = ["//visibility:public"], +) + +go_library( + name = "protopb", + embed = [":changepb_go_proto"], + importpath = "github.com/uber/submitqueue/api/base/change/protopb", + visibility = ["//visibility:public"], +) diff --git a/api/base/change/proto/change.proto b/api/base/change/proto/change.proto new file mode 100644 index 00000000..a86a58f1 --- /dev/null +++ b/api/base/change/proto/change.proto @@ -0,0 +1,44 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package uber.base.change; + +option go_package = "github.com/uber/submitqueue/api/base/change/protopb"; +option java_multiple_files = true; +option java_outer_classname = "ChangeProto"; +option java_package = "com.uber.submitqueue.base.change"; + +// Change represents a code change identified by URIs from a code change provider +// (e.g. a GitHub Pull Request, a Phabricator Diff, or a git commit). The provider +// is extracted from the URI scheme. +// +// This is the shared wire contract for change identity, reused across SubmitQueue, +// Stovepipe, and other repo-local domains — the proto-level analog of the +// platform/base/change Go entity. Domains import it rather than redefining their own. +message Change { + // URIs identifying the change(s) (RFC 3986 compliant). The scheme identifies the + // change provider, and the path contains provider-specific resource identifiers. + // + // Supported by default (other providers can be added): + // GitHub PR: "github:////pull//" + // ("ghe"/"ghes" schemes for GitHub Enterprise) + // git commit: "git://///" + // ( is a fully-qualified, percent-encoded git ref) + // + // The commit SHA must be the full 40-character lowercase hex SHA; abbreviated + // SHAs are rejected because downstream staleness checks compare by strict equality. + repeated string uris = 1; +} diff --git a/api/base/change/protopb/BUILD.bazel b/api/base/change/protopb/BUILD.bazel new file mode 100644 index 00000000..716303de --- /dev/null +++ b/api/base/change/protopb/BUILD.bazel @@ -0,0 +1,12 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "protopb", + srcs = ["change.pb.go"], + importpath = "github.com/uber/submitqueue/api/base/change/protopb", + visibility = ["//visibility:public"], + deps = [ + "@org_golang_google_protobuf//reflect/protoreflect", + "@org_golang_google_protobuf//runtime/protoimpl", + ], +) diff --git a/api/base/change/protopb/change.pb.go b/api/base/change/protopb/change.pb.go new file mode 100644 index 00000000..28416150 --- /dev/null +++ b/api/base/change/protopb/change.pb.go @@ -0,0 +1,157 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v5.29.3 +// source: change.proto + +package protopb + +import ( + reflect "reflect" + sync "sync" + unsafe "unsafe" + + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Change represents a code change identified by URIs from a code change provider +// (e.g. a GitHub Pull Request, a Phabricator Diff, or a git commit). The provider +// is extracted from the URI scheme. +// +// This is the shared wire contract for change identity, reused across SubmitQueue, +// Stovepipe, and other repo-local domains — the proto-level analog of the +// platform/base/change Go entity. Domains import it rather than redefining their own. +type Change struct { + state protoimpl.MessageState `protogen:"open.v1"` + // URIs identifying the change(s) (RFC 3986 compliant). The scheme identifies the + // change provider, and the path contains provider-specific resource identifiers. + // + // Supported by default (other providers can be added): + // + // GitHub PR: "github:////pull//" + // ("ghe"/"ghes" schemes for GitHub Enterprise) + // git commit: "git://///" + // ( is a fully-qualified, percent-encoded git ref) + // + // The commit SHA must be the full 40-character lowercase hex SHA; abbreviated + // SHAs are rejected because downstream staleness checks compare by strict equality. + Uris []string `protobuf:"bytes,1,rep,name=uris,proto3" json:"uris,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Change) Reset() { + *x = Change{} + mi := &file_change_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Change) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Change) ProtoMessage() {} + +func (x *Change) ProtoReflect() protoreflect.Message { + mi := &file_change_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Change.ProtoReflect.Descriptor instead. +func (*Change) Descriptor() ([]byte, []int) { + return file_change_proto_rawDescGZIP(), []int{0} +} + +func (x *Change) GetUris() []string { + if x != nil { + return x.Uris + } + return nil +} + +var File_change_proto protoreflect.FileDescriptor + +const file_change_proto_rawDesc = "" + + "\n" + + "\fchange.proto\x12\x10uber.base.change\"\x1c\n" + + "\x06Change\x12\x12\n" + + "\x04uris\x18\x01 \x03(\tR\x04urisBf\n" + + " com.uber.submitqueue.base.changeB\vChangeProtoP\x01Z3github.com/uber/submitqueue/api/base/change/protopbb\x06proto3" + +var ( + file_change_proto_rawDescOnce sync.Once + file_change_proto_rawDescData []byte +) + +func file_change_proto_rawDescGZIP() []byte { + file_change_proto_rawDescOnce.Do(func() { + file_change_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_change_proto_rawDesc), len(file_change_proto_rawDesc))) + }) + return file_change_proto_rawDescData +} + +var file_change_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_change_proto_goTypes = []any{ + (*Change)(nil), // 0: uber.base.change.Change +} +var file_change_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_change_proto_init() } +func file_change_proto_init() { + if File_change_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_change_proto_rawDesc), len(file_change_proto_rawDesc)), + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_change_proto_goTypes, + DependencyIndexes: file_change_proto_depIdxs, + MessageInfos: file_change_proto_msgTypes, + }.Build() + File_change_proto = out.File + file_change_proto_goTypes = nil + file_change_proto_depIdxs = nil +} diff --git a/api/base/mergestrategy/proto/BUILD.bazel b/api/base/mergestrategy/proto/BUILD.bazel new file mode 100644 index 00000000..cedde92c --- /dev/null +++ b/api/base/mergestrategy/proto/BUILD.bazel @@ -0,0 +1,40 @@ +load("@rules_go//go:def.bzl", "go_library") +load("@rules_go//proto:def.bzl", "go_proto_library") +load("@rules_proto//proto:defs.bzl", "proto_library") + +exports_files( + ["mergestrategy.proto"], + visibility = ["//tool/proto:__pkg__"], +) + +proto_library( + name = "mergestrategypb_proto", + srcs = ["mergestrategy.proto"], + visibility = ["//visibility:public"], +) + +# keep +go_proto_library( + name = "mergestrategypb_go_proto", + compilers = [ + "@rules_go//proto:go_proto", + "@rules_go//proto:go_grpc_v2", + ], + importpath = "github.com/uber/submitqueue/api/base/mergestrategy/proto", + proto = ":mergestrategypb_proto", + visibility = ["//visibility:public"], +) + +go_library( + name = "proto", + embed = [":mergestrategypb_go_proto"], + importpath = "github.com/uber/submitqueue/api/base/mergestrategy/proto", + visibility = ["//visibility:public"], +) + +go_library( + name = "protopb", + embed = [":mergestrategypb_go_proto"], + importpath = "github.com/uber/submitqueue/api/base/mergestrategy/protopb", + visibility = ["//visibility:public"], +) diff --git a/api/base/mergestrategy/proto/mergestrategy.proto b/api/base/mergestrategy/proto/mergestrategy.proto new file mode 100644 index 00000000..0769ba9d --- /dev/null +++ b/api/base/mergestrategy/proto/mergestrategy.proto @@ -0,0 +1,39 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package uber.base.mergestrategy; + +option go_package = "github.com/uber/submitqueue/api/base/mergestrategy/protopb"; +option java_multiple_files = true; +option java_outer_classname = "MergeStrategyProto"; +option java_package = "com.uber.submitqueue.base.mergestrategy"; + +// Strategy defines the possible source control integration methods — how a change +// is integrated into the target branch. +// +// This is the shared wire contract for merge strategy, reused across SubmitQueue +// and other repo-local domains — the proto-level analog of the +// platform/base/mergestrategy Go entity. Domains import it rather than redefining their own. +enum Strategy { + // Default strategy (let the server decide based on configuration). + DEFAULT = 0; + // Rebase commits onto the target branch before landing. + REBASE = 1; + // Same as REBASE but squash commits into a single commit before rebase. + SQUASH_REBASE = 2; + // Merge commits into the target branch by creating a separate merge commit, preserving commit history along with hashes. + MERGE = 3; +} diff --git a/api/base/mergestrategy/protopb/BUILD.bazel b/api/base/mergestrategy/protopb/BUILD.bazel new file mode 100644 index 00000000..7340c8c2 --- /dev/null +++ b/api/base/mergestrategy/protopb/BUILD.bazel @@ -0,0 +1,12 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "protopb", + srcs = ["mergestrategy.pb.go"], + importpath = "github.com/uber/submitqueue/api/base/mergestrategy/protopb", + visibility = ["//visibility:public"], + deps = [ + "@org_golang_google_protobuf//reflect/protoreflect", + "@org_golang_google_protobuf//runtime/protoimpl", + ], +) diff --git a/api/base/mergestrategy/protopb/mergestrategy.pb.go b/api/base/mergestrategy/protopb/mergestrategy.pb.go new file mode 100644 index 00000000..7546b555 --- /dev/null +++ b/api/base/mergestrategy/protopb/mergestrategy.pb.go @@ -0,0 +1,160 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v5.29.3 +// source: mergestrategy.proto + +package protopb + +import ( + reflect "reflect" + sync "sync" + unsafe "unsafe" + + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Strategy defines the possible source control integration methods — how a change +// is integrated into the target branch. +// +// This is the shared wire contract for merge strategy, reused across SubmitQueue +// and other repo-local domains — the proto-level analog of the +// platform/base/mergestrategy Go entity. Domains import it rather than redefining their own. +type Strategy int32 + +const ( + // Default strategy (let the server decide based on configuration). + Strategy_DEFAULT Strategy = 0 + // Rebase commits onto the target branch before landing. + Strategy_REBASE Strategy = 1 + // Same as REBASE but squash commits into a single commit before rebase. + Strategy_SQUASH_REBASE Strategy = 2 + // Merge commits into the target branch by creating a separate merge commit, preserving commit history along with hashes. + Strategy_MERGE Strategy = 3 +) + +// Enum value maps for Strategy. +var ( + Strategy_name = map[int32]string{ + 0: "DEFAULT", + 1: "REBASE", + 2: "SQUASH_REBASE", + 3: "MERGE", + } + Strategy_value = map[string]int32{ + "DEFAULT": 0, + "REBASE": 1, + "SQUASH_REBASE": 2, + "MERGE": 3, + } +) + +func (x Strategy) Enum() *Strategy { + p := new(Strategy) + *p = x + return p +} + +func (x Strategy) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Strategy) Descriptor() protoreflect.EnumDescriptor { + return file_mergestrategy_proto_enumTypes[0].Descriptor() +} + +func (Strategy) Type() protoreflect.EnumType { + return &file_mergestrategy_proto_enumTypes[0] +} + +func (x Strategy) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Strategy.Descriptor instead. +func (Strategy) EnumDescriptor() ([]byte, []int) { + return file_mergestrategy_proto_rawDescGZIP(), []int{0} +} + +var File_mergestrategy_proto protoreflect.FileDescriptor + +const file_mergestrategy_proto_rawDesc = "" + + "\n" + + "\x13mergestrategy.proto\x12\x17uber.base.mergestrategy*A\n" + + "\bStrategy\x12\v\n" + + "\aDEFAULT\x10\x00\x12\n" + + "\n" + + "\x06REBASE\x10\x01\x12\x11\n" + + "\rSQUASH_REBASE\x10\x02\x12\t\n" + + "\x05MERGE\x10\x03B{\n" + + "'com.uber.submitqueue.base.mergestrategyB\x12MergeStrategyProtoP\x01Z:github.com/uber/submitqueue/api/base/mergestrategy/protopbb\x06proto3" + +var ( + file_mergestrategy_proto_rawDescOnce sync.Once + file_mergestrategy_proto_rawDescData []byte +) + +func file_mergestrategy_proto_rawDescGZIP() []byte { + file_mergestrategy_proto_rawDescOnce.Do(func() { + file_mergestrategy_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_mergestrategy_proto_rawDesc), len(file_mergestrategy_proto_rawDesc))) + }) + return file_mergestrategy_proto_rawDescData +} + +var file_mergestrategy_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_mergestrategy_proto_goTypes = []any{ + (Strategy)(0), // 0: uber.base.mergestrategy.Strategy +} +var file_mergestrategy_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_mergestrategy_proto_init() } +func file_mergestrategy_proto_init() { + if File_mergestrategy_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_mergestrategy_proto_rawDesc), len(file_mergestrategy_proto_rawDesc)), + NumEnums: 1, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_mergestrategy_proto_goTypes, + DependencyIndexes: file_mergestrategy_proto_depIdxs, + EnumInfos: file_mergestrategy_proto_enumTypes, + }.Build() + File_mergestrategy_proto = out.File + file_mergestrategy_proto_goTypes = nil + file_mergestrategy_proto_depIdxs = nil +} diff --git a/api/base/messagequeue/proto/BUILD.bazel b/api/base/messagequeue/proto/BUILD.bazel new file mode 100644 index 00000000..09d957d3 --- /dev/null +++ b/api/base/messagequeue/proto/BUILD.bazel @@ -0,0 +1,41 @@ +load("@rules_go//go:def.bzl", "go_library") +load("@rules_go//proto:def.bzl", "go_proto_library") +load("@rules_proto//proto:defs.bzl", "proto_library") + +exports_files( + ["messagequeue.proto"], + visibility = ["//tool/proto:__pkg__"], +) + +proto_library( + name = "messagequeuepb_proto", + srcs = ["messagequeue.proto"], + visibility = ["//visibility:public"], + deps = ["@protobuf//:descriptor_proto"], +) + +# keep +go_proto_library( + name = "messagequeuepb_go_proto", + compilers = [ + "@rules_go//proto:go_proto", + "@rules_go//proto:go_grpc_v2", + ], + importpath = "github.com/uber/submitqueue/api/base/messagequeue/proto", + proto = ":messagequeuepb_proto", + visibility = ["//visibility:public"], +) + +go_library( + name = "proto", + embed = [":messagequeuepb_go_proto"], + importpath = "github.com/uber/submitqueue/api/base/messagequeue/proto", + visibility = ["//visibility:public"], +) + +go_library( + name = "protopb", + embed = [":messagequeuepb_go_proto"], + importpath = "github.com/uber/submitqueue/api/base/messagequeue/protopb", + visibility = ["//visibility:public"], +) diff --git a/api/base/messagequeue/proto/messagequeue.proto b/api/base/messagequeue/proto/messagequeue.proto new file mode 100644 index 00000000..78d2e096 --- /dev/null +++ b/api/base/messagequeue/proto/messagequeue.proto @@ -0,0 +1,40 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package uber.base.messagequeue; + +import "google/protobuf/descriptor.proto"; + +option go_package = "github.com/uber/submitqueue/api/base/messagequeue/protopb"; +option java_multiple_files = true; +option java_outer_classname = "MessageQueueProto"; +option java_package = "com.uber.submitqueue.base.messagequeue"; + +// Topic-binding option: the shared wire contract annotation that binds a queue +// payload message to the topic(s) that carry it. A message queue payload — in +// any domain — annotates itself with the canonical wire topic name(s), making +// the topic-to-payload binding part of the language-neutral proto contract +// rather than out-of-band Go wiring. A single payload may list several topics +// (one shape can serve a queue pair, e.g. a dry-run check and a committing +// merge). Domains import this rather than redefining their own. +extend google.protobuf.MessageOptions { + // topics are the canonical wire topic names that carry this message. The + // reverse index (topic -> message) is derivable; this is the single source + // of truth. The strings match the consumer.TopicKey values used in Go + // wiring. Extension field 50001 is in the 50000-99999 range reserved for + // organization-internal use. + repeated string topics = 50001; +} diff --git a/api/base/messagequeue/protopb/BUILD.bazel b/api/base/messagequeue/protopb/BUILD.bazel new file mode 100644 index 00000000..0e0e20c9 --- /dev/null +++ b/api/base/messagequeue/protopb/BUILD.bazel @@ -0,0 +1,13 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "protopb", + srcs = ["messagequeue.pb.go"], + importpath = "github.com/uber/submitqueue/api/base/messagequeue/protopb", + visibility = ["//visibility:public"], + deps = [ + "@org_golang_google_protobuf//reflect/protoreflect", + "@org_golang_google_protobuf//runtime/protoimpl", + "@org_golang_google_protobuf//types/descriptorpb", + ], +) diff --git a/api/base/messagequeue/protopb/messagequeue.pb.go b/api/base/messagequeue/protopb/messagequeue.pb.go new file mode 100644 index 00000000..ee5767f5 --- /dev/null +++ b/api/base/messagequeue/protopb/messagequeue.pb.go @@ -0,0 +1,104 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v5.29.3 +// source: messagequeue.proto + +package protopb + +import ( + reflect "reflect" + unsafe "unsafe" + + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + descriptorpb "google.golang.org/protobuf/types/descriptorpb" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +var file_messagequeue_proto_extTypes = []protoimpl.ExtensionInfo{ + { + ExtendedType: (*descriptorpb.MessageOptions)(nil), + ExtensionType: ([]string)(nil), + Field: 50001, + Name: "uber.base.messagequeue.topics", + Tag: "bytes,50001,rep,name=topics", + Filename: "messagequeue.proto", + }, +} + +// Extension fields to descriptorpb.MessageOptions. +var ( + // topics are the canonical wire topic names that carry this message. The + // reverse index (topic -> message) is derivable; this is the single source + // of truth. The strings match the consumer.TopicKey values used in Go + // wiring. Extension field 50001 is in the 50000-99999 range reserved for + // organization-internal use. + // + // repeated string topics = 50001; + E_Topics = &file_messagequeue_proto_extTypes[0] +) + +var File_messagequeue_proto protoreflect.FileDescriptor + +const file_messagequeue_proto_rawDesc = "" + + "\n" + + "\x12messagequeue.proto\x12\x16uber.base.messagequeue\x1a google/protobuf/descriptor.proto:9\n" + + "\x06topics\x12\x1f.google.protobuf.MessageOptions\x18ц\x03 \x03(\tR\x06topicsBx\n" + + "&com.uber.submitqueue.base.messagequeueB\x11MessageQueueProtoP\x01Z9github.com/uber/submitqueue/api/base/messagequeue/protopbb\x06proto3" + +var file_messagequeue_proto_goTypes = []any{ + (*descriptorpb.MessageOptions)(nil), // 0: google.protobuf.MessageOptions +} +var file_messagequeue_proto_depIdxs = []int32{ + 0, // 0: uber.base.messagequeue.topics:extendee -> google.protobuf.MessageOptions + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 0, // [0:1] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_messagequeue_proto_init() } +func file_messagequeue_proto_init() { + if File_messagequeue_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_messagequeue_proto_rawDesc), len(file_messagequeue_proto_rawDesc)), + NumEnums: 0, + NumMessages: 0, + NumExtensions: 1, + NumServices: 0, + }, + GoTypes: file_messagequeue_proto_goTypes, + DependencyIndexes: file_messagequeue_proto_depIdxs, + ExtensionInfos: file_messagequeue_proto_extTypes, + }.Build() + File_messagequeue_proto = out.File + file_messagequeue_proto_goTypes = nil + file_messagequeue_proto_depIdxs = nil +} diff --git a/api/submitqueue/gateway/proto/BUILD.bazel b/api/submitqueue/gateway/proto/BUILD.bazel index 7800da89..9ccb5a7f 100644 --- a/api/submitqueue/gateway/proto/BUILD.bazel +++ b/api/submitqueue/gateway/proto/BUILD.bazel @@ -11,6 +11,10 @@ proto_library( name = "gatewaypb_proto", srcs = ["gateway.proto"], visibility = ["//visibility:public"], + deps = [ + "//api/base/change/proto:changepb_proto", + "//api/base/mergestrategy/proto:mergestrategypb_proto", + ], ) # keep @@ -23,6 +27,11 @@ go_proto_library( importpath = "github.com/uber/submitqueue/api/submitqueue/gateway/proto", proto = ":gatewaypb_proto", visibility = ["//visibility:public"], + # keep + deps = [ + "//api/base/change/proto:changepb_go_proto", + "//api/base/mergestrategy/proto:mergestrategypb_go_proto", + ], ) go_library( diff --git a/api/submitqueue/gateway/proto/gateway.proto b/api/submitqueue/gateway/proto/gateway.proto index 3b7a0fac..244f7b43 100644 --- a/api/submitqueue/gateway/proto/gateway.proto +++ b/api/submitqueue/gateway/proto/gateway.proto @@ -21,6 +21,9 @@ option java_multiple_files = true; option java_outer_classname = "GatewayProto"; option java_package = "com.uber.submitqueue.gateway"; +import "api/base/change/proto/change.proto"; +import "api/base/mergestrategy/proto/mergestrategy.proto"; + // *************** // API domain definitions. // *************** @@ -43,47 +46,18 @@ message PingResponse { string hostname = 4; } -// Strategy defines the possible source control integration methods -enum Strategy { - // Default strategy (let server decide based on configuration) - DEFAULT = 0; - // Rebase commits onto target branch before landing - REBASE = 1; - // Same as REBASE but squash commits into a single commit before rebase - SQUASH_REBASE = 2; - // Merge commits into the target branch by creating a separate merge commit, preserving the commit history along with hashes - MERGE = 3; -} - -// Change represents a code change identified by URIs from a code change provider (e.g., GitHub Pull Request, Phabricator Diff). -// The provider is extracted from the URI scheme. -message Change { - // URIs identifying the change(s) to land (RFC 3986 compliant). - // The scheme identifies the change provider, and the path contains provider-specific resource identifiers. - // - // GitHub is supported by default (though other providers can be added): - // Template: ":////pull//" - // Example: "github://uber/submitqueue/pull/123/c3a4d5e6f7890123456789abcdef0123456789ab" - // Schemes: "github" (github.com), "ghe" (GitHub Enterprise), "ghes" (GitHub Enterprise Server). - // The path mirrors the canonical PR URL so URIs can be constructed by trivial substitution. - // The head commit SHA must be the full 40-character lowercase hex SHA of the PR's head commit, - // as returned by GitHub's API (graphql `headRefOid`). Abbreviated SHAs are rejected because - // the staleness check downstream compares with strict string equality against the full SHA. - // - // SubmitQueue guarantees changes are landed in order with no other changes in between. - // SubmitQueue does not guarantee each change is individually valid, but produces a validity marker on such changes. - // The user is responsible for including all changes in a stack in order, starting from the earliest change. - repeated string uris = 1; -} - // LandRequest defines a request to land (merge into target branch of the source control repository) a set of code changes. +// +// SubmitQueue guarantees changes are landed in order with no other changes in between. +// SubmitQueue does not guarantee each change is individually valid, but produces a validity marker on such changes. +// The user is responsible for including all changes in a stack in order, starting from the earliest change. message LandRequest { // Name of the queue processing the land request. The queue should be defined in the configuration, otherwise an error is returned. string queue = 1; // Change (such as a pull request) to land into the target branch. Target branch is defined by the queue configuration. - Change change = 2; + uber.base.change.Change change = 2; // Source control integration strategy to use for this land operation. If not specified, the default queue strategy is used. - Strategy strategy = 4; + uber.base.mergestrategy.Strategy strategy = 4; } // LandResponse defines the response to a land request. diff --git a/api/submitqueue/gateway/protopb/BUILD.bazel b/api/submitqueue/gateway/protopb/BUILD.bazel index 8431100a..1a3eb4b8 100644 --- a/api/submitqueue/gateway/protopb/BUILD.bazel +++ b/api/submitqueue/gateway/protopb/BUILD.bazel @@ -10,6 +10,8 @@ go_library( importpath = "github.com/uber/submitqueue/api/submitqueue/gateway/protopb", visibility = ["//visibility:public"], deps = [ + "//api/base/change/protopb", + "//api/base/mergestrategy/protopb", "@org_golang_google_grpc//:grpc", "@org_golang_google_grpc//codes", "@org_golang_google_grpc//status", diff --git a/api/submitqueue/gateway/protopb/gateway.pb.go b/api/submitqueue/gateway/protopb/gateway.pb.go index b4886ff6..20c020f3 100644 --- a/api/submitqueue/gateway/protopb/gateway.pb.go +++ b/api/submitqueue/gateway/protopb/gateway.pb.go @@ -25,6 +25,8 @@ import ( sync "sync" unsafe "unsafe" + protopb "github.com/uber/submitqueue/api/base/change/protopb" + protopb1 "github.com/uber/submitqueue/api/base/mergestrategy/protopb" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) @@ -36,63 +38,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// Strategy defines the possible source control integration methods -type Strategy int32 - -const ( - // Default strategy (let server decide based on configuration) - Strategy_DEFAULT Strategy = 0 - // Rebase commits onto target branch before landing - Strategy_REBASE Strategy = 1 - // Same as REBASE but squash commits into a single commit before rebase - Strategy_SQUASH_REBASE Strategy = 2 - // Merge commits into the target branch by creating a separate merge commit, preserving the commit history along with hashes - Strategy_MERGE Strategy = 3 -) - -// Enum value maps for Strategy. -var ( - Strategy_name = map[int32]string{ - 0: "DEFAULT", - 1: "REBASE", - 2: "SQUASH_REBASE", - 3: "MERGE", - } - Strategy_value = map[string]int32{ - "DEFAULT": 0, - "REBASE": 1, - "SQUASH_REBASE": 2, - "MERGE": 3, - } -) - -func (x Strategy) Enum() *Strategy { - p := new(Strategy) - *p = x - return p -} - -func (x Strategy) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Strategy) Descriptor() protoreflect.EnumDescriptor { - return file_gateway_proto_enumTypes[0].Descriptor() -} - -func (Strategy) Type() protoreflect.EnumType { - return &file_gateway_proto_enumTypes[0] -} - -func (x Strategy) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Strategy.Descriptor instead. -func (Strategy) EnumDescriptor() ([]byte, []int) { - return file_gateway_proto_rawDescGZIP(), []int{0} -} - // PingRequest is the request for the Ping method type PingRequest struct { state protoimpl.MessageState `protogen:"open.v1"` @@ -212,84 +157,26 @@ func (x *PingResponse) GetHostname() string { return "" } -// Change represents a code change identified by URIs from a code change provider (e.g., GitHub Pull Request, Phabricator Diff). -// The provider is extracted from the URI scheme. -type Change struct { - state protoimpl.MessageState `protogen:"open.v1"` - // URIs identifying the change(s) to land (RFC 3986 compliant). - // The scheme identifies the change provider, and the path contains provider-specific resource identifiers. - // - // GitHub is supported by default (though other providers can be added): - // - // Template: ":////pull//" - // Example: "github://uber/submitqueue/pull/123/c3a4d5e6f7890123456789abcdef0123456789ab" - // Schemes: "github" (github.com), "ghe" (GitHub Enterprise), "ghes" (GitHub Enterprise Server). - // The path mirrors the canonical PR URL so URIs can be constructed by trivial substitution. - // The head commit SHA must be the full 40-character lowercase hex SHA of the PR's head commit, - // as returned by GitHub's API (graphql `headRefOid`). Abbreviated SHAs are rejected because - // the staleness check downstream compares with strict string equality against the full SHA. - // - // SubmitQueue guarantees changes are landed in order with no other changes in between. - // SubmitQueue does not guarantee each change is individually valid, but produces a validity marker on such changes. - // The user is responsible for including all changes in a stack in order, starting from the earliest change. - Uris []string `protobuf:"bytes,1,rep,name=uris,proto3" json:"uris,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Change) Reset() { - *x = Change{} - mi := &file_gateway_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Change) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Change) ProtoMessage() {} - -func (x *Change) ProtoReflect() protoreflect.Message { - mi := &file_gateway_proto_msgTypes[2] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Change.ProtoReflect.Descriptor instead. -func (*Change) Descriptor() ([]byte, []int) { - return file_gateway_proto_rawDescGZIP(), []int{2} -} - -func (x *Change) GetUris() []string { - if x != nil { - return x.Uris - } - return nil -} - // LandRequest defines a request to land (merge into target branch of the source control repository) a set of code changes. +// +// SubmitQueue guarantees changes are landed in order with no other changes in between. +// SubmitQueue does not guarantee each change is individually valid, but produces a validity marker on such changes. +// The user is responsible for including all changes in a stack in order, starting from the earliest change. type LandRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // Name of the queue processing the land request. The queue should be defined in the configuration, otherwise an error is returned. Queue string `protobuf:"bytes,1,opt,name=queue,proto3" json:"queue,omitempty"` // Change (such as a pull request) to land into the target branch. Target branch is defined by the queue configuration. - Change *Change `protobuf:"bytes,2,opt,name=change,proto3" json:"change,omitempty"` + Change *protopb.Change `protobuf:"bytes,2,opt,name=change,proto3" json:"change,omitempty"` // Source control integration strategy to use for this land operation. If not specified, the default queue strategy is used. - Strategy Strategy `protobuf:"varint,4,opt,name=strategy,proto3,enum=uber.submitqueue.gateway.Strategy" json:"strategy,omitempty"` + Strategy protopb1.Strategy `protobuf:"varint,4,opt,name=strategy,proto3,enum=uber.base.mergestrategy.Strategy" json:"strategy,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *LandRequest) Reset() { *x = LandRequest{} - mi := &file_gateway_proto_msgTypes[3] + mi := &file_gateway_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -301,7 +188,7 @@ func (x *LandRequest) String() string { func (*LandRequest) ProtoMessage() {} func (x *LandRequest) ProtoReflect() protoreflect.Message { - mi := &file_gateway_proto_msgTypes[3] + mi := &file_gateway_proto_msgTypes[2] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -314,7 +201,7 @@ func (x *LandRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use LandRequest.ProtoReflect.Descriptor instead. func (*LandRequest) Descriptor() ([]byte, []int) { - return file_gateway_proto_rawDescGZIP(), []int{3} + return file_gateway_proto_rawDescGZIP(), []int{2} } func (x *LandRequest) GetQueue() string { @@ -324,18 +211,18 @@ func (x *LandRequest) GetQueue() string { return "" } -func (x *LandRequest) GetChange() *Change { +func (x *LandRequest) GetChange() *protopb.Change { if x != nil { return x.Change } return nil } -func (x *LandRequest) GetStrategy() Strategy { +func (x *LandRequest) GetStrategy() protopb1.Strategy { if x != nil { return x.Strategy } - return Strategy_DEFAULT + return protopb1.Strategy(0) } // LandResponse defines the response to a land request. @@ -349,7 +236,7 @@ type LandResponse struct { func (x *LandResponse) Reset() { *x = LandResponse{} - mi := &file_gateway_proto_msgTypes[4] + mi := &file_gateway_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -361,7 +248,7 @@ func (x *LandResponse) String() string { func (*LandResponse) ProtoMessage() {} func (x *LandResponse) ProtoReflect() protoreflect.Message { - mi := &file_gateway_proto_msgTypes[4] + mi := &file_gateway_proto_msgTypes[3] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -374,7 +261,7 @@ func (x *LandResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use LandResponse.ProtoReflect.Descriptor instead. func (*LandResponse) Descriptor() ([]byte, []int) { - return file_gateway_proto_rawDescGZIP(), []int{4} + return file_gateway_proto_rawDescGZIP(), []int{3} } func (x *LandResponse) GetSqid() string { @@ -397,7 +284,7 @@ type CancelRequest struct { func (x *CancelRequest) Reset() { *x = CancelRequest{} - mi := &file_gateway_proto_msgTypes[5] + mi := &file_gateway_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -409,7 +296,7 @@ func (x *CancelRequest) String() string { func (*CancelRequest) ProtoMessage() {} func (x *CancelRequest) ProtoReflect() protoreflect.Message { - mi := &file_gateway_proto_msgTypes[5] + mi := &file_gateway_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -422,7 +309,7 @@ func (x *CancelRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CancelRequest.ProtoReflect.Descriptor instead. func (*CancelRequest) Descriptor() ([]byte, []int) { - return file_gateway_proto_rawDescGZIP(), []int{5} + return file_gateway_proto_rawDescGZIP(), []int{4} } func (x *CancelRequest) GetSqid() string { @@ -452,7 +339,7 @@ type CancelResponse struct { func (x *CancelResponse) Reset() { *x = CancelResponse{} - mi := &file_gateway_proto_msgTypes[6] + mi := &file_gateway_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -464,7 +351,7 @@ func (x *CancelResponse) String() string { func (*CancelResponse) ProtoMessage() {} func (x *CancelResponse) ProtoReflect() protoreflect.Message { - mi := &file_gateway_proto_msgTypes[6] + mi := &file_gateway_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -477,7 +364,7 @@ func (x *CancelResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CancelResponse.ProtoReflect.Descriptor instead. func (*CancelResponse) Descriptor() ([]byte, []int) { - return file_gateway_proto_rawDescGZIP(), []int{6} + return file_gateway_proto_rawDescGZIP(), []int{5} } // StatusRequest defines a request to look up the current status of a previously submitted request. @@ -491,7 +378,7 @@ type StatusRequest struct { func (x *StatusRequest) Reset() { *x = StatusRequest{} - mi := &file_gateway_proto_msgTypes[7] + mi := &file_gateway_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -503,7 +390,7 @@ func (x *StatusRequest) String() string { func (*StatusRequest) ProtoMessage() {} func (x *StatusRequest) ProtoReflect() protoreflect.Message { - mi := &file_gateway_proto_msgTypes[7] + mi := &file_gateway_proto_msgTypes[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -516,7 +403,7 @@ func (x *StatusRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use StatusRequest.ProtoReflect.Descriptor instead. func (*StatusRequest) Descriptor() ([]byte, []int) { - return file_gateway_proto_rawDescGZIP(), []int{7} + return file_gateway_proto_rawDescGZIP(), []int{6} } func (x *StatusRequest) GetSqid() string { @@ -543,7 +430,7 @@ type StatusResponse struct { func (x *StatusResponse) Reset() { *x = StatusResponse{} - mi := &file_gateway_proto_msgTypes[8] + mi := &file_gateway_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -555,7 +442,7 @@ func (x *StatusResponse) String() string { func (*StatusResponse) ProtoMessage() {} func (x *StatusResponse) ProtoReflect() protoreflect.Message { - mi := &file_gateway_proto_msgTypes[8] + mi := &file_gateway_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -568,7 +455,7 @@ func (x *StatusResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use StatusResponse.ProtoReflect.Descriptor instead. func (*StatusResponse) Descriptor() ([]byte, []int) { - return file_gateway_proto_rawDescGZIP(), []int{8} + return file_gateway_proto_rawDescGZIP(), []int{7} } func (x *StatusResponse) GetStatus() string { @@ -603,7 +490,7 @@ type Error struct { func (x *Error) Reset() { *x = Error{} - mi := &file_gateway_proto_msgTypes[9] + mi := &file_gateway_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -615,7 +502,7 @@ func (x *Error) String() string { func (*Error) ProtoMessage() {} func (x *Error) ProtoReflect() protoreflect.Message { - mi := &file_gateway_proto_msgTypes[9] + mi := &file_gateway_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -628,7 +515,7 @@ func (x *Error) ProtoReflect() protoreflect.Message { // Deprecated: Use Error.ProtoReflect.Descriptor instead. func (*Error) Descriptor() ([]byte, []int) { - return file_gateway_proto_rawDescGZIP(), []int{9} + return file_gateway_proto_rawDescGZIP(), []int{8} } func (x *Error) GetMessage() string { @@ -651,7 +538,7 @@ type UnrecognizedQueueError struct { func (x *UnrecognizedQueueError) Reset() { *x = UnrecognizedQueueError{} - mi := &file_gateway_proto_msgTypes[10] + mi := &file_gateway_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -663,7 +550,7 @@ func (x *UnrecognizedQueueError) String() string { func (*UnrecognizedQueueError) ProtoMessage() {} func (x *UnrecognizedQueueError) ProtoReflect() protoreflect.Message { - mi := &file_gateway_proto_msgTypes[10] + mi := &file_gateway_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -676,7 +563,7 @@ func (x *UnrecognizedQueueError) ProtoReflect() protoreflect.Message { // Deprecated: Use UnrecognizedQueueError.ProtoReflect.Descriptor instead. func (*UnrecognizedQueueError) Descriptor() ([]byte, []int) { - return file_gateway_proto_rawDescGZIP(), []int{10} + return file_gateway_proto_rawDescGZIP(), []int{9} } func (x *UnrecognizedQueueError) GetError() *Error { @@ -706,7 +593,7 @@ type RequestNotFoundError struct { func (x *RequestNotFoundError) Reset() { *x = RequestNotFoundError{} - mi := &file_gateway_proto_msgTypes[11] + mi := &file_gateway_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -718,7 +605,7 @@ func (x *RequestNotFoundError) String() string { func (*RequestNotFoundError) ProtoMessage() {} func (x *RequestNotFoundError) ProtoReflect() protoreflect.Message { - mi := &file_gateway_proto_msgTypes[11] + mi := &file_gateway_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -731,7 +618,7 @@ func (x *RequestNotFoundError) ProtoReflect() protoreflect.Message { // Deprecated: Use RequestNotFoundError.ProtoReflect.Descriptor instead. func (*RequestNotFoundError) Descriptor() ([]byte, []int) { - return file_gateway_proto_rawDescGZIP(), []int{11} + return file_gateway_proto_rawDescGZIP(), []int{10} } func (x *RequestNotFoundError) GetError() *Error { @@ -752,20 +639,18 @@ var File_gateway_proto protoreflect.FileDescriptor const file_gateway_proto_rawDesc = "" + "\n" + - "\rgateway.proto\x12\x18uber.submitqueue.gateway\"'\n" + + "\rgateway.proto\x12\x18uber.submitqueue.gateway\x1a\"api/base/change/proto/change.proto\x1a0api/base/mergestrategy/proto/mergestrategy.proto\"'\n" + "\vPingRequest\x12\x18\n" + "\amessage\x18\x01 \x01(\tR\amessage\"\x85\x01\n" + "\fPingResponse\x12\x18\n" + "\amessage\x18\x01 \x01(\tR\amessage\x12!\n" + "\fservice_name\x18\x02 \x01(\tR\vserviceName\x12\x1c\n" + "\ttimestamp\x18\x03 \x01(\x03R\ttimestamp\x12\x1a\n" + - "\bhostname\x18\x04 \x01(\tR\bhostname\"\x1c\n" + - "\x06Change\x12\x12\n" + - "\x04uris\x18\x01 \x03(\tR\x04uris\"\x9d\x01\n" + + "\bhostname\x18\x04 \x01(\tR\bhostname\"\x94\x01\n" + "\vLandRequest\x12\x14\n" + - "\x05queue\x18\x01 \x01(\tR\x05queue\x128\n" + - "\x06change\x18\x02 \x01(\v2 .uber.submitqueue.gateway.ChangeR\x06change\x12>\n" + - "\bstrategy\x18\x04 \x01(\x0e2\".uber.submitqueue.gateway.StrategyR\bstrategy\"\"\n" + + "\x05queue\x18\x01 \x01(\tR\x05queue\x120\n" + + "\x06change\x18\x02 \x01(\v2\x18.uber.base.change.ChangeR\x06change\x12=\n" + + "\bstrategy\x18\x04 \x01(\x0e2!.uber.base.mergestrategy.StrategyR\bstrategy\"\"\n" + "\fLandResponse\x12\x12\n" + "\x04sqid\x18\x01 \x01(\tR\x04sqid\";\n" + "\rCancelRequest\x12\x12\n" + @@ -789,13 +674,7 @@ const file_gateway_proto_rawDesc = "" + "\x05queue\x18\x02 \x01(\tR\x05queue\"a\n" + "\x14RequestNotFoundError\x125\n" + "\x05error\x18\x01 \x01(\v2\x1f.uber.submitqueue.gateway.ErrorR\x05error\x12\x12\n" + - "\x04sqid\x18\x02 \x01(\tR\x04sqid*A\n" + - "\bStrategy\x12\v\n" + - "\aDEFAULT\x10\x00\x12\n" + - "\n" + - "\x06REBASE\x10\x01\x12\x11\n" + - "\rSQUASH_REBASE\x10\x02\x12\t\n" + - "\x05MERGE\x10\x032\x84\x03\n" + + "\x04sqid\x18\x02 \x01(\tR\x04sqid2\x84\x03\n" + "\x12SubmitQueueGateway\x12W\n" + "\x04Ping\x12%.uber.submitqueue.gateway.PingRequest\x1a&.uber.submitqueue.gateway.PingResponse\"\x00\x12W\n" + "\x04Land\x12%.uber.submitqueue.gateway.LandRequest\x1a&.uber.submitqueue.gateway.LandResponse\"\x00\x12]\n" + @@ -815,38 +694,37 @@ func file_gateway_proto_rawDescGZIP() []byte { return file_gateway_proto_rawDescData } -var file_gateway_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_gateway_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_gateway_proto_msgTypes = make([]protoimpl.MessageInfo, 12) var file_gateway_proto_goTypes = []any{ - (Strategy)(0), // 0: uber.submitqueue.gateway.Strategy - (*PingRequest)(nil), // 1: uber.submitqueue.gateway.PingRequest - (*PingResponse)(nil), // 2: uber.submitqueue.gateway.PingResponse - (*Change)(nil), // 3: uber.submitqueue.gateway.Change - (*LandRequest)(nil), // 4: uber.submitqueue.gateway.LandRequest - (*LandResponse)(nil), // 5: uber.submitqueue.gateway.LandResponse - (*CancelRequest)(nil), // 6: uber.submitqueue.gateway.CancelRequest - (*CancelResponse)(nil), // 7: uber.submitqueue.gateway.CancelResponse - (*StatusRequest)(nil), // 8: uber.submitqueue.gateway.StatusRequest - (*StatusResponse)(nil), // 9: uber.submitqueue.gateway.StatusResponse - (*Error)(nil), // 10: uber.submitqueue.gateway.Error - (*UnrecognizedQueueError)(nil), // 11: uber.submitqueue.gateway.UnrecognizedQueueError - (*RequestNotFoundError)(nil), // 12: uber.submitqueue.gateway.RequestNotFoundError - nil, // 13: uber.submitqueue.gateway.StatusResponse.MetadataEntry + (*PingRequest)(nil), // 0: uber.submitqueue.gateway.PingRequest + (*PingResponse)(nil), // 1: uber.submitqueue.gateway.PingResponse + (*LandRequest)(nil), // 2: uber.submitqueue.gateway.LandRequest + (*LandResponse)(nil), // 3: uber.submitqueue.gateway.LandResponse + (*CancelRequest)(nil), // 4: uber.submitqueue.gateway.CancelRequest + (*CancelResponse)(nil), // 5: uber.submitqueue.gateway.CancelResponse + (*StatusRequest)(nil), // 6: uber.submitqueue.gateway.StatusRequest + (*StatusResponse)(nil), // 7: uber.submitqueue.gateway.StatusResponse + (*Error)(nil), // 8: uber.submitqueue.gateway.Error + (*UnrecognizedQueueError)(nil), // 9: uber.submitqueue.gateway.UnrecognizedQueueError + (*RequestNotFoundError)(nil), // 10: uber.submitqueue.gateway.RequestNotFoundError + nil, // 11: uber.submitqueue.gateway.StatusResponse.MetadataEntry + (*protopb.Change)(nil), // 12: uber.base.change.Change + (protopb1.Strategy)(0), // 13: uber.base.mergestrategy.Strategy } var file_gateway_proto_depIdxs = []int32{ - 3, // 0: uber.submitqueue.gateway.LandRequest.change:type_name -> uber.submitqueue.gateway.Change - 0, // 1: uber.submitqueue.gateway.LandRequest.strategy:type_name -> uber.submitqueue.gateway.Strategy - 13, // 2: uber.submitqueue.gateway.StatusResponse.metadata:type_name -> uber.submitqueue.gateway.StatusResponse.MetadataEntry - 10, // 3: uber.submitqueue.gateway.UnrecognizedQueueError.error:type_name -> uber.submitqueue.gateway.Error - 10, // 4: uber.submitqueue.gateway.RequestNotFoundError.error:type_name -> uber.submitqueue.gateway.Error - 1, // 5: uber.submitqueue.gateway.SubmitQueueGateway.Ping:input_type -> uber.submitqueue.gateway.PingRequest - 4, // 6: uber.submitqueue.gateway.SubmitQueueGateway.Land:input_type -> uber.submitqueue.gateway.LandRequest - 6, // 7: uber.submitqueue.gateway.SubmitQueueGateway.Cancel:input_type -> uber.submitqueue.gateway.CancelRequest - 8, // 8: uber.submitqueue.gateway.SubmitQueueGateway.Status:input_type -> uber.submitqueue.gateway.StatusRequest - 2, // 9: uber.submitqueue.gateway.SubmitQueueGateway.Ping:output_type -> uber.submitqueue.gateway.PingResponse - 5, // 10: uber.submitqueue.gateway.SubmitQueueGateway.Land:output_type -> uber.submitqueue.gateway.LandResponse - 7, // 11: uber.submitqueue.gateway.SubmitQueueGateway.Cancel:output_type -> uber.submitqueue.gateway.CancelResponse - 9, // 12: uber.submitqueue.gateway.SubmitQueueGateway.Status:output_type -> uber.submitqueue.gateway.StatusResponse + 12, // 0: uber.submitqueue.gateway.LandRequest.change:type_name -> uber.base.change.Change + 13, // 1: uber.submitqueue.gateway.LandRequest.strategy:type_name -> uber.base.mergestrategy.Strategy + 11, // 2: uber.submitqueue.gateway.StatusResponse.metadata:type_name -> uber.submitqueue.gateway.StatusResponse.MetadataEntry + 8, // 3: uber.submitqueue.gateway.UnrecognizedQueueError.error:type_name -> uber.submitqueue.gateway.Error + 8, // 4: uber.submitqueue.gateway.RequestNotFoundError.error:type_name -> uber.submitqueue.gateway.Error + 0, // 5: uber.submitqueue.gateway.SubmitQueueGateway.Ping:input_type -> uber.submitqueue.gateway.PingRequest + 2, // 6: uber.submitqueue.gateway.SubmitQueueGateway.Land:input_type -> uber.submitqueue.gateway.LandRequest + 4, // 7: uber.submitqueue.gateway.SubmitQueueGateway.Cancel:input_type -> uber.submitqueue.gateway.CancelRequest + 6, // 8: uber.submitqueue.gateway.SubmitQueueGateway.Status:input_type -> uber.submitqueue.gateway.StatusRequest + 1, // 9: uber.submitqueue.gateway.SubmitQueueGateway.Ping:output_type -> uber.submitqueue.gateway.PingResponse + 3, // 10: uber.submitqueue.gateway.SubmitQueueGateway.Land:output_type -> uber.submitqueue.gateway.LandResponse + 5, // 11: uber.submitqueue.gateway.SubmitQueueGateway.Cancel:output_type -> uber.submitqueue.gateway.CancelResponse + 7, // 12: uber.submitqueue.gateway.SubmitQueueGateway.Status:output_type -> uber.submitqueue.gateway.StatusResponse 9, // [9:13] is the sub-list for method output_type 5, // [5:9] is the sub-list for method input_type 5, // [5:5] is the sub-list for extension type_name @@ -864,14 +742,13 @@ func file_gateway_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_gateway_proto_rawDesc), len(file_gateway_proto_rawDesc)), - NumEnums: 1, - NumMessages: 13, + NumEnums: 0, + NumMessages: 12, NumExtensions: 0, NumServices: 1, }, GoTypes: file_gateway_proto_goTypes, DependencyIndexes: file_gateway_proto_depIdxs, - EnumInfos: file_gateway_proto_enumTypes, MessageInfos: file_gateway_proto_msgTypes, }.Build() File_gateway_proto = out.File diff --git a/api/submitqueue/gateway/protopb/gateway.pb.yarpc.go b/api/submitqueue/gateway/protopb/gateway.pb.yarpc.go index e1473005..70dd6aa6 100644 --- a/api/submitqueue/gateway/protopb/gateway.pb.yarpc.go +++ b/api/submitqueue/gateway/protopb/gateway.pb.yarpc.go @@ -376,48 +376,73 @@ var ( var yarpcFileDescriptorClosuref1a937782ebbded5 = [][]byte{ // gateway.proto []byte{ - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x51, 0x6b, 0xdb, 0x3c, - 0x14, 0x8d, 0xe3, 0xc4, 0x4d, 0x6e, 0x92, 0x92, 0x4f, 0x94, 0x62, 0x42, 0x3f, 0x96, 0x6a, 0x6c, - 0x0d, 0x7b, 0x70, 0x20, 0x63, 0xa3, 0xac, 0x30, 0x48, 0x3b, 0xb7, 0x7b, 0x68, 0x4b, 0x6b, 0xaf, - 0x0c, 0x06, 0xa3, 0x28, 0x8e, 0x70, 0x4d, 0x6b, 0x3b, 0xb5, 0xe4, 0x8e, 0xec, 0x79, 0xfb, 0x19, - 0xfb, 0x5f, 0xfb, 0x39, 0xc3, 0x92, 0xdc, 0x38, 0x30, 0xbb, 0x0f, 0x7b, 0xd3, 0xbd, 0x3a, 0xe7, - 0xdc, 0x23, 0xe9, 0x5e, 0x1b, 0x7a, 0x3e, 0xe1, 0xf4, 0x1b, 0x59, 0x5a, 0x8b, 0x24, 0xe6, 0x31, - 0x32, 0xd3, 0x19, 0x4d, 0x2c, 0x96, 0xce, 0xc2, 0x80, 0xdf, 0xa7, 0x34, 0xa5, 0x96, 0xda, 0xc7, - 0x7b, 0xd0, 0xb9, 0x08, 0x22, 0xdf, 0xa1, 0xf7, 0x29, 0x65, 0x1c, 0x99, 0xb0, 0x11, 0x52, 0xc6, - 0x88, 0x4f, 0x4d, 0x6d, 0xa8, 0x8d, 0xda, 0x4e, 0x1e, 0xe2, 0x9f, 0x1a, 0x74, 0x25, 0x92, 0x2d, - 0xe2, 0x88, 0xd1, 0x72, 0x28, 0xda, 0x85, 0x2e, 0xa3, 0xc9, 0x43, 0xe0, 0xd1, 0xeb, 0x88, 0x84, - 0xd4, 0xac, 0x8b, 0xed, 0x8e, 0xca, 0x9d, 0x93, 0x90, 0xa2, 0x1d, 0x68, 0xf3, 0x20, 0xa4, 0x8c, - 0x93, 0x70, 0x61, 0xea, 0x43, 0x6d, 0xa4, 0x3b, 0xab, 0x04, 0x1a, 0x40, 0xeb, 0x26, 0x66, 0x5c, - 0x90, 0x1b, 0x82, 0xfc, 0x18, 0xe3, 0x1d, 0x30, 0x8e, 0x6e, 0x48, 0xe4, 0x53, 0x84, 0xa0, 0x91, - 0x26, 0x01, 0x33, 0xb5, 0xa1, 0x3e, 0x6a, 0x3b, 0x62, 0x8d, 0x7f, 0x69, 0xd0, 0x39, 0x25, 0xd1, - 0x3c, 0x3f, 0xcf, 0x16, 0x34, 0xc5, 0x79, 0x95, 0x45, 0x19, 0xa0, 0x7d, 0x30, 0x3c, 0xa1, 0x21, - 0xac, 0x75, 0x26, 0x43, 0xab, 0xec, 0x7e, 0x2c, 0x59, 0xcb, 0x51, 0x78, 0xf4, 0x1e, 0x5a, 0x8c, - 0x27, 0x84, 0x53, 0x7f, 0x29, 0x9c, 0x6d, 0x4e, 0x70, 0x39, 0xd7, 0x55, 0x48, 0xe7, 0x91, 0x83, - 0x31, 0x74, 0xa5, 0x3d, 0x75, 0x89, 0x08, 0x1a, 0xec, 0x3e, 0x98, 0x2b, 0x7b, 0x62, 0x8d, 0x0f, - 0xa0, 0x77, 0x44, 0x22, 0x8f, 0xde, 0xe5, 0x87, 0xf8, 0x0b, 0x08, 0x6d, 0x83, 0x91, 0x50, 0xc2, - 0xe2, 0x48, 0xdd, 0xae, 0x8a, 0x70, 0x1f, 0x36, 0x73, 0xb2, 0x2c, 0x81, 0x9f, 0x43, 0xcf, 0xe5, - 0x84, 0xa7, 0xac, 0x42, 0x0e, 0xff, 0xd6, 0x60, 0x33, 0x47, 0x29, 0x6b, 0xdb, 0x60, 0x30, 0x91, - 0x51, 0x40, 0x15, 0xa1, 0xff, 0x01, 0xee, 0x08, 0xe3, 0xd7, 0x34, 0x49, 0xe2, 0x44, 0x55, 0x6f, - 0x67, 0x19, 0x3b, 0x4b, 0x20, 0x07, 0x5a, 0x21, 0xe5, 0x64, 0x4e, 0x38, 0x31, 0xf5, 0xa1, 0x3e, - 0xea, 0x4c, 0xde, 0x56, 0xdd, 0x50, 0xb1, 0xa4, 0x75, 0xa6, 0x88, 0x76, 0xc4, 0x93, 0xa5, 0xf3, - 0xa8, 0x33, 0x38, 0x80, 0xde, 0xda, 0x16, 0xea, 0x83, 0x7e, 0x4b, 0x97, 0xca, 0x58, 0xb6, 0xcc, - 0x1e, 0xfa, 0x81, 0xdc, 0xa5, 0x79, 0xb3, 0xc9, 0xe0, 0x5d, 0x7d, 0x5f, 0xc3, 0xbb, 0xd0, 0x94, - 0xce, 0xca, 0x7b, 0x9b, 0xc2, 0xf6, 0x55, 0x94, 0x50, 0x2f, 0xf6, 0xa3, 0xe0, 0x3b, 0x9d, 0x5f, - 0x66, 0x1e, 0x25, 0xe7, 0x0d, 0x34, 0xe5, 0x39, 0x35, 0xd1, 0x28, 0xcf, 0xca, 0x8f, 0x22, 0xf0, - 0x8e, 0x44, 0xaf, 0xda, 0xae, 0x5e, 0x68, 0x3b, 0x4c, 0x60, 0x4b, 0xbd, 0xc1, 0x79, 0xcc, 0x8f, - 0xe3, 0x34, 0x9a, 0xff, 0x53, 0x91, 0xfc, 0x1d, 0xeb, 0xab, 0x77, 0x7c, 0x35, 0x85, 0x56, 0xde, - 0x75, 0xa8, 0x03, 0x1b, 0x1f, 0xec, 0xe3, 0xe9, 0xd5, 0xe9, 0xa7, 0x7e, 0x0d, 0x01, 0x18, 0x8e, - 0x7d, 0x38, 0x75, 0xed, 0xbe, 0x86, 0xfe, 0x83, 0x9e, 0x7b, 0x79, 0x35, 0x75, 0x3f, 0x5e, 0xab, - 0x54, 0x1d, 0xb5, 0xa1, 0x79, 0x66, 0x3b, 0x27, 0x76, 0x5f, 0x9f, 0xfc, 0xd0, 0x01, 0xb9, 0xa2, - 0xb6, 0xb8, 0x87, 0x13, 0x59, 0x1a, 0x7d, 0x86, 0x46, 0x36, 0xfe, 0xe8, 0x45, 0xb9, 0xbb, 0xc2, - 0x87, 0x64, 0xf0, 0xf2, 0x29, 0x98, 0xea, 0xce, 0x5a, 0x26, 0x9c, 0x8d, 0x44, 0x95, 0x70, 0x61, - 0xa2, 0xab, 0x84, 0x8b, 0x93, 0x85, 0x6b, 0xe8, 0x2b, 0x18, 0x72, 0x14, 0xd0, 0x5e, 0xc5, 0x7c, - 0x17, 0x27, 0x6d, 0x30, 0x7a, 0x1a, 0x58, 0x94, 0x97, 0xed, 0x5b, 0x25, 0xbf, 0x36, 0x79, 0x55, - 0xf2, 0xeb, 0x93, 0x80, 0x6b, 0x87, 0xb7, 0xb0, 0xe3, 0xc5, 0x61, 0x29, 0xe1, 0xb0, 0xab, 0x1e, - 0xe6, 0x22, 0xfb, 0xc0, 0x5f, 0x68, 0x5f, 0x0e, 0xfc, 0x80, 0xdf, 0xa4, 0x33, 0xcb, 0x8b, 0xc3, - 0x71, 0x46, 0x1a, 0x17, 0x48, 0x63, 0xb2, 0x08, 0xd6, 0x62, 0x25, 0x32, 0x16, 0x7f, 0x87, 0xc5, - 0x6c, 0x66, 0x88, 0xc5, 0xeb, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x48, 0x81, 0xac, 0xa4, 0x37, - 0x06, 0x00, 0x00, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x5f, 0x6b, 0xd4, 0x40, + 0x10, 0x6f, 0x2e, 0xed, 0xd9, 0xce, 0xdd, 0x95, 0xb2, 0x94, 0x12, 0x42, 0xc5, 0x76, 0x45, 0x7b, + 0x4f, 0x49, 0x39, 0x51, 0xc4, 0xe2, 0x4b, 0x4b, 0xf5, 0x45, 0x4b, 0x4d, 0x11, 0x41, 0x90, 0xb2, + 0xc9, 0x0d, 0xb9, 0xd0, 0x4b, 0x72, 0x97, 0xdd, 0x54, 0xce, 0x67, 0xfd, 0x06, 0x7e, 0x38, 0x3f, + 0x8e, 0xec, 0x9f, 0xdc, 0x25, 0x60, 0xae, 0x0f, 0x3e, 0x65, 0x67, 0xf2, 0xfb, 0xcd, 0xcc, 0xce, + 0xfc, 0x66, 0x61, 0x10, 0x33, 0x81, 0xdf, 0xd9, 0xc2, 0x9b, 0x15, 0xb9, 0xc8, 0x89, 0x53, 0x86, + 0x58, 0x78, 0xbc, 0x0c, 0xd3, 0x44, 0xcc, 0x4b, 0x2c, 0xd1, 0x33, 0xff, 0x5d, 0xca, 0x66, 0x89, + 0x1f, 0x32, 0x8e, 0x7e, 0x34, 0x61, 0x59, 0x8c, 0xbe, 0x22, 0x18, 0x43, 0xb3, 0xdd, 0xd3, 0x25, + 0x26, 0xc5, 0x22, 0x46, 0x2e, 0x0a, 0x26, 0x30, 0x5e, 0x18, 0x68, 0xc3, 0xa7, 0x19, 0xf4, 0x04, + 0x7a, 0xd7, 0x49, 0x16, 0x07, 0x38, 0x2f, 0x91, 0x0b, 0xe2, 0xc0, 0xa3, 0x14, 0x39, 0x67, 0x31, + 0x3a, 0xd6, 0x91, 0x35, 0xdc, 0x09, 0x2a, 0x93, 0xfe, 0xb2, 0xa0, 0xaf, 0x91, 0x7c, 0x96, 0x67, + 0x1c, 0xdb, 0xa1, 0xe4, 0x18, 0xfa, 0x1c, 0x8b, 0xfb, 0x24, 0xc2, 0xdb, 0x8c, 0xa5, 0xe8, 0x74, + 0xd4, 0xef, 0x9e, 0xf1, 0x5d, 0xb1, 0x14, 0xc9, 0x21, 0xec, 0x88, 0x24, 0x45, 0x2e, 0x58, 0x3a, + 0x73, 0xec, 0x23, 0x6b, 0x68, 0x07, 0x2b, 0x07, 0x71, 0x61, 0x7b, 0x92, 0x73, 0xa1, 0xc8, 0x9b, + 0x8a, 0xbc, 0xb4, 0xe9, 0x6f, 0x0b, 0x7a, 0x1f, 0x58, 0x36, 0xae, 0x2a, 0xde, 0x87, 0x2d, 0xd5, + 0x27, 0x53, 0x84, 0x36, 0xc8, 0x29, 0x74, 0x75, 0x63, 0x54, 0xf2, 0xde, 0xc8, 0xf1, 0x54, 0x5f, + 0x65, 0x6b, 0x3c, 0xd3, 0xb1, 0x0b, 0xf5, 0x09, 0x0c, 0x8e, 0xbc, 0x85, 0xed, 0xaa, 0x35, 0x2a, + 0xe7, 0xee, 0xe8, 0xb8, 0xc6, 0x69, 0xb6, 0xee, 0xc6, 0x1c, 0x82, 0x25, 0x85, 0x52, 0xe8, 0xeb, + 0xaa, 0x4c, 0x77, 0x08, 0x6c, 0xf2, 0x79, 0x32, 0x36, 0x55, 0xa9, 0x33, 0x3d, 0x83, 0xc1, 0x05, + 0xcb, 0x22, 0x9c, 0x56, 0xb5, 0xff, 0x03, 0x44, 0x0e, 0xa0, 0x5b, 0x20, 0xe3, 0x79, 0x66, 0xda, + 0x66, 0x2c, 0xba, 0x07, 0xbb, 0x15, 0x59, 0xa7, 0xa0, 0x4f, 0x61, 0x70, 0x23, 0x98, 0x28, 0xf9, + 0x9a, 0x70, 0xf4, 0x8f, 0x05, 0xbb, 0x15, 0xca, 0x94, 0x76, 0x00, 0x5d, 0xae, 0x3c, 0x06, 0x68, + 0x2c, 0xf2, 0x18, 0x60, 0xca, 0xb8, 0xb8, 0xc5, 0xa2, 0xc8, 0x0b, 0x93, 0x7d, 0x47, 0x7a, 0x2e, + 0xa5, 0x83, 0x04, 0xb0, 0x9d, 0xa2, 0x60, 0x63, 0x26, 0x98, 0x63, 0x1f, 0xd9, 0xc3, 0xde, 0xe8, + 0x95, 0xd7, 0x26, 0x56, 0xaf, 0x99, 0xd2, 0xfb, 0x68, 0x88, 0x97, 0x99, 0x28, 0x16, 0xc1, 0x32, + 0x8e, 0x7b, 0x06, 0x83, 0xc6, 0x2f, 0xb2, 0x07, 0xf6, 0x1d, 0x2e, 0x4c, 0x61, 0xf2, 0x28, 0xe7, + 0x7b, 0xcf, 0xa6, 0x65, 0xa5, 0x22, 0x6d, 0xbc, 0xe9, 0xbc, 0xb6, 0xe8, 0x31, 0x6c, 0xe9, 0xca, + 0xda, 0x45, 0x8b, 0x70, 0xf0, 0x39, 0x2b, 0x30, 0xca, 0xe3, 0x2c, 0xf9, 0x81, 0xe3, 0x4f, 0xb2, + 0x46, 0xcd, 0x79, 0x09, 0x5b, 0xfa, 0x9e, 0x96, 0xd2, 0xc7, 0x93, 0xf6, 0xab, 0x28, 0x7c, 0xa0, + 0xd1, 0x2b, 0xb5, 0x75, 0x6a, 0x6a, 0xa3, 0x0c, 0xf6, 0xcd, 0x0c, 0xae, 0x72, 0xf1, 0x2e, 0x2f, + 0xb3, 0xf1, 0x7f, 0x25, 0xa9, 0xe6, 0xd8, 0x59, 0xcd, 0x71, 0xf4, 0xd3, 0x06, 0x72, 0xa3, 0x88, + 0xea, 0x12, 0xef, 0x35, 0x8f, 0x7c, 0x81, 0x4d, 0xb9, 0x94, 0xe4, 0x59, 0x7b, 0xe8, 0xda, 0x7a, + 0xbb, 0xcf, 0x1f, 0x82, 0x19, 0x69, 0x6d, 0xc8, 0xc0, 0x52, 0xcf, 0xeb, 0x02, 0xd7, 0xb6, 0x70, + 0x5d, 0xe0, 0xfa, 0x5a, 0xd0, 0x0d, 0xf2, 0x0d, 0xba, 0x5a, 0xc7, 0xe4, 0xa4, 0x9d, 0xd3, 0x58, + 0x13, 0x77, 0xf8, 0x30, 0xb0, 0x1e, 0x5e, 0x6b, 0x6f, 0x5d, 0xf8, 0xc6, 0xda, 0xac, 0x0b, 0xdf, + 0x94, 0x31, 0xdd, 0x38, 0xbf, 0x83, 0xc3, 0x28, 0x4f, 0x5b, 0x09, 0xe7, 0x7d, 0x33, 0x98, 0x6b, + 0xf9, 0xb8, 0x5e, 0x5b, 0x5f, 0xcf, 0xe2, 0x44, 0x4c, 0xca, 0xd0, 0x8b, 0xf2, 0xd4, 0x97, 0x24, + 0xbf, 0x46, 0xf2, 0xe5, 0x63, 0x5d, 0xb7, 0x4d, 0x10, 0xfd, 0x5a, 0xcf, 0xc2, 0xb0, 0xab, 0x0e, + 0x2f, 0xfe, 0x06, 0x00, 0x00, 0xff, 0xff, 0x01, 0x08, 0x76, 0xa7, 0x23, 0x06, 0x00, 0x00, + }, + // api/base/change/proto/change.proto + []byte{ + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4a, 0x2c, 0xc8, 0xd4, + 0x4f, 0x4a, 0x2c, 0x4e, 0xd5, 0x4f, 0xce, 0x48, 0xcc, 0x4b, 0x4f, 0xd5, 0x2f, 0x28, 0xca, 0x2f, + 0xc9, 0x87, 0x72, 0xf4, 0xc0, 0x1c, 0x21, 0x81, 0xd2, 0xa4, 0xd4, 0x22, 0x3d, 0x90, 0x22, 0x3d, + 0x88, 0xb8, 0x92, 0x0c, 0x17, 0x9b, 0x33, 0x98, 0x25, 0x24, 0xc4, 0xc5, 0x52, 0x5a, 0x94, 0x59, + 0x2c, 0xc1, 0xa8, 0xc0, 0xac, 0xc1, 0x19, 0x04, 0x66, 0x3b, 0xa5, 0x71, 0x29, 0x24, 0xe7, 0xe7, + 0xea, 0x81, 0x75, 0x15, 0x97, 0x26, 0xe5, 0x66, 0x96, 0x14, 0x96, 0xa6, 0x96, 0xa6, 0x22, 0x9b, + 0xe0, 0xc4, 0x0d, 0xd1, 0x1f, 0x00, 0xb2, 0x20, 0x80, 0x31, 0xca, 0x38, 0x3d, 0xb3, 0x24, 0xa3, + 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, 0xa4, 0x4f, 0x1f, 0x49, 0x9f, 0x3e, 0x56, 0x27, 0x16, + 0x24, 0x25, 0xb1, 0x81, 0x19, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xbf, 0x91, 0x62, 0xef, + 0xc4, 0x00, 0x00, 0x00, + }, + // api/base/mergestrategy/proto/mergestrategy.proto + []byte{ + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x48, 0x2c, 0xc8, 0xd4, + 0x4f, 0x4a, 0x2c, 0x4e, 0xd5, 0xcf, 0x4d, 0x2d, 0x4a, 0x4f, 0x2d, 0x2e, 0x29, 0x4a, 0x2c, 0x49, + 0x4d, 0xaf, 0xd4, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x47, 0x15, 0xd3, 0x03, 0x8b, 0x09, 0x89, 0x97, + 0x26, 0xa5, 0x16, 0xe9, 0x81, 0xb4, 0xe8, 0xa1, 0x48, 0x6b, 0x39, 0x72, 0x71, 0x04, 0x43, 0xd9, + 0x42, 0xdc, 0x5c, 0xec, 0x2e, 0xae, 0x6e, 0x8e, 0xa1, 0x3e, 0x21, 0x02, 0x0c, 0x42, 0x5c, 0x5c, + 0x6c, 0x41, 0xae, 0x4e, 0x8e, 0xc1, 0xae, 0x02, 0x8c, 0x42, 0x82, 0x5c, 0xbc, 0xc1, 0x81, 0xa1, + 0x8e, 0xc1, 0x1e, 0xf1, 0x50, 0x21, 0x26, 0x21, 0x4e, 0x2e, 0x56, 0x5f, 0xd7, 0x20, 0x77, 0x57, + 0x01, 0x66, 0xa7, 0x6a, 0x2e, 0xf5, 0xe4, 0xfc, 0x5c, 0x3d, 0xb0, 0x0d, 0xc5, 0xa5, 0x49, 0xb9, + 0x99, 0x25, 0x85, 0xa5, 0xa9, 0xa5, 0xa9, 0x58, 0x6c, 0x73, 0x12, 0xf2, 0x05, 0x71, 0x61, 0x16, + 0x06, 0x80, 0x9c, 0x16, 0xc0, 0x18, 0x65, 0x95, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, + 0x9f, 0xab, 0x0f, 0x32, 0x45, 0x1f, 0xc9, 0x14, 0x7d, 0x7c, 0x5e, 0x2d, 0x48, 0x4a, 0x62, 0x03, + 0x33, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xc6, 0xe5, 0x5f, 0xa5, 0x13, 0x01, 0x00, 0x00, }, } diff --git a/submitqueue/gateway/controller/BUILD.bazel b/submitqueue/gateway/controller/BUILD.bazel index 69d08fb9..a2dbdbde 100644 --- a/submitqueue/gateway/controller/BUILD.bazel +++ b/submitqueue/gateway/controller/BUILD.bazel @@ -11,6 +11,7 @@ go_library( importpath = "github.com/uber/submitqueue/submitqueue/gateway/controller", visibility = ["//visibility:public"], deps = [ + "//api/base/mergestrategy/protopb", "//api/submitqueue/gateway/protopb", "//platform/base/change", "//platform/base/mergestrategy", @@ -39,6 +40,8 @@ go_test( ], embed = [":controller"], deps = [ + "//api/base/change/protopb", + "//api/base/mergestrategy/protopb", "//api/submitqueue/gateway/protopb", "//platform/base/mergestrategy", "//platform/base/messagequeue", diff --git a/submitqueue/gateway/controller/land.go b/submitqueue/gateway/controller/land.go index b80218c1..6e15c72f 100644 --- a/submitqueue/gateway/controller/land.go +++ b/submitqueue/gateway/controller/land.go @@ -20,6 +20,7 @@ import ( "fmt" "github.com/uber-go/tally" + mergestrategypb "github.com/uber/submitqueue/api/base/mergestrategy/protopb" pb "github.com/uber/submitqueue/api/submitqueue/gateway/protopb" "github.com/uber/submitqueue/platform/base/change" "github.com/uber/submitqueue/platform/base/mergestrategy" @@ -197,16 +198,16 @@ func (c *LandController) publishToQueue(ctx context.Context, landRequest entity. } // resolveMergeStrategy maps a proto Strategy enum to the shared mergestrategy.MergeStrategy. -func resolveMergeStrategy(s pb.Strategy) (mergestrategy.MergeStrategy, error) { +func resolveMergeStrategy(s mergestrategypb.Strategy) (mergestrategy.MergeStrategy, error) { switch s { - case pb.Strategy_DEFAULT: + case mergestrategypb.Strategy_DEFAULT: // TODO: resolve default strategy based on queue configuration return mergestrategy.MergeStrategyRebase, nil - case pb.Strategy_REBASE: + case mergestrategypb.Strategy_REBASE: return mergestrategy.MergeStrategyRebase, nil - case pb.Strategy_SQUASH_REBASE: + case mergestrategypb.Strategy_SQUASH_REBASE: return mergestrategy.MergeStrategySquashRebase, nil - case pb.Strategy_MERGE: + case mergestrategypb.Strategy_MERGE: return mergestrategy.MergeStrategyMerge, nil default: return mergestrategy.MergeStrategyUnknown, fmt.Errorf("unknown land strategy in proto message: %v", s) diff --git a/submitqueue/gateway/controller/land_test.go b/submitqueue/gateway/controller/land_test.go index 058b5eec..01252d61 100644 --- a/submitqueue/gateway/controller/land_test.go +++ b/submitqueue/gateway/controller/land_test.go @@ -22,6 +22,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/uber-go/tally" + changepb "github.com/uber/submitqueue/api/base/change/protopb" + mergestrategypb "github.com/uber/submitqueue/api/base/mergestrategy/protopb" pb "github.com/uber/submitqueue/api/submitqueue/gateway/protopb" "github.com/uber/submitqueue/platform/base/mergestrategy" entityqueue "github.com/uber/submitqueue/platform/base/messagequeue" @@ -100,7 +102,7 @@ func TestLand_ReturnsSqid(t *testing.T) { req := &pb.LandRequest{ Queue: "test-queue", - Change: &pb.Change{Uris: []string{"github://uber/test-repo/pull/123/c3a4d5e6f7890123456789abcdef0123456789ab"}}, + Change: &changepb.Change{Uris: []string{"github://uber/test-repo/pull/123/c3a4d5e6f7890123456789abcdef0123456789ab"}}, } resp, err := controller.Land(ctx, req) @@ -118,7 +120,7 @@ func TestLand_ReturnsErrorOnCounterFailure(t *testing.T) { req := &pb.LandRequest{ Queue: "test-queue", - Change: &pb.Change{Uris: []string{"github://uber/test-repo/pull/123/c3a4d5e6f7890123456789abcdef0123456789ab"}}, + Change: &changepb.Change{Uris: []string{"github://uber/test-repo/pull/123/c3a4d5e6f7890123456789abcdef0123456789ab"}}, } _, err := controller.Land(ctx, req) @@ -142,7 +144,7 @@ func TestLand_CounterDomainIncludesQueue(t *testing.T) { req := &pb.LandRequest{ Queue: "my-queue", - Change: &pb.Change{Uris: []string{"github://uber/test-repo/pull/123/c3a4d5e6f7890123456789abcdef0123456789ab"}}, + Change: &changepb.Change{Uris: []string{"github://uber/test-repo/pull/123/c3a4d5e6f7890123456789abcdef0123456789ab"}}, } _, err := controller.Land(ctx, req) @@ -159,7 +161,7 @@ func TestLand_ReturnsErrorOnEmptyQueue(t *testing.T) { req := &pb.LandRequest{ Queue: "", - Change: &pb.Change{Uris: []string{"github://uber/test-repo/pull/123/c3a4d5e6f7890123456789abcdef0123456789ab"}}, + Change: &changepb.Change{Uris: []string{"github://uber/test-repo/pull/123/c3a4d5e6f7890123456789abcdef0123456789ab"}}, } _, err := controller.Land(ctx, req) @@ -176,7 +178,7 @@ func TestLand_ReturnsErrorOnEmptyChangeUri(t *testing.T) { req := &pb.LandRequest{ Queue: "test-queue", - Change: &pb.Change{Uris: []string{}}, + Change: &changepb.Change{Uris: []string{}}, } _, err := controller.Land(ctx, req) @@ -213,7 +215,7 @@ func TestLand_ReturnsUnrecognizedQueueWhenStoreReportsNotFound(t *testing.T) { req := &pb.LandRequest{ Queue: "missing-queue", - Change: &pb.Change{Uris: []string{"github://uber/test-repo/pull/123/c3a4d5e6f7890123456789abcdef0123456789ab"}}, + Change: &changepb.Change{Uris: []string{"github://uber/test-repo/pull/123/c3a4d5e6f7890123456789abcdef0123456789ab"}}, } _, err := controller.Land(ctx, req) @@ -239,7 +241,7 @@ func TestLand_PropagatesQueueConfigStoreError(t *testing.T) { req := &pb.LandRequest{ Queue: "test-queue", - Change: &pb.Change{Uris: []string{"github://uber/test-repo/pull/123/c3a4d5e6f7890123456789abcdef0123456789ab"}}, + Change: &changepb.Change{Uris: []string{"github://uber/test-repo/pull/123/c3a4d5e6f7890123456789abcdef0123456789ab"}}, } _, err := controller.Land(ctx, req) @@ -271,8 +273,8 @@ func TestLand_PublishesToQueue(t *testing.T) { req := &pb.LandRequest{ Queue: "test-queue", - Change: &pb.Change{Uris: []string{"github://uber/backend/pull/456/fedcba9876543210fedcba9876543210fedcba98"}}, - Strategy: pb.Strategy_REBASE, + Change: &changepb.Change{Uris: []string{"github://uber/backend/pull/456/fedcba9876543210fedcba9876543210fedcba98"}}, + Strategy: mergestrategypb.Strategy_REBASE, } resp, err := controller.Land(ctx, req) @@ -307,7 +309,7 @@ func TestLand_ContinuesWhenPublishFails(t *testing.T) { req := &pb.LandRequest{ Queue: "test-queue", - Change: &pb.Change{Uris: []string{"github://uber/service/pull/1/c3a4d5e6f7890123456789abcdef0123456789ab"}}, + Change: &changepb.Change{Uris: []string{"github://uber/service/pull/1/c3a4d5e6f7890123456789abcdef0123456789ab"}}, } _, err := controller.Land(ctx, req) diff --git a/test/e2e/submitqueue/BUILD.bazel b/test/e2e/submitqueue/BUILD.bazel index 5f964ae7..94d1d5da 100644 --- a/test/e2e/submitqueue/BUILD.bazel +++ b/test/e2e/submitqueue/BUILD.bazel @@ -17,6 +17,8 @@ go_test( "integration", ], deps = [ + "//api/base/change/protopb", + "//api/base/mergestrategy/protopb", "//api/submitqueue/gateway/protopb", "//api/submitqueue/orchestrator/protopb", "//submitqueue/entity", diff --git a/test/e2e/submitqueue/suite_test.go b/test/e2e/submitqueue/suite_test.go index 59553c37..e124452a 100644 --- a/test/e2e/submitqueue/suite_test.go +++ b/test/e2e/submitqueue/suite_test.go @@ -32,6 +32,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + changepb "github.com/uber/submitqueue/api/base/change/protopb" + mergestrategypb "github.com/uber/submitqueue/api/base/mergestrategy/protopb" gatewaypb "github.com/uber/submitqueue/api/submitqueue/gateway/protopb" orchestratorpb "github.com/uber/submitqueue/api/submitqueue/orchestrator/protopb" "github.com/uber/submitqueue/submitqueue/entity" @@ -170,8 +172,8 @@ func (s *E2EIntegrationSuite) TestPingOrchestrator() { func (s *E2EIntegrationSuite) TestLandRequest_SinglePR() { req := &gatewaypb.LandRequest{ Queue: "e2e-test-queue", - Change: &gatewaypb.Change{Uris: []string{"github://uber/e2e-service/pull/123/abcdef0123456789abcdef0123456789abcdef01"}}, - Strategy: gatewaypb.Strategy_REBASE, + Change: &changepb.Change{Uris: []string{"github://uber/e2e-service/pull/123/abcdef0123456789abcdef0123456789abcdef01"}}, + Strategy: mergestrategypb.Strategy_REBASE, } s.log.Logf("Sending Land request (single PR) for queue=%s", req.Queue) @@ -197,8 +199,8 @@ func (s *E2EIntegrationSuite) TestLandRequest_PersistsStartedLogViaGatewayConsum landResp, err := s.gatewayClient.Land(s.ctx, &gatewaypb.LandRequest{ Queue: "e2e-test-queue", - Change: &gatewaypb.Change{Uris: []string{"github://uber/e2e-startlog/pull/4242/abcdef0123456789abcdef0123456789abcdef01"}}, - Strategy: gatewaypb.Strategy_REBASE, + Change: &changepb.Change{Uris: []string{"github://uber/e2e-startlog/pull/4242/abcdef0123456789abcdef0123456789abcdef01"}}, + Strategy: mergestrategypb.Strategy_REBASE, }) require.NoError(t, err, "Land request failed") require.NotEmpty(t, landResp.Sqid, "SQID should not be empty") @@ -245,8 +247,8 @@ func (s *E2EIntegrationSuite) TestCancelRequest_BeforeBatch() { landReq := &gatewaypb.LandRequest{ Queue: "e2e-cancel-queue", - Change: &gatewaypb.Change{Uris: []string{"github://uber/e2e-nonexistent/pull/9999/deadbeef"}}, - Strategy: gatewaypb.Strategy_REBASE, + Change: &changepb.Change{Uris: []string{"github://uber/e2e-nonexistent/pull/9999/deadbeef"}}, + Strategy: mergestrategypb.Strategy_REBASE, } landResp, err := s.gatewayClient.Land(s.ctx, landReq) require.NoError(t, err, "Land failed") diff --git a/test/integration/submitqueue/gateway/BUILD.bazel b/test/integration/submitqueue/gateway/BUILD.bazel index d90f1fae..25aebc41 100644 --- a/test/integration/submitqueue/gateway/BUILD.bazel +++ b/test/integration/submitqueue/gateway/BUILD.bazel @@ -16,6 +16,8 @@ go_test( "integration", ], deps = [ + "//api/base/change/protopb", + "//api/base/mergestrategy/protopb", "//api/submitqueue/gateway/protopb", "//platform/consumer", "//platform/extension/messagequeue/mysql", diff --git a/test/integration/submitqueue/gateway/suite_test.go b/test/integration/submitqueue/gateway/suite_test.go index 5415ad1f..eab37662 100644 --- a/test/integration/submitqueue/gateway/suite_test.go +++ b/test/integration/submitqueue/gateway/suite_test.go @@ -36,6 +36,8 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" "github.com/uber-go/tally" + changepb "github.com/uber/submitqueue/api/base/change/protopb" + mergestrategypb "github.com/uber/submitqueue/api/base/mergestrategy/protopb" pb "github.com/uber/submitqueue/api/submitqueue/gateway/protopb" "github.com/uber/submitqueue/platform/consumer" queueMySQL "github.com/uber/submitqueue/platform/extension/messagequeue/mysql" @@ -144,8 +146,8 @@ func (s *GatewayIntegrationSuite) TestLandAPI() { req := &pb.LandRequest{ Queue: "test-queue", - Change: &pb.Change{Uris: []string{"github://uber/integration-test/pull/123/abcdef0123456789abcdef0123456789abcdef01"}}, - Strategy: pb.Strategy_REBASE, + Change: &changepb.Change{Uris: []string{"github://uber/integration-test/pull/123/abcdef0123456789abcdef0123456789abcdef01"}}, + Strategy: mergestrategypb.Strategy_REBASE, } s.log.Logf("Sending Land request for queue=%s", req.Queue) diff --git a/tool/proto/BUILD.bazel b/tool/proto/BUILD.bazel index 03e3957c..b230014e 100644 --- a/tool/proto/BUILD.bazel +++ b/tool/proto/BUILD.bazel @@ -1,8 +1,35 @@ load("//tool/proto:proto_codegen.bzl", "go_proto_generated_files") +# Shared api/base contracts. Message-only (no RPC service), so the gRPC/YARPC +# generators are disabled. Other packages import these instead of redefining them. +go_proto_generated_files( + name = "api_base_change", + srcs = ["//api/base/change/proto:change.proto"], + gen_services = False, + out_dir = "api_base_change", +) + +go_proto_generated_files( + name = "api_base_mergestrategy", + srcs = ["//api/base/mergestrategy/proto:mergestrategy.proto"], + gen_services = False, + out_dir = "api_base_mergestrategy", +) + +go_proto_generated_files( + name = "api_base_messagequeue", + srcs = ["//api/base/messagequeue/proto:messagequeue.proto"], + gen_services = False, + out_dir = "api_base_messagequeue", +) + go_proto_generated_files( name = "api_submitqueue_gateway", srcs = ["//api/submitqueue/gateway/proto:gateway.proto"], + imports = [ + "//api/base/change/proto:change.proto", + "//api/base/mergestrategy/proto:mergestrategy.proto", + ], out_dir = "api_submitqueue_gateway", ) @@ -27,6 +54,9 @@ go_proto_generated_files( filegroup( name = "generated", srcs = [ + ":api_base_change", + ":api_base_mergestrategy", + ":api_base_messagequeue", ":api_stovepipe_gateway", ":api_stovepipe_orchestrator", ":api_submitqueue_gateway", diff --git a/tool/proto/proto_codegen.bzl b/tool/proto/proto_codegen.bzl index 56e71425..89956c53 100644 --- a/tool/proto/proto_codegen.bzl +++ b/tool/proto/proto_codegen.bzl @@ -18,36 +18,55 @@ def _go_proto_generated_files_impl(ctx): ctx.executable._protoc_gen_yarpc_go, ] + # Imported .proto files (e.g. the shared api/base contracts) must be present + # in the sandbox and resolvable on the import path. They are generated by + # their own target, so they are NOT passed as sources to compile here — they + # only provide type/go_package information for the importing source. + import_files = ctx.files.imports + all_outputs = [] # Generate independently per source so a package can hold multiple .proto # files (e.g. an RPC service contract alongside messagequeue contracts). for src in ctx.files.srcs: base = _strip_proto_suffix(src.basename) - outputs = [ - ctx.actions.declare_file("{}/{}.pb.go".format(out_dir, base)), - ctx.actions.declare_file("{}/{}.pb.yarpc.go".format(out_dir, base)), - ctx.actions.declare_file("{}/{}_grpc.pb.go".format(out_dir, base)), - ] + outputs = [ctx.actions.declare_file("{}/{}.pb.go".format(out_dir, base))] + + # protoc-gen-go-grpc and protoc-gen-yarpc-go-v2 only emit a file when the + # source declares at least one service. Message-only contracts (e.g. the + # shared api/base types) set gen_services = False so Bazel does not expect + # outputs that protoc never produces. + if ctx.attr.gen_services: + outputs.append(ctx.actions.declare_file("{}/{}.pb.yarpc.go".format(out_dir, base))) + outputs.append(ctx.actions.declare_file("{}/{}_grpc.pb.go".format(out_dir, base))) all_outputs.extend(outputs) args = ctx.actions.args() for opt in proto_toolchain.protoc_opts: args.add(opt) args.add("--plugin=protoc-gen-go={}".format(ctx.executable._protoc_gen_go.path)) - args.add("--plugin=protoc-gen-go-grpc={}".format(ctx.executable._protoc_gen_go_grpc.path)) - args.add("--plugin=protoc-gen-yarpc-go-v2={}".format(ctx.executable._protoc_gen_yarpc_go.path)) args.add("--go_out={}".format(outputs[0].dirname)) args.add("--go_opt=paths=source_relative") - args.add("--go-grpc_out={}".format(outputs[0].dirname)) - args.add("--go-grpc_opt=paths=source_relative") - args.add("--yarpc-go-v2_out={}".format(outputs[0].dirname)) - args.add("--yarpc-go-v2_opt=paths=source_relative") + if ctx.attr.gen_services: + args.add("--plugin=protoc-gen-go-grpc={}".format(ctx.executable._protoc_gen_go_grpc.path)) + args.add("--plugin=protoc-gen-yarpc-go-v2={}".format(ctx.executable._protoc_gen_yarpc_go.path)) + args.add("--go-grpc_out={}".format(outputs[0].dirname)) + args.add("--go-grpc_opt=paths=source_relative") + args.add("--yarpc-go-v2_out={}".format(outputs[0].dirname)) + args.add("--yarpc-go-v2_opt=paths=source_relative") + + # The source's own directory is listed first so its generated files stay + # flat in out_dir (source_relative output collapses to the basename). The + # exec root is added only when there are imports, so cross-package imports + # written as repo-relative paths (e.g. "api/base/change/proto/change.proto") + # resolve without nesting the primary source's output. args.add("--proto_path={}".format(src.dirname)) + if import_files: + args.add("--proto_path=.") args.add(src.path) ctx.actions.run_shell( - inputs = [src], + inputs = [src] + import_files, outputs = outputs, tools = tools, command = "mkdir -p {out_dir} && {protoc} \"$@\"".format( @@ -69,6 +88,15 @@ go_proto_generated_files = rule( mandatory = True, ), "out_dir": attr.string(mandatory = True), + "imports": attr.label_list( + allow_files = [".proto"], + default = [], + doc = "Imported .proto files made available on the import path but not compiled here.", + ), + "gen_services": attr.bool( + default = True, + doc = "Whether to run the gRPC and YARPC generators. Set False for message-only contracts.", + ), "_protoc_gen_go": attr.label( default = "@org_golang_google_protobuf//cmd/protoc-gen-go", executable = True,