feat: move gRPC code to extra repo

This commit is contained in:
Peter 2023-08-16 17:55:29 +02:00
parent a948684000
commit 748bd2ef32
Signed by: prskr
GPG key ID: C1DB5D2E8DB512F9
14 changed files with 12221 additions and 1 deletions

View file

@ -1,2 +1,40 @@
# api
# Remote execution
Currently remote execution only applies to execution of modules in container.
Theoretically it could also be used e.g. to execute modules on other machines via SCP/SSH.
## Sequence diagram overview
The following sequence diagram illustrates the remote protocol:
```mermaid
sequenceDiagram
client ->>+ executor: StartTaskRequest
client ->> client: listen for executor events
executor ->> executor: Start FS watcher
executor ->> executor: Unmarshal task and execute
loop stream task output & logs
executor -->> client: TaskLog
executor -->> client: TaskOutput
end
executor -->>- client: TaskResult - as soon as execution completes
```
## Execution steps for container tasks
The overall execution looks like this:
1. create container network
1. create container
1. copy buildr binary, tools and content into container
- if input mapping is configured, content is copied as it would be mapped
- if no input mapping is configured complete repository is copied
1. start container with buildr as entrypoint (gRPC server)
1. connect to gRPC server
1. send `StartTaskRequest` specifying what to do - although it's called **TaskRequest** it could be any module
1. server starts a FS watcher to monitor modified files
1. buildr CLI listens for logs and output from executed task
1. as soon as the execution completes, modified files are collected into a .tar.s2 file and error message + location of the archive are sent as result to buildr CLI
1. CLI copies archive back and extracts modified files to output directory

23
buf.gen.yaml Normal file
View file

@ -0,0 +1,23 @@
version: v1
managed:
enabled: true
optimize_for: CODE_SIZE
go_package_prefix:
default: code.icb4dc0.de/buildr/buildr/api
except:
- buf.build/googleapis/googleapis
plugins:
- plugin: buf.build/protocolbuffers/go:v1.31.0
out: ./api/generated/
opt: paths=source_relative
- plugin: buf.build/grpc/go:v1.3.0
out: ./api/generated/
opt:
- paths=source_relative
- require_unimplemented_servers=false
- plugin: buf.build/community/planetscale-vtprotobuf:v0.4.0
out: ./api/generated/
opt:
- features=marshal+unmarshal+size+pool
- paths=source_relative
revision: 1

3
buf.work.yaml Normal file
View file

@ -0,0 +1,3 @@
version: v1
directories:
- .

11
buf.yaml Normal file
View file

@ -0,0 +1,11 @@
version: v1
name: buf.build/buildr/buildr
breaking:
use:
- FILE
lint:
use:
- DEFAULT
except:
- PACKAGE_DIRECTORY_MATCH
allow_comment_ignores: true

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,139 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc (unknown)
// source: rpc/v1/executor.proto
package rpcv1
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
ExecutorService_ExecuteStream_FullMethodName = "/buildr.rpc.v1.ExecutorService/ExecuteStream"
)
// ExecutorServiceClient is the client API for ExecutorService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type ExecutorServiceClient interface {
ExecuteStream(ctx context.Context, opts ...grpc.CallOption) (ExecutorService_ExecuteStreamClient, error)
}
type executorServiceClient struct {
cc grpc.ClientConnInterface
}
func NewExecutorServiceClient(cc grpc.ClientConnInterface) ExecutorServiceClient {
return &executorServiceClient{cc}
}
func (c *executorServiceClient) ExecuteStream(ctx context.Context, opts ...grpc.CallOption) (ExecutorService_ExecuteStreamClient, error) {
stream, err := c.cc.NewStream(ctx, &ExecutorService_ServiceDesc.Streams[0], ExecutorService_ExecuteStream_FullMethodName, opts...)
if err != nil {
return nil, err
}
x := &executorServiceExecuteStreamClient{stream}
return x, nil
}
type ExecutorService_ExecuteStreamClient interface {
Send(*ExecutionClientMessage) error
Recv() (*ExecutionServerMessage, error)
grpc.ClientStream
}
type executorServiceExecuteStreamClient struct {
grpc.ClientStream
}
func (x *executorServiceExecuteStreamClient) Send(m *ExecutionClientMessage) error {
return x.ClientStream.SendMsg(m)
}
func (x *executorServiceExecuteStreamClient) Recv() (*ExecutionServerMessage, error) {
m := new(ExecutionServerMessage)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// ExecutorServiceServer is the server API for ExecutorService service.
// All implementations should embed UnimplementedExecutorServiceServer
// for forward compatibility
type ExecutorServiceServer interface {
ExecuteStream(ExecutorService_ExecuteStreamServer) error
}
// UnimplementedExecutorServiceServer should be embedded to have forward compatible implementations.
type UnimplementedExecutorServiceServer struct {
}
func (UnimplementedExecutorServiceServer) ExecuteStream(ExecutorService_ExecuteStreamServer) error {
return status.Errorf(codes.Unimplemented, "method ExecuteStream not implemented")
}
// UnsafeExecutorServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ExecutorServiceServer will
// result in compilation errors.
type UnsafeExecutorServiceServer interface {
mustEmbedUnimplementedExecutorServiceServer()
}
func RegisterExecutorServiceServer(s grpc.ServiceRegistrar, srv ExecutorServiceServer) {
s.RegisterService(&ExecutorService_ServiceDesc, srv)
}
func _ExecutorService_ExecuteStream_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(ExecutorServiceServer).ExecuteStream(&executorServiceExecuteStreamServer{stream})
}
type ExecutorService_ExecuteStreamServer interface {
Send(*ExecutionServerMessage) error
Recv() (*ExecutionClientMessage, error)
grpc.ServerStream
}
type executorServiceExecuteStreamServer struct {
grpc.ServerStream
}
func (x *executorServiceExecuteStreamServer) Send(m *ExecutionServerMessage) error {
return x.ServerStream.SendMsg(m)
}
func (x *executorServiceExecuteStreamServer) Recv() (*ExecutionClientMessage, error) {
m := new(ExecutionClientMessage)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// ExecutorService_ServiceDesc is the grpc.ServiceDesc for ExecutorService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var ExecutorService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "buildr.rpc.v1.ExecutorService",
HandlerType: (*ExecutorServiceServer)(nil),
Methods: []grpc.MethodDesc{},
Streams: []grpc.StreamDesc{
{
StreamName: "ExecuteStream",
Handler: _ExecutorService_ExecuteStream_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Metadata: "rpc/v1/executor.proto",
}

File diff suppressed because it is too large Load diff

1251
generated/rpc/v1/spec.pb.go Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

659
generated/rpc/v1/wasi.pb.go Normal file
View file

@ -0,0 +1,659 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: rpc/v1/wasi.proto
package rpcv1
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
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)
)
type ProcessStartRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Command string `protobuf:"bytes,1,opt,name=command,proto3" json:"command,omitempty"`
Args []string `protobuf:"bytes,2,rep,name=args,proto3" json:"args,omitempty"`
WorkingDirectory string `protobuf:"bytes,3,opt,name=working_directory,json=workingDirectory,proto3" json:"working_directory,omitempty"`
Environment map[string]string `protobuf:"bytes,4,rep,name=environment,proto3" json:"environment,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
Stdin []byte `protobuf:"bytes,5,opt,name=stdin,proto3" json:"stdin,omitempty"`
}
func (x *ProcessStartRequest) Reset() {
*x = ProcessStartRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_v1_wasi_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ProcessStartRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ProcessStartRequest) ProtoMessage() {}
func (x *ProcessStartRequest) ProtoReflect() protoreflect.Message {
mi := &file_rpc_v1_wasi_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ProcessStartRequest.ProtoReflect.Descriptor instead.
func (*ProcessStartRequest) Descriptor() ([]byte, []int) {
return file_rpc_v1_wasi_proto_rawDescGZIP(), []int{0}
}
func (x *ProcessStartRequest) GetCommand() string {
if x != nil {
return x.Command
}
return ""
}
func (x *ProcessStartRequest) GetArgs() []string {
if x != nil {
return x.Args
}
return nil
}
func (x *ProcessStartRequest) GetWorkingDirectory() string {
if x != nil {
return x.WorkingDirectory
}
return ""
}
func (x *ProcessStartRequest) GetEnvironment() map[string]string {
if x != nil {
return x.Environment
}
return nil
}
func (x *ProcessStartRequest) GetStdin() []byte {
if x != nil {
return x.Stdin
}
return nil
}
type ProcessStartResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ExitCode int32 `protobuf:"varint,1,opt,name=exit_code,json=exitCode,proto3" json:"exit_code,omitempty"`
Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
Stderr []byte `protobuf:"bytes,3,opt,name=stderr,proto3" json:"stderr,omitempty"`
}
func (x *ProcessStartResponse) Reset() {
*x = ProcessStartResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_v1_wasi_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ProcessStartResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ProcessStartResponse) ProtoMessage() {}
func (x *ProcessStartResponse) ProtoReflect() protoreflect.Message {
mi := &file_rpc_v1_wasi_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ProcessStartResponse.ProtoReflect.Descriptor instead.
func (*ProcessStartResponse) Descriptor() ([]byte, []int) {
return file_rpc_v1_wasi_proto_rawDescGZIP(), []int{1}
}
func (x *ProcessStartResponse) GetExitCode() int32 {
if x != nil {
return x.ExitCode
}
return 0
}
func (x *ProcessStartResponse) GetError() string {
if x != nil {
return x.Error
}
return ""
}
func (x *ProcessStartResponse) GetStderr() []byte {
if x != nil {
return x.Stderr
}
return nil
}
type LookupPathRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Command string `protobuf:"bytes,1,opt,name=command,proto3" json:"command,omitempty"`
}
func (x *LookupPathRequest) Reset() {
*x = LookupPathRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_v1_wasi_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LookupPathRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LookupPathRequest) ProtoMessage() {}
func (x *LookupPathRequest) ProtoReflect() protoreflect.Message {
mi := &file_rpc_v1_wasi_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LookupPathRequest.ProtoReflect.Descriptor instead.
func (*LookupPathRequest) Descriptor() ([]byte, []int) {
return file_rpc_v1_wasi_proto_rawDescGZIP(), []int{2}
}
func (x *LookupPathRequest) GetCommand() string {
if x != nil {
return x.Command
}
return ""
}
type LookupPathResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
}
func (x *LookupPathResponse) Reset() {
*x = LookupPathResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_v1_wasi_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LookupPathResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LookupPathResponse) ProtoMessage() {}
func (x *LookupPathResponse) ProtoReflect() protoreflect.Message {
mi := &file_rpc_v1_wasi_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LookupPathResponse.ProtoReflect.Descriptor instead.
func (*LookupPathResponse) Descriptor() ([]byte, []int) {
return file_rpc_v1_wasi_proto_rawDescGZIP(), []int{3}
}
func (x *LookupPathResponse) GetPath() string {
if x != nil {
return x.Path
}
return ""
}
func (x *LookupPathResponse) GetError() string {
if x != nil {
return x.Error
}
return ""
}
type HelpRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ModuleReference *ModuleReference `protobuf:"bytes,1,opt,name=module_reference,json=moduleReference,proto3" json:"module_reference,omitempty"`
}
func (x *HelpRequest) Reset() {
*x = HelpRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_v1_wasi_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *HelpRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*HelpRequest) ProtoMessage() {}
func (x *HelpRequest) ProtoReflect() protoreflect.Message {
mi := &file_rpc_v1_wasi_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use HelpRequest.ProtoReflect.Descriptor instead.
func (*HelpRequest) Descriptor() ([]byte, []int) {
return file_rpc_v1_wasi_proto_rawDescGZIP(), []int{4}
}
func (x *HelpRequest) GetModuleReference() *ModuleReference {
if x != nil {
return x.ModuleReference
}
return nil
}
type TaskExample struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
TaskSpec *TaskSpec `protobuf:"bytes,3,opt,name=task_spec,json=taskSpec,proto3" json:"task_spec,omitempty"`
}
func (x *TaskExample) Reset() {
*x = TaskExample{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_v1_wasi_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TaskExample) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TaskExample) ProtoMessage() {}
func (x *TaskExample) ProtoReflect() protoreflect.Message {
mi := &file_rpc_v1_wasi_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TaskExample.ProtoReflect.Descriptor instead.
func (*TaskExample) Descriptor() ([]byte, []int) {
return file_rpc_v1_wasi_proto_rawDescGZIP(), []int{5}
}
func (x *TaskExample) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *TaskExample) GetDescription() string {
if x != nil {
return x.Description
}
return ""
}
func (x *TaskExample) GetTaskSpec() *TaskSpec {
if x != nil {
return x.TaskSpec
}
return nil
}
type HelpResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
Examples []*TaskExample `protobuf:"bytes,3,rep,name=examples,proto3" json:"examples,omitempty"`
}
func (x *HelpResponse) Reset() {
*x = HelpResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_v1_wasi_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *HelpResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*HelpResponse) ProtoMessage() {}
func (x *HelpResponse) ProtoReflect() protoreflect.Message {
mi := &file_rpc_v1_wasi_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use HelpResponse.ProtoReflect.Descriptor instead.
func (*HelpResponse) Descriptor() ([]byte, []int) {
return file_rpc_v1_wasi_proto_rawDescGZIP(), []int{6}
}
func (x *HelpResponse) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *HelpResponse) GetDescription() string {
if x != nil {
return x.Description
}
return ""
}
func (x *HelpResponse) GetExamples() []*TaskExample {
if x != nil {
return x.Examples
}
return nil
}
var File_rpc_v1_wasi_proto protoreflect.FileDescriptor
var file_rpc_v1_wasi_proto_rawDesc = []byte{
0x0a, 0x11, 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x61, 0x73, 0x69, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x2e, 0x72, 0x70, 0x63, 0x2e,
0x76, 0x31, 0x1a, 0x11, 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x70, 0x65, 0x63, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9d, 0x02, 0x0a, 0x13, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73,
0x73, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a,
0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18,
0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x77,
0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x77, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x44,
0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x55, 0x0a, 0x0b, 0x65, 0x6e, 0x76, 0x69,
0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x33, 0x2e,
0x62, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72,
0x6f, 0x63, 0x65, 0x73, 0x73, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x2e, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x45, 0x6e, 0x74,
0x72, 0x79, 0x52, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12,
0x14, 0x0a, 0x05, 0x73, 0x74, 0x64, 0x69, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05,
0x73, 0x74, 0x64, 0x69, 0x6e, 0x1a, 0x3e, 0x0a, 0x10, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e,
0x6d, 0x65, 0x6e, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76,
0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x61, 0x0a, 0x14, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73,
0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1b, 0x0a,
0x09, 0x65, 0x78, 0x69, 0x74, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
0x52, 0x08, 0x65, 0x78, 0x69, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72,
0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72,
0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x64, 0x65, 0x72, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c,
0x52, 0x06, 0x73, 0x74, 0x64, 0x65, 0x72, 0x72, 0x22, 0x2d, 0x0a, 0x11, 0x4c, 0x6f, 0x6f, 0x6b,
0x75, 0x70, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a,
0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x22, 0x3e, 0x0a, 0x12, 0x4c, 0x6f, 0x6f, 0x6b, 0x75,
0x70, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a,
0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74,
0x68, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x58, 0x0a, 0x0b, 0x48, 0x65, 0x6c, 0x70, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x49, 0x0a, 0x10, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65,
0x5f, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x1e, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31,
0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65,
0x52, 0x0f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63,
0x65, 0x22, 0x79, 0x0a, 0x0b, 0x54, 0x61, 0x73, 0x6b, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65,
0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72,
0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x34, 0x0a, 0x09, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x73,
0x70, 0x65, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x62, 0x75, 0x69, 0x6c,
0x64, 0x72, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x70,
0x65, 0x63, 0x52, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x70, 0x65, 0x63, 0x22, 0x7c, 0x0a, 0x0c,
0x48, 0x65, 0x6c, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04,
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69,
0x6f, 0x6e, 0x12, 0x36, 0x0a, 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x18, 0x03,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x2e, 0x72, 0x70,
0x63, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65,
0x52, 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x42, 0xa6, 0x01, 0x0a, 0x11, 0x63,
0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31,
0x42, 0x09, 0x57, 0x61, 0x73, 0x69, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x48, 0x02, 0x50, 0x01, 0x5a,
0x2e, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x69, 0x63, 0x62, 0x34, 0x64, 0x63, 0x30, 0x2e, 0x64, 0x65,
0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x2f, 0x61,
0x70, 0x69, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, 0x3b, 0x72, 0x70, 0x63, 0x76, 0x31, 0xa2,
0x02, 0x03, 0x42, 0x52, 0x58, 0xaa, 0x02, 0x0d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x2e, 0x52,
0x70, 0x63, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x5c, 0x52,
0x70, 0x63, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x5c, 0x52,
0x70, 0x63, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,
0x61, 0xea, 0x02, 0x0f, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x3a, 0x3a, 0x52, 0x70, 0x63, 0x3a,
0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_rpc_v1_wasi_proto_rawDescOnce sync.Once
file_rpc_v1_wasi_proto_rawDescData = file_rpc_v1_wasi_proto_rawDesc
)
func file_rpc_v1_wasi_proto_rawDescGZIP() []byte {
file_rpc_v1_wasi_proto_rawDescOnce.Do(func() {
file_rpc_v1_wasi_proto_rawDescData = protoimpl.X.CompressGZIP(file_rpc_v1_wasi_proto_rawDescData)
})
return file_rpc_v1_wasi_proto_rawDescData
}
var file_rpc_v1_wasi_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_rpc_v1_wasi_proto_goTypes = []interface{}{
(*ProcessStartRequest)(nil), // 0: buildr.rpc.v1.ProcessStartRequest
(*ProcessStartResponse)(nil), // 1: buildr.rpc.v1.ProcessStartResponse
(*LookupPathRequest)(nil), // 2: buildr.rpc.v1.LookupPathRequest
(*LookupPathResponse)(nil), // 3: buildr.rpc.v1.LookupPathResponse
(*HelpRequest)(nil), // 4: buildr.rpc.v1.HelpRequest
(*TaskExample)(nil), // 5: buildr.rpc.v1.TaskExample
(*HelpResponse)(nil), // 6: buildr.rpc.v1.HelpResponse
nil, // 7: buildr.rpc.v1.ProcessStartRequest.EnvironmentEntry
(*ModuleReference)(nil), // 8: buildr.rpc.v1.ModuleReference
(*TaskSpec)(nil), // 9: buildr.rpc.v1.TaskSpec
}
var file_rpc_v1_wasi_proto_depIdxs = []int32{
7, // 0: buildr.rpc.v1.ProcessStartRequest.environment:type_name -> buildr.rpc.v1.ProcessStartRequest.EnvironmentEntry
8, // 1: buildr.rpc.v1.HelpRequest.module_reference:type_name -> buildr.rpc.v1.ModuleReference
9, // 2: buildr.rpc.v1.TaskExample.task_spec:type_name -> buildr.rpc.v1.TaskSpec
5, // 3: buildr.rpc.v1.HelpResponse.examples:type_name -> buildr.rpc.v1.TaskExample
4, // [4:4] is the sub-list for method output_type
4, // [4:4] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
}
func init() { file_rpc_v1_wasi_proto_init() }
func file_rpc_v1_wasi_proto_init() {
if File_rpc_v1_wasi_proto != nil {
return
}
file_rpc_v1_spec_proto_init()
if !protoimpl.UnsafeEnabled {
file_rpc_v1_wasi_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ProcessStartRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_rpc_v1_wasi_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ProcessStartResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_rpc_v1_wasi_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LookupPathRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_rpc_v1_wasi_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LookupPathResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_rpc_v1_wasi_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*HelpRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_rpc_v1_wasi_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TaskExample); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_rpc_v1_wasi_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*HelpResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_rpc_v1_wasi_proto_rawDesc,
NumEnums: 0,
NumMessages: 8,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_rpc_v1_wasi_proto_goTypes,
DependencyIndexes: file_rpc_v1_wasi_proto_depIdxs,
MessageInfos: file_rpc_v1_wasi_proto_msgTypes,
}.Build()
File_rpc_v1_wasi_proto = out.File
file_rpc_v1_wasi_proto_rawDesc = nil
file_rpc_v1_wasi_proto_goTypes = nil
file_rpc_v1_wasi_proto_depIdxs = nil
}

File diff suppressed because it is too large Load diff

114
rpc/v1/executor.proto Normal file
View file

@ -0,0 +1,114 @@
syntax = "proto3";
package buildr.rpc.v1;
import "rpc/v1/spec.proto";
message Buildr {
message Repo {
string root = 1;
}
message GitHub {
string api_token = 1;
}
Repo repo = 1;
GitHub github = 2;
string bin_dir = 3;
string out_dir = 4;
}
message TaskReference {
string id = 1;
string name = 2;
ModuleReference module = 3;
}
message StartTaskRequest {
TaskReference reference = 1;
Buildr buildr = 2;
ModuleSpec spec = 3;
}
message TaskResult {
string error = 1;
string modified_files_archive_path = 2;
}
enum TaskOutputSource {
TASK_OUTPUT_SOURCE_UNSPECIFIED = 0;
TASK_OUTPUT_SOURCE_STDOUT = 1;
TASK_OUTPUT_SOURCE_STDERR = 2;
}
message TaskOutput {
TaskOutputSource source = 1;
bytes payload = 2;
}
message TaskLog {
message LogAttribute {
string key = 1;
string value = 2;
}
int64 time = 1;
string message = 2;
int32 level = 3;
repeated LogAttribute attributes = 4;
}
message SetState {
bytes key = 1;
bytes data = 2;
}
message GetStateRequest {
bytes key = 1;
}
message GetStateResponse {
bytes key = 1;
bytes data = 2;
}
message Result {
bool success = 1;
string error = 2;
}
message PluginInventory {
repeated ModuleReference modules = 1;
}
message ExecutionClientMessage {
oneof meta {
bytes message_id = 1;
bytes replies_to = 2;
}
oneof envelope {
StartTaskRequest start_task = 11;
GetStateResponse get_state = 12;
Result error = 13;
}
}
message ExecutionServerMessage {
oneof meta {
bytes message_id = 1;
bytes replies_to = 2;
}
oneof envelope {
TaskResult task_result = 11;
TaskLog task_log = 12;
TaskOutput task_output = 13;
GetStateRequest get_state = 14;
SetState set_state = 15;
}
}
service ExecutorService {
rpc ExecuteStream(stream ExecutionClientMessage) returns (stream ExecutionServerMessage);
}

100
rpc/v1/spec.proto Normal file
View file

@ -0,0 +1,100 @@
syntax = "proto3";
package buildr.rpc.v1;
enum Category {
CategoryUnknown = 0;
CategoryTool = 1;
CategoryTask = 2;
CategoryBuild = 3;
CategoryPackage = 4;
}
message ModuleReference {
Category module_category = 1;
string module_type = 2;
}
message ModuleSpec {
enum ValueKind {
ValueKindUnknown = 0;
ValueKindAttribute = 1;
ValueKindLabel = 2;
ValueKindBlock = 4;
}
enum ValueType {
ValueTypeUnknown = 0;
ValueTypeSingle = 1;
ValueTypeObject = 2;
ValueTypeMap = 3;
ValueTypeStringSlice = 4;
ValueTypeIntSlice = 5;
ValueTypeDoubleSlice = 6;
ValueTypeBoolSlice = 7;
}
message Value {
ValueType type = 1;
ValueKind kind = 2;
map<string, Value> complex_value = 10;
oneof single_value {
string string_value = 11;
int64 int_value = 12;
double double_value = 13;
bool bool_value = 14;
}
repeated string string_values = 21;
repeated int64 int_values = 22;
repeated double double_values = 23;
repeated bool bool_values = 24;
}
Category category = 1;
string type = 2;
map<string, Value> values = 3;
}
message ContainerCapabilities {
repeated string add = 1;
repeated string drop = 2;
}
message ContainerBindMount {
string target = 1;
string source = 2;
bool read_only = 3;
}
message ContainerTmpfsMount {
string target = 1;
int64 size = 2;
bool read_only = 3;
}
message ContainerVolumeMount {
string target = 1;
string name = 2;
bool read_only = 3;
bool no_copy = 4;
}
message ContainerSpec {
string image = 1;
string user = 2;
bool privileged = 3;
ContainerCapabilities capabilities = 4;
repeated ContainerVolumeMount volume_mounts = 5;
repeated ContainerTmpfsMount tmpfs_mounts = 6;
repeated ContainerBindMount bind_mounts = 7;
}
message TaskSpec {
string module_name = 1;
ModuleSpec module_spec = 2;
ContainerSpec container = 3;
string output_dir = 4;
}

44
rpc/v1/wasi.proto Normal file
View file

@ -0,0 +1,44 @@
syntax = "proto3";
package buildr.rpc.v1;
import "rpc/v1/spec.proto";
message ProcessStartRequest {
string command = 1;
repeated string args = 2;
string working_directory = 3;
map<string, string> environment = 4;
bytes stdin = 5;
}
message ProcessStartResponse {
int32 exit_code = 1;
string error = 2;
bytes stderr = 3;
}
message LookupPathRequest {
string command = 1;
}
message LookupPathResponse {
string path = 1;
string error = 2;
}
message HelpRequest {
ModuleReference module_reference = 1;
}
message TaskExample {
string name = 1;
string description = 2;
TaskSpec task_spec = 3;
}
message HelpResponse {
string name = 1;
string description = 2;
repeated TaskExample examples = 3;
}