woodpecker/pipeline/rpc/proto/woodpecker.proto
Anbraten 556607b525
Rework log streaming and related functions (#1802)
closes #1801
closes #1815 
closes #1144
closes  #983
closes  #557
closes #1827
regression of #1791

# TODO
- [x] adjust log model
- [x] add migration for logs
- [x] send log line via grpc using step-id
- [x] save log-line to db
- [x] stream log-lines to UI
- [x] use less structs for log-data
- [x] make web UI work
  - [x] display logs loaded from db
  - [x] display streaming logs
- [ ] ~~make migration work~~ -> dedicated pull (#1828)

# TESTED
- [x] new logs are stored in database
- [x] log retrieval via cli (of new logs) works
- [x] log streaming works (tested via curl & webui)
- [x] log retrieval via web (of new logs) works

---------

Co-authored-by: 6543 <6543@obermui.de>
2023-06-06 09:52:08 +02:00

151 lines
3.2 KiB
Protocol Buffer

// 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 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 ReportHealth (ReportHealthRequest) returns (Empty) {}
}
//
// Basic Types
//
message State {
string name = 1;
bool exited = 2;
int32 exit_code = 3;
int64 started = 4;
int64 finished = 5;
string error = 6;
}
message LogEntry {
string step_uuid = 1;
int64 time = 2;
int32 line = 3;
int32 type = 4; // 0 = stdout, 1 = stderr, 2 = exit-code, 3 = metadata, 4 = progress
string data = 5;
}
message Filter {
map<string, string> labels = 1;
}
message Pipeline {
string id = 1;
int64 timeout = 2;
bytes payload = 3;
}
//
// Request types
//
message NextRequest {
Filter filter = 1;
}
message InitRequest {
string id = 1;
State state = 2;
}
message WaitRequest {
string id = 1;
}
message DoneRequest {
string id = 1;
State state = 2;
}
message ExtendRequest {
string id = 1;
}
message UpdateRequest {
string id = 1;
State state = 2;
}
message LogRequest {
LogEntry logEntry = 1;
}
message Empty {
}
message ReportHealthRequest {
string status = 1;
}
message RegisterAgentRequest {
string platform = 1;
int32 capacity = 2;
string backend = 3;
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;
}
// Woodpecker auth service is a simple service to authenticate agents and aquire a token
service WoodpeckerAuth {
rpc Auth (AuthRequest) returns (AuthResponse) {}
}
message AuthRequest {
string agent_token = 1;
int64 agent_id = 2;
}
message AuthResponse {
string status = 1;
int64 agent_id = 2;
string access_token = 3;
}