1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2026-06-03 16:35:37 +02:00

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>
This commit is contained in:
Anbraten
2023-06-06 09:52:08 +02:00
committed by GitHub
parent 971cb52032
commit 556607b525
49 changed files with 1066 additions and 990 deletions
+103 -66
View File
@@ -751,6 +751,52 @@ const docTemplate = `{
}
}
},
"/logs/{owner}/{name}/{pipeline}/{stepID}": {
"get": {
"produces": [
"text/plain"
],
"tags": [
"Pipeline logs"
],
"summary": "Log stream",
"parameters": [
{
"type": "string",
"description": "the repository owner's name",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "the repository name",
"name": "name",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "the number of the pipeline",
"name": "pipeline",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "the step id",
"name": "stepID",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/orgs/{owner}/permissions": {
"get": {
"produces": [
@@ -1795,10 +1841,10 @@ const docTemplate = `{
}
}
},
"/repos/{owner}/{name}/logs/{number}/{pid}": {
"/repos/{owner}/{name}/logs/{number}/{stepID}": {
"get": {
"produces": [
"text/plain"
"application/json"
],
"tags": [
"Pipeline logs"
@@ -1836,76 +1882,21 @@ const docTemplate = `{
},
{
"type": "integer",
"description": "the pipeline id",
"name": "pid",
"description": "the step id",
"name": "stepID",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/repos/{owner}/{name}/logs/{number}/{pid}/{step}": {
"get": {
"produces": [
"text/plain"
],
"tags": [
"Pipeline logs"
],
"summary": "Log information per step",
"parameters": [
{
"type": "string",
"default": "Bearer \u003cpersonal access token\u003e",
"description": "Insert your personal access token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "the repository owner's name",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "the repository name",
"name": "name",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "the number of the pipeline",
"name": "number",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "the pipeline id",
"name": "pid",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "the step name",
"name": "step",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/LogEntry"
}
}
}
}
}
@@ -3800,6 +3791,32 @@ const docTemplate = `{
}
}
},
"LogEntry": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"type": "integer"
}
},
"id": {
"type": "integer"
},
"line": {
"type": "integer"
},
"step_id": {
"type": "integer"
},
"time": {
"type": "integer"
},
"type": {
"$ref": "#/definitions/model.LogEntryType"
}
}
},
"OrgPerm": {
"type": "object",
"properties": {
@@ -4233,6 +4250,9 @@ const docTemplate = `{
},
"state": {
"$ref": "#/definitions/StatusValue"
},
"uuid": {
"type": "string"
}
}
},
@@ -4320,6 +4340,23 @@ const docTemplate = `{
"EventCron",
"EventManual"
]
},
"model.LogEntryType": {
"type": "integer",
"enum": [
0,
1,
2,
3,
4
],
"x-enum-varnames": [
"LogEntryStdout",
"LogEntryStderr",
"LogEntryExitCode",
"LogEntryMetadata",
"LogEntryProgress"
]
}
}
}`