2023-03-19 21:42:21 +00:00
|
|
|
// 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.
|
|
|
|
|
2017-06-28 17:21:22 +00:00
|
|
|
syntax = "proto3";
|
|
|
|
|
2023-12-08 07:15:08 +00:00
|
|
|
option go_package = "go.woodpecker-ci.org/woodpecker/v2/pipeline/rpc/proto";
|
2017-06-28 17:21:22 +00:00
|
|
|
package proto;
|
|
|
|
|
2023-03-19 21:42:21 +00:00
|
|
|
// !IMPORTANT!
|
|
|
|
// Increased Version in version.go by 1 if you change something here!
|
|
|
|
// !IMPORTANT!
|
|
|
|
|
|
|
|
// Woodpecker Server Service
|
2023-01-28 13:13:04 +00:00
|
|
|
service Woodpecker {
|
2023-11-01 23:53:47 +00:00
|
|
|
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) {}
|
|
|
|
rpc Extend (ExtendRequest) returns (Empty) {}
|
|
|
|
rpc Update (UpdateRequest) returns (Empty) {}
|
|
|
|
rpc Log (LogRequest) returns (Empty) {}
|
|
|
|
rpc RegisterAgent (RegisterAgentRequest) returns (RegisterAgentResponse) {}
|
|
|
|
rpc UnregisterAgent (Empty) returns (Empty) {}
|
|
|
|
rpc ReportHealth (ReportHealthRequest) returns (Empty) {}
|
2023-01-28 13:13:04 +00:00
|
|
|
}
|
|
|
|
|
2023-03-19 21:42:21 +00:00
|
|
|
//
|
|
|
|
// Basic Types
|
|
|
|
//
|
|
|
|
|
2024-07-01 09:20:55 +00:00
|
|
|
message StepState {
|
2024-01-09 14:39:09 +00:00
|
|
|
string step_uuid = 1;
|
2024-07-01 09:20:55 +00:00
|
|
|
int64 started = 2;
|
|
|
|
int64 finished = 3;
|
|
|
|
bool exited = 4;
|
|
|
|
int32 exit_code = 5;
|
|
|
|
string error = 6;
|
|
|
|
}
|
|
|
|
|
|
|
|
message WorkflowState {
|
2017-06-28 17:21:22 +00:00
|
|
|
int64 started = 4;
|
|
|
|
int64 finished = 5;
|
|
|
|
string error = 6;
|
|
|
|
}
|
|
|
|
|
2023-06-06 07:52:08 +00:00
|
|
|
message LogEntry {
|
|
|
|
string step_uuid = 1;
|
2017-06-28 17:21:22 +00:00
|
|
|
int64 time = 2;
|
2023-06-06 07:52:08 +00:00
|
|
|
int32 line = 3;
|
|
|
|
int32 type = 4; // 0 = stdout, 1 = stderr, 2 = exit-code, 3 = metadata, 4 = progress
|
2024-06-13 15:18:32 +00:00
|
|
|
bytes data = 5;
|
2017-06-28 17:21:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message Filter {
|
|
|
|
map<string, string> labels = 1;
|
|
|
|
}
|
|
|
|
|
2023-08-21 16:30:19 +00:00
|
|
|
message Workflow {
|
2017-06-28 17:21:22 +00:00
|
|
|
string id = 1;
|
|
|
|
int64 timeout = 2;
|
|
|
|
bytes payload = 3;
|
|
|
|
}
|
|
|
|
|
2023-03-19 21:42:21 +00:00
|
|
|
//
|
|
|
|
// Request types
|
|
|
|
//
|
|
|
|
|
2017-06-28 17:21:22 +00:00
|
|
|
message NextRequest {
|
|
|
|
Filter filter = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message InitRequest {
|
2021-09-29 00:10:09 +00:00
|
|
|
string id = 1;
|
2024-07-01 09:20:55 +00:00
|
|
|
WorkflowState state = 2;
|
2017-06-28 17:21:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message WaitRequest {
|
|
|
|
string id = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message DoneRequest {
|
2021-09-29 00:10:09 +00:00
|
|
|
string id = 1;
|
2024-07-01 09:20:55 +00:00
|
|
|
WorkflowState state = 2;
|
2017-06-28 17:21:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message ExtendRequest {
|
|
|
|
string id = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message UpdateRequest {
|
2021-09-29 00:10:09 +00:00
|
|
|
string id = 1;
|
2024-07-01 09:20:55 +00:00
|
|
|
StepState state = 2;
|
2017-06-28 17:21:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message LogRequest {
|
2024-09-18 14:29:56 +00:00
|
|
|
repeated LogEntry logEntries = 1;
|
2017-06-28 17:21:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message Empty {
|
2023-01-28 13:13:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message ReportHealthRequest {
|
|
|
|
string status = 1;
|
|
|
|
}
|
|
|
|
|
2024-10-06 15:13:41 +00:00
|
|
|
message AgentInfo {
|
2023-01-28 13:13:04 +00:00
|
|
|
string platform = 1;
|
|
|
|
int32 capacity = 2;
|
|
|
|
string backend = 3;
|
|
|
|
string version = 4;
|
2024-10-06 15:13:41 +00:00
|
|
|
map<string, string> customLabels = 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
message RegisterAgentRequest {
|
|
|
|
AgentInfo info = 1;
|
2023-01-28 13:13:04 +00:00
|
|
|
}
|
|
|
|
|
2023-03-19 21:42:21 +00:00
|
|
|
//
|
|
|
|
// Response types
|
|
|
|
//
|
|
|
|
|
|
|
|
message VersionResponse {
|
|
|
|
int32 grpc_version = 1;
|
|
|
|
string server_version = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message NextResponse {
|
2023-08-21 16:30:19 +00:00
|
|
|
Workflow workflow = 1;
|
2023-03-19 21:42:21 +00:00
|
|
|
}
|
|
|
|
|
2023-01-28 13:13:04 +00:00
|
|
|
message RegisterAgentResponse {
|
|
|
|
int64 agent_id = 1;
|
|
|
|
}
|
|
|
|
|
2024-05-24 20:35:04 +00:00
|
|
|
// Woodpecker auth service is a simple service to authenticate agents and acquire a token
|
2023-01-28 13:13:04 +00:00
|
|
|
|
|
|
|
service WoodpeckerAuth {
|
2023-03-19 21:42:21 +00:00
|
|
|
rpc Auth (AuthRequest) returns (AuthResponse) {}
|
2023-01-28 13:13:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message AuthRequest {
|
|
|
|
string agent_token = 1;
|
|
|
|
int64 agent_id = 2;
|
|
|
|
}
|
2017-06-28 17:21:22 +00:00
|
|
|
|
2023-03-19 21:42:21 +00:00
|
|
|
message AuthResponse {
|
2023-01-28 13:13:04 +00:00
|
|
|
string status = 1;
|
|
|
|
int64 agent_id = 2;
|
|
|
|
string access_token = 3;
|
2017-06-28 17:21:22 +00:00
|
|
|
}
|