diff --git a/agent/rpc/client_grpc.go b/agent/rpc/client_grpc.go index 2ae418444..81189cd42 100644 --- a/agent/rpc/client_grpc.go +++ b/agent/rpc/client_grpc.go @@ -1,3 +1,17 @@ +// Copyright 2023 Woodpecker Authors +// +// 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. + package rpc import ( @@ -18,6 +32,9 @@ import ( var backoff = time.Second +// set grpc version on compile time to compare against server version response +const ClientGrpcVersion int32 = proto.Version + type client struct { client proto.WoodpeckerClient conn *grpc.ClientConn @@ -35,9 +52,21 @@ func (c *client) Close() error { return c.conn.Close() } +// Version returns the server- & grpc-version +func (c *client) Version(ctx context.Context) (*rpc.Version, error) { + res, err := c.client.Version(ctx, &proto.Empty{}) + if err != nil { + return nil, err + } + return &rpc.Version{ + GrpcVersion: res.GrpcVersion, + ServerVersion: res.ServerVersion, + }, nil +} + // Next returns the next pipeline in the queue. func (c *client) Next(ctx context.Context, f rpc.Filter) (*rpc.Pipeline, error) { - var res *proto.NextReply + var res *proto.NextResponse var err error req := new(proto.NextRequest) req.Filter = new(proto.Filter) diff --git a/cmd/agent/agent.go b/cmd/agent/agent.go index e04fe471c..52a4d53f7 100644 --- a/cmd/agent/agent.go +++ b/cmd/agent/agent.go @@ -1,3 +1,4 @@ +// Copyright 2023 Woodpecker Authors // Copyright 2018 Drone.IO Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,6 +18,7 @@ package main import ( "context" "crypto/tls" + "errors" "net/http" "os" "runtime" @@ -154,6 +156,21 @@ func loop(c *cli.Context) error { sigterm.Set() }) + // check if grpc server version is compatible with agent + grpcServerVersion, err := client.Version(ctx) + if err != nil { + log.Error().Err(err).Msg("could not get grpc server version") + return err + } + if grpcServerVersion.GrpcVersion != agentRpc.ClientGrpcVersion { + err := errors.New("GRPC version mismatch") + log.Error().Err(err).Msgf("Server version %s does report grpc version %d but we only understand %d", + grpcServerVersion.ServerVersion, + grpcServerVersion.GrpcVersion, + agentRpc.ClientGrpcVersion) + return err + } + backendCtx := context.WithValue(ctx, types.CliContext, c) backend.Init(backendCtx) diff --git a/pipeline/option_test.go b/pipeline/option_test.go deleted file mode 100644 index fb2071c7f..000000000 --- a/pipeline/option_test.go +++ /dev/null @@ -1 +0,0 @@ -package pipeline diff --git a/pipeline/rpc/line.go b/pipeline/rpc/line.go index 2147f1148..f30c20272 100644 --- a/pipeline/rpc/line.go +++ b/pipeline/rpc/line.go @@ -1,3 +1,18 @@ +// Copyright 2022 Woodpecker Authors +// Copyright 2011 Drone.IO 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. + package rpc import ( diff --git a/pipeline/rpc/line_test.go b/pipeline/rpc/line_test.go index 15e70db9e..1469b5d9c 100644 --- a/pipeline/rpc/line_test.go +++ b/pipeline/rpc/line_test.go @@ -1,3 +1,17 @@ +// Copyright 2019 Woodpecker Authors +// +// 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. + package rpc import ( diff --git a/pipeline/rpc/peer.go b/pipeline/rpc/peer.go index 4739a5ee1..4681c7702 100644 --- a/pipeline/rpc/peer.go +++ b/pipeline/rpc/peer.go @@ -1,3 +1,18 @@ +// Copyright 2021 Woodpecker Authors +// Copyright 2011 Drone.IO 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. + package rpc import ( @@ -39,10 +54,18 @@ type ( Data []byte `json:"data"` Meta map[string]string `json:"meta"` } + + Version struct { + GrpcVersion int32 `json:"grpc_version,omitempty"` + ServerVersion string `json:"server_version,omitempty"` + } ) // Peer defines a peer-to-peer connection. type Peer interface { + // Version returns the server- & grpc-version + Version(c context.Context) (*Version, error) + // Next returns the next pipeline in the queue. Next(c context.Context, f Filter) (*Pipeline, error) diff --git a/pipeline/rpc/proto/version.go b/pipeline/rpc/proto/version.go new file mode 100644 index 000000000..0d85ffdea --- /dev/null +++ b/pipeline/rpc/proto/version.go @@ -0,0 +1,19 @@ +// Copyright 2023 Woodpecker Authors +// +// 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. + +package proto + +// Version is the version of the woodpecker.proto file, +// !IMPORTANT! increased by 1 each time it get changed !IMPORTANT! +const Version int32 = 1 diff --git a/pipeline/rpc/proto/woodpecker.pb.go b/pipeline/rpc/proto/woodpecker.pb.go index e716db976..afe4891bc 100644 --- a/pipeline/rpc/proto/woodpecker.pb.go +++ b/pipeline/rpc/proto/woodpecker.pb.go @@ -1,3 +1,18 @@ +// Copyright 2021 Woodpecker Authors +// Copyright 2011 Drone.IO 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.30.0 @@ -7,11 +22,10 @@ package proto import ( - reflect "reflect" - sync "sync" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) const ( @@ -431,53 +445,6 @@ func (x *NextRequest) GetFilter() *Filter { return nil } -type NextReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Pipeline *Pipeline `protobuf:"bytes,1,opt,name=pipeline,proto3" json:"pipeline,omitempty"` -} - -func (x *NextReply) Reset() { - *x = NextReply{} - if protoimpl.UnsafeEnabled { - mi := &file_woodpecker_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NextReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NextReply) ProtoMessage() {} - -func (x *NextReply) ProtoReflect() protoreflect.Message { - mi := &file_woodpecker_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 NextReply.ProtoReflect.Descriptor instead. -func (*NextReply) Descriptor() ([]byte, []int) { - return file_woodpecker_proto_rawDescGZIP(), []int{6} -} - -func (x *NextReply) GetPipeline() *Pipeline { - if x != nil { - return x.Pipeline - } - return nil -} - type InitRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -490,7 +457,7 @@ type InitRequest struct { func (x *InitRequest) Reset() { *x = InitRequest{} if protoimpl.UnsafeEnabled { - mi := &file_woodpecker_proto_msgTypes[7] + mi := &file_woodpecker_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -503,7 +470,7 @@ func (x *InitRequest) String() string { func (*InitRequest) ProtoMessage() {} func (x *InitRequest) ProtoReflect() protoreflect.Message { - mi := &file_woodpecker_proto_msgTypes[7] + mi := &file_woodpecker_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -516,7 +483,7 @@ func (x *InitRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use InitRequest.ProtoReflect.Descriptor instead. func (*InitRequest) Descriptor() ([]byte, []int) { - return file_woodpecker_proto_rawDescGZIP(), []int{7} + return file_woodpecker_proto_rawDescGZIP(), []int{6} } func (x *InitRequest) GetId() string { @@ -544,7 +511,7 @@ type WaitRequest struct { func (x *WaitRequest) Reset() { *x = WaitRequest{} if protoimpl.UnsafeEnabled { - mi := &file_woodpecker_proto_msgTypes[8] + mi := &file_woodpecker_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -557,7 +524,7 @@ func (x *WaitRequest) String() string { func (*WaitRequest) ProtoMessage() {} func (x *WaitRequest) ProtoReflect() protoreflect.Message { - mi := &file_woodpecker_proto_msgTypes[8] + mi := &file_woodpecker_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -570,7 +537,7 @@ func (x *WaitRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use WaitRequest.ProtoReflect.Descriptor instead. func (*WaitRequest) Descriptor() ([]byte, []int) { - return file_woodpecker_proto_rawDescGZIP(), []int{8} + return file_woodpecker_proto_rawDescGZIP(), []int{7} } func (x *WaitRequest) GetId() string { @@ -592,7 +559,7 @@ type DoneRequest struct { func (x *DoneRequest) Reset() { *x = DoneRequest{} if protoimpl.UnsafeEnabled { - mi := &file_woodpecker_proto_msgTypes[9] + mi := &file_woodpecker_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -605,7 +572,7 @@ func (x *DoneRequest) String() string { func (*DoneRequest) ProtoMessage() {} func (x *DoneRequest) ProtoReflect() protoreflect.Message { - mi := &file_woodpecker_proto_msgTypes[9] + mi := &file_woodpecker_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -618,7 +585,7 @@ func (x *DoneRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DoneRequest.ProtoReflect.Descriptor instead. func (*DoneRequest) Descriptor() ([]byte, []int) { - return file_woodpecker_proto_rawDescGZIP(), []int{9} + return file_woodpecker_proto_rawDescGZIP(), []int{8} } func (x *DoneRequest) GetId() string { @@ -646,7 +613,7 @@ type ExtendRequest struct { func (x *ExtendRequest) Reset() { *x = ExtendRequest{} if protoimpl.UnsafeEnabled { - mi := &file_woodpecker_proto_msgTypes[10] + mi := &file_woodpecker_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -659,7 +626,7 @@ func (x *ExtendRequest) String() string { func (*ExtendRequest) ProtoMessage() {} func (x *ExtendRequest) ProtoReflect() protoreflect.Message { - mi := &file_woodpecker_proto_msgTypes[10] + mi := &file_woodpecker_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -672,7 +639,7 @@ func (x *ExtendRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ExtendRequest.ProtoReflect.Descriptor instead. func (*ExtendRequest) Descriptor() ([]byte, []int) { - return file_woodpecker_proto_rawDescGZIP(), []int{10} + return file_woodpecker_proto_rawDescGZIP(), []int{9} } func (x *ExtendRequest) GetId() string { @@ -694,7 +661,7 @@ type UploadRequest struct { func (x *UploadRequest) Reset() { *x = UploadRequest{} if protoimpl.UnsafeEnabled { - mi := &file_woodpecker_proto_msgTypes[11] + mi := &file_woodpecker_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -707,7 +674,7 @@ func (x *UploadRequest) String() string { func (*UploadRequest) ProtoMessage() {} func (x *UploadRequest) ProtoReflect() protoreflect.Message { - mi := &file_woodpecker_proto_msgTypes[11] + mi := &file_woodpecker_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -720,7 +687,7 @@ func (x *UploadRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UploadRequest.ProtoReflect.Descriptor instead. func (*UploadRequest) Descriptor() ([]byte, []int) { - return file_woodpecker_proto_rawDescGZIP(), []int{11} + return file_woodpecker_proto_rawDescGZIP(), []int{10} } func (x *UploadRequest) GetId() string { @@ -749,7 +716,7 @@ type UpdateRequest struct { func (x *UpdateRequest) Reset() { *x = UpdateRequest{} if protoimpl.UnsafeEnabled { - mi := &file_woodpecker_proto_msgTypes[12] + mi := &file_woodpecker_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -762,7 +729,7 @@ func (x *UpdateRequest) String() string { func (*UpdateRequest) ProtoMessage() {} func (x *UpdateRequest) ProtoReflect() protoreflect.Message { - mi := &file_woodpecker_proto_msgTypes[12] + mi := &file_woodpecker_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -775,7 +742,7 @@ func (x *UpdateRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateRequest.ProtoReflect.Descriptor instead. func (*UpdateRequest) Descriptor() ([]byte, []int) { - return file_woodpecker_proto_rawDescGZIP(), []int{12} + return file_woodpecker_proto_rawDescGZIP(), []int{11} } func (x *UpdateRequest) GetId() string { @@ -804,7 +771,7 @@ type LogRequest struct { func (x *LogRequest) Reset() { *x = LogRequest{} if protoimpl.UnsafeEnabled { - mi := &file_woodpecker_proto_msgTypes[13] + mi := &file_woodpecker_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -817,7 +784,7 @@ func (x *LogRequest) String() string { func (*LogRequest) ProtoMessage() {} func (x *LogRequest) ProtoReflect() protoreflect.Message { - mi := &file_woodpecker_proto_msgTypes[13] + mi := &file_woodpecker_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -830,7 +797,7 @@ func (x *LogRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use LogRequest.ProtoReflect.Descriptor instead. func (*LogRequest) Descriptor() ([]byte, []int) { - return file_woodpecker_proto_rawDescGZIP(), []int{13} + return file_woodpecker_proto_rawDescGZIP(), []int{12} } func (x *LogRequest) GetId() string { @@ -856,7 +823,7 @@ type Empty struct { func (x *Empty) Reset() { *x = Empty{} if protoimpl.UnsafeEnabled { - mi := &file_woodpecker_proto_msgTypes[14] + mi := &file_woodpecker_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -869,7 +836,7 @@ func (x *Empty) String() string { func (*Empty) ProtoMessage() {} func (x *Empty) ProtoReflect() protoreflect.Message { - mi := &file_woodpecker_proto_msgTypes[14] + mi := &file_woodpecker_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -882,7 +849,7 @@ func (x *Empty) ProtoReflect() protoreflect.Message { // Deprecated: Use Empty.ProtoReflect.Descriptor instead. func (*Empty) Descriptor() ([]byte, []int) { - return file_woodpecker_proto_rawDescGZIP(), []int{14} + return file_woodpecker_proto_rawDescGZIP(), []int{13} } type ReportHealthRequest struct { @@ -896,7 +863,7 @@ type ReportHealthRequest struct { func (x *ReportHealthRequest) Reset() { *x = ReportHealthRequest{} if protoimpl.UnsafeEnabled { - mi := &file_woodpecker_proto_msgTypes[15] + mi := &file_woodpecker_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -909,7 +876,7 @@ func (x *ReportHealthRequest) String() string { func (*ReportHealthRequest) ProtoMessage() {} func (x *ReportHealthRequest) ProtoReflect() protoreflect.Message { - mi := &file_woodpecker_proto_msgTypes[15] + mi := &file_woodpecker_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -922,7 +889,7 @@ func (x *ReportHealthRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ReportHealthRequest.ProtoReflect.Descriptor instead. func (*ReportHealthRequest) Descriptor() ([]byte, []int) { - return file_woodpecker_proto_rawDescGZIP(), []int{15} + return file_woodpecker_proto_rawDescGZIP(), []int{14} } func (x *ReportHealthRequest) GetStatus() string { @@ -946,7 +913,7 @@ type RegisterAgentRequest struct { func (x *RegisterAgentRequest) Reset() { *x = RegisterAgentRequest{} if protoimpl.UnsafeEnabled { - mi := &file_woodpecker_proto_msgTypes[16] + mi := &file_woodpecker_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -959,7 +926,7 @@ func (x *RegisterAgentRequest) String() string { func (*RegisterAgentRequest) ProtoMessage() {} func (x *RegisterAgentRequest) ProtoReflect() protoreflect.Message { - mi := &file_woodpecker_proto_msgTypes[16] + mi := &file_woodpecker_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -972,7 +939,7 @@ func (x *RegisterAgentRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use RegisterAgentRequest.ProtoReflect.Descriptor instead. func (*RegisterAgentRequest) Descriptor() ([]byte, []int) { - return file_woodpecker_proto_rawDescGZIP(), []int{16} + return file_woodpecker_proto_rawDescGZIP(), []int{15} } func (x *RegisterAgentRequest) GetPlatform() string { @@ -1003,6 +970,108 @@ func (x *RegisterAgentRequest) GetVersion() string { return "" } +type VersionResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + GrpcVersion int32 `protobuf:"varint,1,opt,name=grpc_version,json=grpcVersion,proto3" json:"grpc_version,omitempty"` + ServerVersion string `protobuf:"bytes,2,opt,name=server_version,json=serverVersion,proto3" json:"server_version,omitempty"` +} + +func (x *VersionResponse) Reset() { + *x = VersionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_woodpecker_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VersionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VersionResponse) ProtoMessage() {} + +func (x *VersionResponse) ProtoReflect() protoreflect.Message { + mi := &file_woodpecker_proto_msgTypes[16] + 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 VersionResponse.ProtoReflect.Descriptor instead. +func (*VersionResponse) Descriptor() ([]byte, []int) { + return file_woodpecker_proto_rawDescGZIP(), []int{16} +} + +func (x *VersionResponse) GetGrpcVersion() int32 { + if x != nil { + return x.GrpcVersion + } + return 0 +} + +func (x *VersionResponse) GetServerVersion() string { + if x != nil { + return x.ServerVersion + } + return "" +} + +type NextResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pipeline *Pipeline `protobuf:"bytes,1,opt,name=pipeline,proto3" json:"pipeline,omitempty"` +} + +func (x *NextResponse) Reset() { + *x = NextResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_woodpecker_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NextResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NextResponse) ProtoMessage() {} + +func (x *NextResponse) ProtoReflect() protoreflect.Message { + mi := &file_woodpecker_proto_msgTypes[17] + 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 NextResponse.ProtoReflect.Descriptor instead. +func (*NextResponse) Descriptor() ([]byte, []int) { + return file_woodpecker_proto_rawDescGZIP(), []int{17} +} + +func (x *NextResponse) GetPipeline() *Pipeline { + if x != nil { + return x.Pipeline + } + return nil +} + type RegisterAgentResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1014,7 +1083,7 @@ type RegisterAgentResponse struct { func (x *RegisterAgentResponse) Reset() { *x = RegisterAgentResponse{} if protoimpl.UnsafeEnabled { - mi := &file_woodpecker_proto_msgTypes[17] + mi := &file_woodpecker_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1027,7 +1096,7 @@ func (x *RegisterAgentResponse) String() string { func (*RegisterAgentResponse) ProtoMessage() {} func (x *RegisterAgentResponse) ProtoReflect() protoreflect.Message { - mi := &file_woodpecker_proto_msgTypes[17] + mi := &file_woodpecker_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1040,7 +1109,7 @@ func (x *RegisterAgentResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use RegisterAgentResponse.ProtoReflect.Descriptor instead. func (*RegisterAgentResponse) Descriptor() ([]byte, []int) { - return file_woodpecker_proto_rawDescGZIP(), []int{17} + return file_woodpecker_proto_rawDescGZIP(), []int{18} } func (x *RegisterAgentResponse) GetAgentId() int64 { @@ -1062,7 +1131,7 @@ type AuthRequest struct { func (x *AuthRequest) Reset() { *x = AuthRequest{} if protoimpl.UnsafeEnabled { - mi := &file_woodpecker_proto_msgTypes[18] + mi := &file_woodpecker_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1075,7 +1144,7 @@ func (x *AuthRequest) String() string { func (*AuthRequest) ProtoMessage() {} func (x *AuthRequest) ProtoReflect() protoreflect.Message { - mi := &file_woodpecker_proto_msgTypes[18] + mi := &file_woodpecker_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1088,7 +1157,7 @@ func (x *AuthRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AuthRequest.ProtoReflect.Descriptor instead. func (*AuthRequest) Descriptor() ([]byte, []int) { - return file_woodpecker_proto_rawDescGZIP(), []int{18} + return file_woodpecker_proto_rawDescGZIP(), []int{19} } func (x *AuthRequest) GetAgentToken() string { @@ -1105,7 +1174,7 @@ func (x *AuthRequest) GetAgentId() int64 { return 0 } -type AuthReply struct { +type AuthResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -1115,23 +1184,23 @@ type AuthReply struct { AccessToken string `protobuf:"bytes,3,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` } -func (x *AuthReply) Reset() { - *x = AuthReply{} +func (x *AuthResponse) Reset() { + *x = AuthResponse{} if protoimpl.UnsafeEnabled { - mi := &file_woodpecker_proto_msgTypes[19] + mi := &file_woodpecker_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *AuthReply) String() string { +func (x *AuthResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*AuthReply) ProtoMessage() {} +func (*AuthResponse) ProtoMessage() {} -func (x *AuthReply) ProtoReflect() protoreflect.Message { - mi := &file_woodpecker_proto_msgTypes[19] +func (x *AuthResponse) ProtoReflect() protoreflect.Message { + mi := &file_woodpecker_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1142,26 +1211,26 @@ func (x *AuthReply) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use AuthReply.ProtoReflect.Descriptor instead. -func (*AuthReply) Descriptor() ([]byte, []int) { - return file_woodpecker_proto_rawDescGZIP(), []int{19} +// Deprecated: Use AuthResponse.ProtoReflect.Descriptor instead. +func (*AuthResponse) Descriptor() ([]byte, []int) { + return file_woodpecker_proto_rawDescGZIP(), []int{20} } -func (x *AuthReply) GetStatus() string { +func (x *AuthResponse) GetStatus() string { if x != nil { return x.Status } return "" } -func (x *AuthReply) GetAgentId() int64 { +func (x *AuthResponse) GetAgentId() int64 { if x != nil { return x.AgentId } return 0 } -func (x *AuthReply) GetAccessToken() string { +func (x *AuthResponse) GetAccessToken() string { if x != nil { return x.AccessToken } @@ -1218,47 +1287,53 @@ var file_woodpecker_proto_rawDesc = []byte{ 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x25, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x22, - 0x38, 0x0a, 0x09, 0x4e, 0x65, 0x78, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x2b, 0x0a, 0x08, - 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, - 0x08, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x22, 0x41, 0x0a, 0x0b, 0x49, 0x6e, 0x69, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x41, 0x0a, 0x0b, 0x49, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x22, + 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, + 0x74, 0x65, 0x22, 0x1d, 0x0a, 0x0b, 0x57, 0x61, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, + 0x64, 0x22, 0x41, 0x0a, 0x0b, 0x44, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, + 0x12, 0x22, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, + 0x74, 0x61, 0x74, 0x65, 0x22, 0x1f, 0x0a, 0x0d, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x40, 0x0a, 0x0d, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x69, 0x6c, + 0x65, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x22, 0x43, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x22, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x1d, 0x0a, 0x0b, - 0x57, 0x61, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x41, 0x0a, 0x0b, 0x44, - 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x22, 0x0a, 0x05, 0x73, 0x74, - 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x1f, - 0x0a, 0x0d, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, - 0x40, 0x0a, 0x0d, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, - 0x12, 0x1f, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x04, 0x66, 0x69, 0x6c, - 0x65, 0x22, 0x43, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, - 0x69, 0x64, 0x12, 0x22, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, - 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x3d, 0x0a, 0x0a, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x02, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x69, 0x6e, 0x65, 0x52, - 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x2d, - 0x0a, 0x13, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x82, 0x01, - 0x0a, 0x14, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, - 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, - 0x72, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12, 0x18, - 0x0a, 0x07, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x22, 0x32, 0x0a, 0x15, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x41, 0x67, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x3d, 0x0a, 0x0a, + 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x04, 0x6c, 0x69, + 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x4c, 0x69, 0x6e, 0x65, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x22, 0x07, 0x0a, 0x05, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x22, 0x2d, 0x0a, 0x13, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x48, 0x65, + 0x61, 0x6c, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x22, 0x82, 0x01, 0x0a, 0x14, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, + 0x41, 0x67, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, + 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, 0x70, 0x61, + 0x63, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x61, 0x70, 0x61, + 0x63, 0x69, 0x74, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x12, 0x18, + 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x5b, 0x0a, 0x0f, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x67, + 0x72, 0x70, 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x0b, 0x67, 0x72, 0x70, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x25, + 0x0a, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x3b, 0x0a, 0x0c, 0x4e, 0x65, 0x78, 0x74, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x08, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x08, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, + 0x6e, 0x65, 0x22, 0x32, 0x0a, 0x15, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x49, 0x0a, 0x0b, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, @@ -1266,53 +1341,57 @@ var file_woodpecker_proto_rawDesc = []byte{ 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x49, - 0x64, 0x22, 0x61, 0x0a, 0x09, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x16, - 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, - 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x49, - 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, - 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x32, 0x84, 0x04, 0x0a, 0x0a, 0x57, 0x6f, 0x6f, 0x64, 0x70, 0x65, 0x63, - 0x6b, 0x65, 0x72, 0x12, 0x2e, 0x0a, 0x04, 0x4e, 0x65, 0x78, 0x74, 0x12, 0x12, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x65, 0x78, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x65, 0x78, 0x74, 0x52, 0x65, 0x70, 0x6c, - 0x79, 0x22, 0x00, 0x12, 0x2a, 0x0a, 0x04, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x12, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, - 0x2a, 0x0a, 0x04, 0x57, 0x61, 0x69, 0x74, 0x12, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x57, 0x61, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x2a, 0x0a, 0x04, 0x44, - 0x6f, 0x6e, 0x65, 0x12, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x6f, 0x6e, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x2e, 0x0a, 0x06, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x64, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x2e, 0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x2e, 0x0a, 0x06, 0x55, 0x70, 0x6c, 0x6f, 0x61, - 0x64, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x28, 0x0a, 0x03, 0x4c, 0x6f, 0x67, 0x12, 0x11, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, - 0x00, 0x12, 0x4c, 0x0a, 0x0d, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x41, 0x67, 0x65, - 0x6e, 0x74, 0x12, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, - 0x74, 0x65, 0x72, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, - 0x41, 0x67, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, - 0x3a, 0x0a, 0x0c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x12, - 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x48, 0x65, - 0x61, 0x6c, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x32, 0x40, 0x0a, 0x0e, 0x57, - 0x6f, 0x6f, 0x64, 0x70, 0x65, 0x63, 0x6b, 0x65, 0x72, 0x41, 0x75, 0x74, 0x68, 0x12, 0x2e, 0x0a, - 0x04, 0x41, 0x75, 0x74, 0x68, 0x12, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x75, - 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x38, 0x5a, - 0x36, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x77, 0x6f, 0x6f, 0x64, - 0x70, 0x65, 0x63, 0x6b, 0x65, 0x72, 0x2d, 0x63, 0x69, 0x2f, 0x77, 0x6f, 0x6f, 0x64, 0x70, 0x65, - 0x63, 0x6b, 0x65, 0x72, 0x2f, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x2f, 0x72, 0x70, - 0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x64, 0x22, 0x64, 0x0a, 0x0c, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x67, 0x65, + 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x61, 0x67, 0x65, + 0x6e, 0x74, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x32, 0xba, 0x04, 0x0a, 0x0a, 0x57, 0x6f, 0x6f, 0x64, + 0x70, 0x65, 0x63, 0x6b, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, + 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x31, 0x0a, 0x04, 0x4e, 0x65, 0x78, + 0x74, 0x12, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x65, 0x78, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x65, + 0x78, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x2a, 0x0a, 0x04, + 0x49, 0x6e, 0x69, 0x74, 0x12, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x49, 0x6e, 0x69, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x2a, 0x0a, 0x04, 0x57, 0x61, 0x69, 0x74, + 0x12, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x57, 0x61, 0x69, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x22, 0x00, 0x12, 0x2a, 0x0a, 0x04, 0x44, 0x6f, 0x6e, 0x65, 0x12, 0x12, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, + 0x12, 0x2e, 0x0a, 0x06, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, + 0x12, 0x2e, 0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, + 0x12, 0x2e, 0x0a, 0x06, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, + 0x12, 0x28, 0x0a, 0x03, 0x4c, 0x6f, 0x67, 0x12, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x4c, 0x0a, 0x0d, 0x52, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x41, 0x67, 0x65, 0x6e, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0c, 0x52, 0x65, 0x70, 0x6f, + 0x72, 0x74, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x12, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x22, 0x00, 0x32, 0x43, 0x0a, 0x0e, 0x57, 0x6f, 0x6f, 0x64, 0x70, 0x65, 0x63, 0x6b, + 0x65, 0x72, 0x41, 0x75, 0x74, 0x68, 0x12, 0x31, 0x0a, 0x04, 0x41, 0x75, 0x74, 0x68, 0x12, 0x12, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x38, 0x5a, 0x36, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x77, 0x6f, 0x6f, 0x64, 0x70, 0x65, 0x63, 0x6b, + 0x65, 0x72, 0x2d, 0x63, 0x69, 0x2f, 0x77, 0x6f, 0x6f, 0x64, 0x70, 0x65, 0x63, 0x6b, 0x65, 0x72, + 0x2f, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1327,67 +1406,68 @@ func file_woodpecker_proto_rawDescGZIP() []byte { return file_woodpecker_proto_rawDescData } -var ( - file_woodpecker_proto_msgTypes = make([]protoimpl.MessageInfo, 22) - file_woodpecker_proto_goTypes = []interface{}{ - (*File)(nil), // 0: proto.File - (*State)(nil), // 1: proto.State - (*Line)(nil), // 2: proto.Line - (*Filter)(nil), // 3: proto.Filter - (*Pipeline)(nil), // 4: proto.Pipeline - (*NextRequest)(nil), // 5: proto.NextRequest - (*NextReply)(nil), // 6: proto.NextReply - (*InitRequest)(nil), // 7: proto.InitRequest - (*WaitRequest)(nil), // 8: proto.WaitRequest - (*DoneRequest)(nil), // 9: proto.DoneRequest - (*ExtendRequest)(nil), // 10: proto.ExtendRequest - (*UploadRequest)(nil), // 11: proto.UploadRequest - (*UpdateRequest)(nil), // 12: proto.UpdateRequest - (*LogRequest)(nil), // 13: proto.LogRequest - (*Empty)(nil), // 14: proto.Empty - (*ReportHealthRequest)(nil), // 15: proto.ReportHealthRequest - (*RegisterAgentRequest)(nil), // 16: proto.RegisterAgentRequest - (*RegisterAgentResponse)(nil), // 17: proto.RegisterAgentResponse - (*AuthRequest)(nil), // 18: proto.AuthRequest - (*AuthReply)(nil), // 19: proto.AuthReply - nil, // 20: proto.File.MetaEntry - nil, // 21: proto.Filter.LabelsEntry - } -) +var file_woodpecker_proto_msgTypes = make([]protoimpl.MessageInfo, 23) +var file_woodpecker_proto_goTypes = []interface{}{ + (*File)(nil), // 0: proto.File + (*State)(nil), // 1: proto.State + (*Line)(nil), // 2: proto.Line + (*Filter)(nil), // 3: proto.Filter + (*Pipeline)(nil), // 4: proto.Pipeline + (*NextRequest)(nil), // 5: proto.NextRequest + (*InitRequest)(nil), // 6: proto.InitRequest + (*WaitRequest)(nil), // 7: proto.WaitRequest + (*DoneRequest)(nil), // 8: proto.DoneRequest + (*ExtendRequest)(nil), // 9: proto.ExtendRequest + (*UploadRequest)(nil), // 10: proto.UploadRequest + (*UpdateRequest)(nil), // 11: proto.UpdateRequest + (*LogRequest)(nil), // 12: proto.LogRequest + (*Empty)(nil), // 13: proto.Empty + (*ReportHealthRequest)(nil), // 14: proto.ReportHealthRequest + (*RegisterAgentRequest)(nil), // 15: proto.RegisterAgentRequest + (*VersionResponse)(nil), // 16: proto.VersionResponse + (*NextResponse)(nil), // 17: proto.NextResponse + (*RegisterAgentResponse)(nil), // 18: proto.RegisterAgentResponse + (*AuthRequest)(nil), // 19: proto.AuthRequest + (*AuthResponse)(nil), // 20: proto.AuthResponse + nil, // 21: proto.File.MetaEntry + nil, // 22: proto.Filter.LabelsEntry +} var file_woodpecker_proto_depIdxs = []int32{ - 20, // 0: proto.File.meta:type_name -> proto.File.MetaEntry - 21, // 1: proto.Filter.labels:type_name -> proto.Filter.LabelsEntry + 21, // 0: proto.File.meta:type_name -> proto.File.MetaEntry + 22, // 1: proto.Filter.labels:type_name -> proto.Filter.LabelsEntry 3, // 2: proto.NextRequest.filter:type_name -> proto.Filter - 4, // 3: proto.NextReply.pipeline:type_name -> proto.Pipeline - 1, // 4: proto.InitRequest.state:type_name -> proto.State - 1, // 5: proto.DoneRequest.state:type_name -> proto.State - 0, // 6: proto.UploadRequest.file:type_name -> proto.File - 1, // 7: proto.UpdateRequest.state:type_name -> proto.State - 2, // 8: proto.LogRequest.line:type_name -> proto.Line - 5, // 9: proto.Woodpecker.Next:input_type -> proto.NextRequest - 7, // 10: proto.Woodpecker.Init:input_type -> proto.InitRequest - 8, // 11: proto.Woodpecker.Wait:input_type -> proto.WaitRequest - 9, // 12: proto.Woodpecker.Done:input_type -> proto.DoneRequest - 10, // 13: proto.Woodpecker.Extend:input_type -> proto.ExtendRequest - 12, // 14: proto.Woodpecker.Update:input_type -> proto.UpdateRequest - 11, // 15: proto.Woodpecker.Upload:input_type -> proto.UploadRequest - 13, // 16: proto.Woodpecker.Log:input_type -> proto.LogRequest - 16, // 17: proto.Woodpecker.RegisterAgent:input_type -> proto.RegisterAgentRequest - 15, // 18: proto.Woodpecker.ReportHealth:input_type -> proto.ReportHealthRequest - 18, // 19: proto.WoodpeckerAuth.Auth:input_type -> proto.AuthRequest - 6, // 20: proto.Woodpecker.Next:output_type -> proto.NextReply - 14, // 21: proto.Woodpecker.Init:output_type -> proto.Empty - 14, // 22: proto.Woodpecker.Wait:output_type -> proto.Empty - 14, // 23: proto.Woodpecker.Done:output_type -> proto.Empty - 14, // 24: proto.Woodpecker.Extend:output_type -> proto.Empty - 14, // 25: proto.Woodpecker.Update:output_type -> proto.Empty - 14, // 26: proto.Woodpecker.Upload:output_type -> proto.Empty - 14, // 27: proto.Woodpecker.Log:output_type -> proto.Empty - 17, // 28: proto.Woodpecker.RegisterAgent:output_type -> proto.RegisterAgentResponse - 14, // 29: proto.Woodpecker.ReportHealth:output_type -> proto.Empty - 19, // 30: proto.WoodpeckerAuth.Auth:output_type -> proto.AuthReply - 20, // [20:31] is the sub-list for method output_type - 9, // [9:20] is the sub-list for method input_type + 1, // 3: proto.InitRequest.state:type_name -> proto.State + 1, // 4: proto.DoneRequest.state:type_name -> proto.State + 0, // 5: proto.UploadRequest.file:type_name -> proto.File + 1, // 6: proto.UpdateRequest.state:type_name -> proto.State + 2, // 7: proto.LogRequest.line:type_name -> proto.Line + 4, // 8: proto.NextResponse.pipeline:type_name -> proto.Pipeline + 13, // 9: proto.Woodpecker.Version:input_type -> proto.Empty + 5, // 10: proto.Woodpecker.Next:input_type -> proto.NextRequest + 6, // 11: proto.Woodpecker.Init:input_type -> proto.InitRequest + 7, // 12: proto.Woodpecker.Wait:input_type -> proto.WaitRequest + 8, // 13: proto.Woodpecker.Done:input_type -> proto.DoneRequest + 9, // 14: proto.Woodpecker.Extend:input_type -> proto.ExtendRequest + 11, // 15: proto.Woodpecker.Update:input_type -> proto.UpdateRequest + 10, // 16: proto.Woodpecker.Upload:input_type -> proto.UploadRequest + 12, // 17: proto.Woodpecker.Log:input_type -> proto.LogRequest + 15, // 18: proto.Woodpecker.RegisterAgent:input_type -> proto.RegisterAgentRequest + 14, // 19: proto.Woodpecker.ReportHealth:input_type -> proto.ReportHealthRequest + 19, // 20: proto.WoodpeckerAuth.Auth:input_type -> proto.AuthRequest + 16, // 21: proto.Woodpecker.Version:output_type -> proto.VersionResponse + 17, // 22: proto.Woodpecker.Next:output_type -> proto.NextResponse + 13, // 23: proto.Woodpecker.Init:output_type -> proto.Empty + 13, // 24: proto.Woodpecker.Wait:output_type -> proto.Empty + 13, // 25: proto.Woodpecker.Done:output_type -> proto.Empty + 13, // 26: proto.Woodpecker.Extend:output_type -> proto.Empty + 13, // 27: proto.Woodpecker.Update:output_type -> proto.Empty + 13, // 28: proto.Woodpecker.Upload:output_type -> proto.Empty + 13, // 29: proto.Woodpecker.Log:output_type -> proto.Empty + 18, // 30: proto.Woodpecker.RegisterAgent:output_type -> proto.RegisterAgentResponse + 13, // 31: proto.Woodpecker.ReportHealth:output_type -> proto.Empty + 20, // 32: proto.WoodpeckerAuth.Auth:output_type -> proto.AuthResponse + 21, // [21:33] is the sub-list for method output_type + 9, // [9:21] is the sub-list for method input_type 9, // [9:9] is the sub-list for extension type_name 9, // [9:9] is the sub-list for extension extendee 0, // [0:9] is the sub-list for field type_name @@ -1472,18 +1552,6 @@ func file_woodpecker_proto_init() { } } file_woodpecker_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NextReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_woodpecker_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*InitRequest); i { case 0: return &v.state @@ -1495,7 +1563,7 @@ func file_woodpecker_proto_init() { return nil } } - file_woodpecker_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_woodpecker_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*WaitRequest); i { case 0: return &v.state @@ -1507,7 +1575,7 @@ func file_woodpecker_proto_init() { return nil } } - file_woodpecker_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_woodpecker_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DoneRequest); i { case 0: return &v.state @@ -1519,7 +1587,7 @@ func file_woodpecker_proto_init() { return nil } } - file_woodpecker_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_woodpecker_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ExtendRequest); i { case 0: return &v.state @@ -1531,7 +1599,7 @@ func file_woodpecker_proto_init() { return nil } } - file_woodpecker_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_woodpecker_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UploadRequest); i { case 0: return &v.state @@ -1543,7 +1611,7 @@ func file_woodpecker_proto_init() { return nil } } - file_woodpecker_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + file_woodpecker_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UpdateRequest); i { case 0: return &v.state @@ -1555,7 +1623,7 @@ func file_woodpecker_proto_init() { return nil } } - file_woodpecker_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + file_woodpecker_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LogRequest); i { case 0: return &v.state @@ -1567,7 +1635,7 @@ func file_woodpecker_proto_init() { return nil } } - file_woodpecker_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + file_woodpecker_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Empty); i { case 0: return &v.state @@ -1579,7 +1647,7 @@ func file_woodpecker_proto_init() { return nil } } - file_woodpecker_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + file_woodpecker_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ReportHealthRequest); i { case 0: return &v.state @@ -1591,7 +1659,7 @@ func file_woodpecker_proto_init() { return nil } } - file_woodpecker_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + file_woodpecker_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RegisterAgentRequest); i { case 0: return &v.state @@ -1603,8 +1671,20 @@ func file_woodpecker_proto_init() { return nil } } + file_woodpecker_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VersionResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } file_woodpecker_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RegisterAgentResponse); i { + switch v := v.(*NextResponse); i { case 0: return &v.state case 1: @@ -1616,7 +1696,7 @@ func file_woodpecker_proto_init() { } } file_woodpecker_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthRequest); i { + switch v := v.(*RegisterAgentResponse); i { case 0: return &v.state case 1: @@ -1628,7 +1708,19 @@ func file_woodpecker_proto_init() { } } file_woodpecker_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthReply); i { + switch v := v.(*AuthRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_woodpecker_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AuthResponse); i { case 0: return &v.state case 1: @@ -1646,7 +1738,7 @@ func file_woodpecker_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_woodpecker_proto_rawDesc, NumEnums: 0, - NumMessages: 22, + NumMessages: 23, NumExtensions: 0, NumServices: 2, }, diff --git a/pipeline/rpc/proto/woodpecker.proto b/pipeline/rpc/proto/woodpecker.proto index ab50694f9..0927e9fc2 100644 --- a/pipeline/rpc/proto/woodpecker.proto +++ b/pipeline/rpc/proto/woodpecker.proto @@ -1,10 +1,31 @@ +// Copyright 2021 Woodpecker Authors +// Copyright 2011 Drone.IO 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"; option go_package = "github.com/woodpecker-ci/woodpecker/pipeline/rpc/proto"; package proto; +// !IMPORTANT! +// Increased Version in version.go by 1 if you change something here! +// !IMPORTANT! + +// Woodpecker Server Service service Woodpecker { - rpc Next (NextRequest) returns (NextReply) {} + rpc Version (Empty) returns (VersionResponse) {} + rpc Next (NextRequest) returns (NextResponse) {} rpc Init (InitRequest) returns (Empty) {} rpc Wait (WaitRequest) returns (Empty) {} rpc Done (DoneRequest) returns (Empty) {} @@ -16,6 +37,10 @@ service Woodpecker { rpc ReportHealth (ReportHealthRequest) returns (Empty) {} } +// +// Basic Types +// + message File { string name = 1; string step = 2; @@ -52,14 +77,14 @@ message Pipeline { bytes payload = 3; } +// +// Request types +// + message NextRequest { Filter filter = 1; } -message NextReply { - Pipeline pipeline = 1; -} - message InitRequest { string id = 1; State state = 2; @@ -107,6 +132,19 @@ message RegisterAgentRequest { string version = 4; } +// +// Response types +// + +message VersionResponse { + int32 grpc_version = 1; + string server_version = 2; +} + +message NextResponse { + Pipeline pipeline = 1; +} + message RegisterAgentResponse { int64 agent_id = 1; } @@ -114,7 +152,7 @@ message RegisterAgentResponse { // Woodpecker auth service is a simple service to authenticate agents and aquire a token service WoodpeckerAuth { - rpc Auth (AuthRequest) returns (AuthReply) {} + rpc Auth (AuthRequest) returns (AuthResponse) {} } message AuthRequest { @@ -122,7 +160,7 @@ message AuthRequest { int64 agent_id = 2; } -message AuthReply { +message AuthResponse { string status = 1; int64 agent_id = 2; string access_token = 3; diff --git a/pipeline/rpc/proto/woodpecker_grpc.pb.go b/pipeline/rpc/proto/woodpecker_grpc.pb.go index e1009b421..c79eb5c52 100644 --- a/pipeline/rpc/proto/woodpecker_grpc.pb.go +++ b/pipeline/rpc/proto/woodpecker_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 +// - protoc-gen-go-grpc v1.2.0 // - protoc v3.21.12 // source: woodpecker.proto @@ -8,7 +8,6 @@ package proto import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -19,24 +18,12 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 -const ( - Woodpecker_Next_FullMethodName = "/proto.Woodpecker/Next" - Woodpecker_Init_FullMethodName = "/proto.Woodpecker/Init" - Woodpecker_Wait_FullMethodName = "/proto.Woodpecker/Wait" - Woodpecker_Done_FullMethodName = "/proto.Woodpecker/Done" - Woodpecker_Extend_FullMethodName = "/proto.Woodpecker/Extend" - Woodpecker_Update_FullMethodName = "/proto.Woodpecker/Update" - Woodpecker_Upload_FullMethodName = "/proto.Woodpecker/Upload" - Woodpecker_Log_FullMethodName = "/proto.Woodpecker/Log" - Woodpecker_RegisterAgent_FullMethodName = "/proto.Woodpecker/RegisterAgent" - Woodpecker_ReportHealth_FullMethodName = "/proto.Woodpecker/ReportHealth" -) - // WoodpeckerClient is the client API for Woodpecker 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 WoodpeckerClient interface { - Next(ctx context.Context, in *NextRequest, opts ...grpc.CallOption) (*NextReply, error) + Version(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*VersionResponse, error) + Next(ctx context.Context, in *NextRequest, opts ...grpc.CallOption) (*NextResponse, error) Init(ctx context.Context, in *InitRequest, opts ...grpc.CallOption) (*Empty, error) Wait(ctx context.Context, in *WaitRequest, opts ...grpc.CallOption) (*Empty, error) Done(ctx context.Context, in *DoneRequest, opts ...grpc.CallOption) (*Empty, error) @@ -56,9 +43,18 @@ func NewWoodpeckerClient(cc grpc.ClientConnInterface) WoodpeckerClient { return &woodpeckerClient{cc} } -func (c *woodpeckerClient) Next(ctx context.Context, in *NextRequest, opts ...grpc.CallOption) (*NextReply, error) { - out := new(NextReply) - err := c.cc.Invoke(ctx, Woodpecker_Next_FullMethodName, in, out, opts...) +func (c *woodpeckerClient) Version(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*VersionResponse, error) { + out := new(VersionResponse) + err := c.cc.Invoke(ctx, "/proto.Woodpecker/Version", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *woodpeckerClient) Next(ctx context.Context, in *NextRequest, opts ...grpc.CallOption) (*NextResponse, error) { + out := new(NextResponse) + err := c.cc.Invoke(ctx, "/proto.Woodpecker/Next", in, out, opts...) if err != nil { return nil, err } @@ -67,7 +63,7 @@ func (c *woodpeckerClient) Next(ctx context.Context, in *NextRequest, opts ...gr func (c *woodpeckerClient) Init(ctx context.Context, in *InitRequest, opts ...grpc.CallOption) (*Empty, error) { out := new(Empty) - err := c.cc.Invoke(ctx, Woodpecker_Init_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/proto.Woodpecker/Init", in, out, opts...) if err != nil { return nil, err } @@ -76,7 +72,7 @@ func (c *woodpeckerClient) Init(ctx context.Context, in *InitRequest, opts ...gr func (c *woodpeckerClient) Wait(ctx context.Context, in *WaitRequest, opts ...grpc.CallOption) (*Empty, error) { out := new(Empty) - err := c.cc.Invoke(ctx, Woodpecker_Wait_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/proto.Woodpecker/Wait", in, out, opts...) if err != nil { return nil, err } @@ -85,7 +81,7 @@ func (c *woodpeckerClient) Wait(ctx context.Context, in *WaitRequest, opts ...gr func (c *woodpeckerClient) Done(ctx context.Context, in *DoneRequest, opts ...grpc.CallOption) (*Empty, error) { out := new(Empty) - err := c.cc.Invoke(ctx, Woodpecker_Done_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/proto.Woodpecker/Done", in, out, opts...) if err != nil { return nil, err } @@ -94,7 +90,7 @@ func (c *woodpeckerClient) Done(ctx context.Context, in *DoneRequest, opts ...gr func (c *woodpeckerClient) Extend(ctx context.Context, in *ExtendRequest, opts ...grpc.CallOption) (*Empty, error) { out := new(Empty) - err := c.cc.Invoke(ctx, Woodpecker_Extend_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/proto.Woodpecker/Extend", in, out, opts...) if err != nil { return nil, err } @@ -103,7 +99,7 @@ func (c *woodpeckerClient) Extend(ctx context.Context, in *ExtendRequest, opts . func (c *woodpeckerClient) Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*Empty, error) { out := new(Empty) - err := c.cc.Invoke(ctx, Woodpecker_Update_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/proto.Woodpecker/Update", in, out, opts...) if err != nil { return nil, err } @@ -112,7 +108,7 @@ func (c *woodpeckerClient) Update(ctx context.Context, in *UpdateRequest, opts . func (c *woodpeckerClient) Upload(ctx context.Context, in *UploadRequest, opts ...grpc.CallOption) (*Empty, error) { out := new(Empty) - err := c.cc.Invoke(ctx, Woodpecker_Upload_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/proto.Woodpecker/Upload", in, out, opts...) if err != nil { return nil, err } @@ -121,7 +117,7 @@ func (c *woodpeckerClient) Upload(ctx context.Context, in *UploadRequest, opts . func (c *woodpeckerClient) Log(ctx context.Context, in *LogRequest, opts ...grpc.CallOption) (*Empty, error) { out := new(Empty) - err := c.cc.Invoke(ctx, Woodpecker_Log_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/proto.Woodpecker/Log", in, out, opts...) if err != nil { return nil, err } @@ -130,7 +126,7 @@ func (c *woodpeckerClient) Log(ctx context.Context, in *LogRequest, opts ...grpc func (c *woodpeckerClient) RegisterAgent(ctx context.Context, in *RegisterAgentRequest, opts ...grpc.CallOption) (*RegisterAgentResponse, error) { out := new(RegisterAgentResponse) - err := c.cc.Invoke(ctx, Woodpecker_RegisterAgent_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/proto.Woodpecker/RegisterAgent", in, out, opts...) if err != nil { return nil, err } @@ -139,7 +135,7 @@ func (c *woodpeckerClient) RegisterAgent(ctx context.Context, in *RegisterAgentR func (c *woodpeckerClient) ReportHealth(ctx context.Context, in *ReportHealthRequest, opts ...grpc.CallOption) (*Empty, error) { out := new(Empty) - err := c.cc.Invoke(ctx, Woodpecker_ReportHealth_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/proto.Woodpecker/ReportHealth", in, out, opts...) if err != nil { return nil, err } @@ -150,7 +146,8 @@ func (c *woodpeckerClient) ReportHealth(ctx context.Context, in *ReportHealthReq // All implementations must embed UnimplementedWoodpeckerServer // for forward compatibility type WoodpeckerServer interface { - Next(context.Context, *NextRequest) (*NextReply, error) + Version(context.Context, *Empty) (*VersionResponse, error) + Next(context.Context, *NextRequest) (*NextResponse, error) Init(context.Context, *InitRequest) (*Empty, error) Wait(context.Context, *WaitRequest) (*Empty, error) Done(context.Context, *DoneRequest) (*Empty, error) @@ -164,44 +161,39 @@ type WoodpeckerServer interface { } // UnimplementedWoodpeckerServer must be embedded to have forward compatible implementations. -type UnimplementedWoodpeckerServer struct{} - -func (UnimplementedWoodpeckerServer) Next(context.Context, *NextRequest) (*NextReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method Next not implemented") +type UnimplementedWoodpeckerServer struct { } +func (UnimplementedWoodpeckerServer) Version(context.Context, *Empty) (*VersionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Version not implemented") +} +func (UnimplementedWoodpeckerServer) Next(context.Context, *NextRequest) (*NextResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Next not implemented") +} func (UnimplementedWoodpeckerServer) Init(context.Context, *InitRequest) (*Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method Init not implemented") } - func (UnimplementedWoodpeckerServer) Wait(context.Context, *WaitRequest) (*Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method Wait not implemented") } - func (UnimplementedWoodpeckerServer) Done(context.Context, *DoneRequest) (*Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method Done not implemented") } - func (UnimplementedWoodpeckerServer) Extend(context.Context, *ExtendRequest) (*Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method Extend not implemented") } - func (UnimplementedWoodpeckerServer) Update(context.Context, *UpdateRequest) (*Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method Update not implemented") } - func (UnimplementedWoodpeckerServer) Upload(context.Context, *UploadRequest) (*Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method Upload not implemented") } - func (UnimplementedWoodpeckerServer) Log(context.Context, *LogRequest) (*Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method Log not implemented") } - func (UnimplementedWoodpeckerServer) RegisterAgent(context.Context, *RegisterAgentRequest) (*RegisterAgentResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RegisterAgent not implemented") } - func (UnimplementedWoodpeckerServer) ReportHealth(context.Context, *ReportHealthRequest) (*Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method ReportHealth not implemented") } @@ -218,6 +210,24 @@ func RegisterWoodpeckerServer(s grpc.ServiceRegistrar, srv WoodpeckerServer) { s.RegisterService(&Woodpecker_ServiceDesc, srv) } +func _Woodpecker_Version_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WoodpeckerServer).Version(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto.Woodpecker/Version", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WoodpeckerServer).Version(ctx, req.(*Empty)) + } + return interceptor(ctx, in, info, handler) +} + func _Woodpecker_Next_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(NextRequest) if err := dec(in); err != nil { @@ -228,7 +238,7 @@ func _Woodpecker_Next_Handler(srv interface{}, ctx context.Context, dec func(int } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Woodpecker_Next_FullMethodName, + FullMethod: "/proto.Woodpecker/Next", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WoodpeckerServer).Next(ctx, req.(*NextRequest)) @@ -246,7 +256,7 @@ func _Woodpecker_Init_Handler(srv interface{}, ctx context.Context, dec func(int } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Woodpecker_Init_FullMethodName, + FullMethod: "/proto.Woodpecker/Init", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WoodpeckerServer).Init(ctx, req.(*InitRequest)) @@ -264,7 +274,7 @@ func _Woodpecker_Wait_Handler(srv interface{}, ctx context.Context, dec func(int } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Woodpecker_Wait_FullMethodName, + FullMethod: "/proto.Woodpecker/Wait", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WoodpeckerServer).Wait(ctx, req.(*WaitRequest)) @@ -282,7 +292,7 @@ func _Woodpecker_Done_Handler(srv interface{}, ctx context.Context, dec func(int } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Woodpecker_Done_FullMethodName, + FullMethod: "/proto.Woodpecker/Done", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WoodpeckerServer).Done(ctx, req.(*DoneRequest)) @@ -300,7 +310,7 @@ func _Woodpecker_Extend_Handler(srv interface{}, ctx context.Context, dec func(i } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Woodpecker_Extend_FullMethodName, + FullMethod: "/proto.Woodpecker/Extend", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WoodpeckerServer).Extend(ctx, req.(*ExtendRequest)) @@ -318,7 +328,7 @@ func _Woodpecker_Update_Handler(srv interface{}, ctx context.Context, dec func(i } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Woodpecker_Update_FullMethodName, + FullMethod: "/proto.Woodpecker/Update", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WoodpeckerServer).Update(ctx, req.(*UpdateRequest)) @@ -336,7 +346,7 @@ func _Woodpecker_Upload_Handler(srv interface{}, ctx context.Context, dec func(i } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Woodpecker_Upload_FullMethodName, + FullMethod: "/proto.Woodpecker/Upload", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WoodpeckerServer).Upload(ctx, req.(*UploadRequest)) @@ -354,7 +364,7 @@ func _Woodpecker_Log_Handler(srv interface{}, ctx context.Context, dec func(inte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Woodpecker_Log_FullMethodName, + FullMethod: "/proto.Woodpecker/Log", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WoodpeckerServer).Log(ctx, req.(*LogRequest)) @@ -372,7 +382,7 @@ func _Woodpecker_RegisterAgent_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Woodpecker_RegisterAgent_FullMethodName, + FullMethod: "/proto.Woodpecker/RegisterAgent", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WoodpeckerServer).RegisterAgent(ctx, req.(*RegisterAgentRequest)) @@ -390,7 +400,7 @@ func _Woodpecker_ReportHealth_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Woodpecker_ReportHealth_FullMethodName, + FullMethod: "/proto.Woodpecker/ReportHealth", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WoodpeckerServer).ReportHealth(ctx, req.(*ReportHealthRequest)) @@ -405,6 +415,10 @@ var Woodpecker_ServiceDesc = grpc.ServiceDesc{ ServiceName: "proto.Woodpecker", HandlerType: (*WoodpeckerServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "Version", + Handler: _Woodpecker_Version_Handler, + }, { MethodName: "Next", Handler: _Woodpecker_Next_Handler, @@ -450,15 +464,11 @@ var Woodpecker_ServiceDesc = grpc.ServiceDesc{ Metadata: "woodpecker.proto", } -const ( - WoodpeckerAuth_Auth_FullMethodName = "/proto.WoodpeckerAuth/Auth" -) - // WoodpeckerAuthClient is the client API for WoodpeckerAuth 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 WoodpeckerAuthClient interface { - Auth(ctx context.Context, in *AuthRequest, opts ...grpc.CallOption) (*AuthReply, error) + Auth(ctx context.Context, in *AuthRequest, opts ...grpc.CallOption) (*AuthResponse, error) } type woodpeckerAuthClient struct { @@ -469,9 +479,9 @@ func NewWoodpeckerAuthClient(cc grpc.ClientConnInterface) WoodpeckerAuthClient { return &woodpeckerAuthClient{cc} } -func (c *woodpeckerAuthClient) Auth(ctx context.Context, in *AuthRequest, opts ...grpc.CallOption) (*AuthReply, error) { - out := new(AuthReply) - err := c.cc.Invoke(ctx, WoodpeckerAuth_Auth_FullMethodName, in, out, opts...) +func (c *woodpeckerAuthClient) Auth(ctx context.Context, in *AuthRequest, opts ...grpc.CallOption) (*AuthResponse, error) { + out := new(AuthResponse) + err := c.cc.Invoke(ctx, "/proto.WoodpeckerAuth/Auth", in, out, opts...) if err != nil { return nil, err } @@ -482,14 +492,15 @@ func (c *woodpeckerAuthClient) Auth(ctx context.Context, in *AuthRequest, opts . // All implementations must embed UnimplementedWoodpeckerAuthServer // for forward compatibility type WoodpeckerAuthServer interface { - Auth(context.Context, *AuthRequest) (*AuthReply, error) + Auth(context.Context, *AuthRequest) (*AuthResponse, error) mustEmbedUnimplementedWoodpeckerAuthServer() } // UnimplementedWoodpeckerAuthServer must be embedded to have forward compatible implementations. -type UnimplementedWoodpeckerAuthServer struct{} +type UnimplementedWoodpeckerAuthServer struct { +} -func (UnimplementedWoodpeckerAuthServer) Auth(context.Context, *AuthRequest) (*AuthReply, error) { +func (UnimplementedWoodpeckerAuthServer) Auth(context.Context, *AuthRequest) (*AuthResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Auth not implemented") } func (UnimplementedWoodpeckerAuthServer) mustEmbedUnimplementedWoodpeckerAuthServer() {} @@ -515,7 +526,7 @@ func _WoodpeckerAuth_Auth_Handler(srv interface{}, ctx context.Context, dec func } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: WoodpeckerAuth_Auth_FullMethodName, + FullMethod: "/proto.WoodpeckerAuth/Auth", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(WoodpeckerAuthServer).Auth(ctx, req.(*AuthRequest)) diff --git a/server/forge/mocks/forge.go b/server/forge/mocks/forge.go index 140b0b0a0..a684d3366 100644 --- a/server/forge/mocks/forge.go +++ b/server/forge/mocks/forge.go @@ -34,7 +34,7 @@ func (_m *Forge) Activate(ctx context.Context, u *model.User, r *model.Repo, lin } // Auth provides a mock function with given fields: ctx, token, secret -func (_m *Forge) Auth(ctx context.Context, token, secret string) (string, error) { +func (_m *Forge) Auth(ctx context.Context, token string, secret string) (string, error) { ret := _m.Called(ctx, token, secret) var r0 string @@ -353,7 +353,7 @@ func (_m *Forge) PullRequests(ctx context.Context, u *model.User, r *model.Repo, } // Repo provides a mock function with given fields: ctx, u, remoteID, owner, name -func (_m *Forge) Repo(ctx context.Context, u *model.User, remoteID model.ForgeRemoteID, owner, name string) (*model.Repo, error) { +func (_m *Forge) Repo(ctx context.Context, u *model.User, remoteID model.ForgeRemoteID, owner string, name string) (*model.Repo, error) { ret := _m.Called(ctx, u, remoteID, owner, name) var r0 *model.Repo diff --git a/server/grpc/auth_server.go b/server/grpc/auth_server.go index 9ac6f2f91..9646808ef 100644 --- a/server/grpc/auth_server.go +++ b/server/grpc/auth_server.go @@ -1,3 +1,17 @@ +// Copyright 2023 Woodpecker Authors +// +// 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. + package grpc import ( @@ -22,7 +36,7 @@ func NewWoodpeckerAuthServer(jwtManager *JWTManager, agentMasterToken string, st return &WoodpeckerAuthServer{jwtManager: jwtManager, agentMasterToken: agentMasterToken, store: store} } -func (s *WoodpeckerAuthServer) Auth(_ context.Context, req *proto.AuthRequest) (*proto.AuthReply, error) { +func (s *WoodpeckerAuthServer) Auth(_ context.Context, req *proto.AuthRequest) (*proto.AuthResponse, error) { agent, err := s.getAgent(req.AgentId, req.AgentToken) if err != nil { return nil, err @@ -33,7 +47,7 @@ func (s *WoodpeckerAuthServer) Auth(_ context.Context, req *proto.AuthRequest) ( return nil, err } - return &proto.AuthReply{ + return &proto.AuthResponse{ Status: "ok", AgentId: agent.ID, AccessToken: accessToken, diff --git a/server/grpc/server.go b/server/grpc/server.go index e2f18ffff..538d20f95 100644 --- a/server/grpc/server.go +++ b/server/grpc/server.go @@ -28,6 +28,7 @@ import ( "github.com/woodpecker-ci/woodpecker/server/pubsub" "github.com/woodpecker-ci/woodpecker/server/queue" "github.com/woodpecker-ci/woodpecker/server/store" + "github.com/woodpecker-ci/woodpecker/version" ) // WoodpeckerServer is a grpc server implementation. @@ -36,7 +37,7 @@ type WoodpeckerServer struct { peer RPC } -func NewWoodpeckerServer(forge forge.Forge, queue queue.Queue, logger logging.Log, pubsub pubsub.Publisher, store store.Store, host string) *WoodpeckerServer { +func NewWoodpeckerServer(forge forge.Forge, queue queue.Queue, logger logging.Log, pubsub pubsub.Publisher, store store.Store, host string) proto.WoodpeckerServer { pipelineTime := promauto.NewGaugeVec(prometheus.GaugeOpts{ Namespace: "woodpecker", Name: "pipeline_time", @@ -60,12 +61,19 @@ func NewWoodpeckerServer(forge forge.Forge, queue queue.Queue, logger logging.Lo return &WoodpeckerServer{peer: peer} } -func (s *WoodpeckerServer) Next(c context.Context, req *proto.NextRequest) (*proto.NextReply, error) { +func (s *WoodpeckerServer) Version(_ context.Context, _ *proto.Empty) (*proto.VersionResponse, error) { + return &proto.VersionResponse{ + GrpcVersion: proto.Version, + ServerVersion: version.String(), + }, nil +} + +func (s *WoodpeckerServer) Next(c context.Context, req *proto.NextRequest) (*proto.NextResponse, error) { filter := rpc.Filter{ Labels: req.GetFilter().GetLabels(), } - res := new(proto.NextReply) + res := new(proto.NextResponse) pipeline, err := s.peer.Next(c, filter) if err != nil { return res, err diff --git a/server/store/mocks/store.go b/server/store/mocks/store.go index 00cd435da..82d513e2f 100644 --- a/server/store/mocks/store.go +++ b/server/store/mocks/store.go @@ -406,7 +406,7 @@ func (_m *Store) CronList(_a0 *model.Repo) ([]*model.Cron, error) { } // CronListNextExecute provides a mock function with given fields: _a0, _a1 -func (_m *Store) CronListNextExecute(_a0, _a1 int64) ([]*model.Cron, error) { +func (_m *Store) CronListNextExecute(_a0 int64, _a1 int64) ([]*model.Cron, error) { ret := _m.Called(_a0, _a1) var r0 []*model.Cron @@ -618,7 +618,7 @@ func (_m *Store) GetPipeline(_a0 int64) (*model.Pipeline, error) { } // GetPipelineCommit provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Store) GetPipelineCommit(_a0 *model.Repo, _a1, _a2 string) (*model.Pipeline, error) { +func (_m *Store) GetPipelineCommit(_a0 *model.Repo, _a1 string, _a2 string) (*model.Pipeline, error) { ret := _m.Called(_a0, _a1, _a2) var r0 *model.Pipeline @@ -1210,7 +1210,7 @@ func (_m *Store) Migrate() error { } // OrgSecretFind provides a mock function with given fields: _a0, _a1 -func (_m *Store) OrgSecretFind(_a0, _a1 string) (*model.Secret, error) { +func (_m *Store) OrgSecretFind(_a0 string, _a1 string) (*model.Secret, error) { ret := _m.Called(_a0, _a1) var r0 *model.Secret @@ -1676,7 +1676,7 @@ func (_m *Store) ServerConfigGet(_a0 string) (string, error) { } // ServerConfigSet provides a mock function with given fields: _a0, _a1 -func (_m *Store) ServerConfigSet(_a0, _a1 string) error { +func (_m *Store) ServerConfigSet(_a0 string, _a1 string) error { ret := _m.Called(_a0, _a1) var r0 error