| 1 |
syntax = "proto3"; |
| 2 |
|
| 3 |
package runner.v1; |
| 4 |
|
| 5 |
import "google/protobuf/struct.proto"; |
| 6 |
import "google/protobuf/timestamp.proto"; |
| 7 |
|
| 8 |
message RegisterRequest { |
| 9 |
string name = 1; |
| 10 |
string token = 2; |
| 11 |
repeated string agent_labels = 3 [deprecated = true]; |
| 12 |
repeated string custom_labels = 4 [deprecated = true]; |
| 13 |
string version = 5; |
| 14 |
repeated string labels = 6; |
| 15 |
bool ephemeral = 7; |
| 16 |
} |
| 17 |
|
| 18 |
message RegisterResponse { |
| 19 |
Runner runner = 1; |
| 20 |
} |
| 21 |
|
| 22 |
message DeclareRequest { |
| 23 |
string version = 1; |
| 24 |
repeated string labels = 2; |
| 25 |
} |
| 26 |
|
| 27 |
message DeclareResponse { |
| 28 |
Runner runner = 1; |
| 29 |
} |
| 30 |
|
| 31 |
message FetchTaskRequest { |
| 32 |
// Runner use `tasks_version` to compare with Gitea and determine whether new tasks may exist. |
| 33 |
int64 tasks_version = 1; |
| 34 |
// If provided and `>1`, then multiple tasks may be returned from FetchTask in `additional_tasks`. |
| 35 |
optional int64 task_capacity = 2; |
| 36 |
} |
| 37 |
|
| 38 |
message FetchTaskResponse { |
| 39 |
Task task = 1; |
| 40 |
|
| 41 |
// Gitea informs the Runner of the latest version of tasks through `tasks_version`. |
| 42 |
int64 tasks_version = 2; |
| 43 |
|
| 44 |
// If `task_capacity` was provided in `FetchTaskRequest`, then additional_tasks may indicate multiple assigned tasks |
| 45 |
// to this runner which are returned in `additional_tasks`. `task` would always be populated for the first task, and |
| 46 |
// the first task is omitted from this collection. |
| 47 |
repeated Task additional_tasks = 3; |
| 48 |
} |
| 49 |
|
| 50 |
message FetchSingleTaskRequest { |
| 51 |
// The latest `task_version` received from Forgejo or 0 when none has been received so far. Used by Forgejo to |
| 52 |
// determine whether new tasks are waiting for this runner. |
| 53 |
int64 tasks_version = 1; |
| 54 |
// Optionally request a particular attempt by providing its handle. If the attempt is not ready to be run or not |
| 55 |
// suitable for this runner, Forgejo will not return any task. |
| 56 |
optional string handle = 2; |
| 57 |
} |
| 58 |
|
| 59 |
message FetchSingleTaskResponse { |
| 60 |
// The latest `task_version` recorded by Forgejo. To be included in the next FetchSingleTaskRequest. |
| 61 |
int64 tasks_version = 1; |
| 62 |
|
| 63 |
// Task returned by Forgejo in response to the original request, if any. |
| 64 |
Task task = 2; |
| 65 |
} |
| 66 |
|
| 67 |
message UpdateTaskRequest { |
| 68 |
TaskState state = 1; |
| 69 |
map<string, string> outputs = 2; // The outputs of the task. Since the outputs may be large, the client does not need to send all outputs every time, only the unsent outputs. |
| 70 |
} |
| 71 |
|
| 72 |
message UpdateTaskResponse { |
| 73 |
TaskState state = 1; |
| 74 |
repeated string sent_outputs = 2; // The keys of the outputs that have been sent, not only the ones that have been sent this time, but also those that have been sent before. |
| 75 |
} |
| 76 |
|
| 77 |
message UpdateLogRequest { |
| 78 |
int64 task_id = 1; |
| 79 |
int64 index = 2; // The actual index of the first line. |
| 80 |
repeated LogRow rows = 3; |
| 81 |
bool no_more = 4; // No more logs. |
| 82 |
} |
| 83 |
|
| 84 |
message UpdateLogResponse { |
| 85 |
int64 ack_index = 1; // If all lines are received, should be index + length(lines). |
| 86 |
} |
| 87 |
|
| 88 |
message StepSummary { |
| 89 |
int64 step_number = 1; // Same as StepState.id (zero-based index of a task's step). |
| 90 |
string content = 2; // Markdown, to be rendered. Capped at 1MiB and in contrast to Github truncated on upload. |
| 91 |
} |
| 92 |
|
| 93 |
message UpdateStepSummaryRequest { |
| 94 |
int64 task_id = 1; |
| 95 |
// The full current content of each step summary that changed since the last successful call. |
| 96 |
// The server upserts each entry by (task_id, step_number), making retries idempotent. |
| 97 |
repeated StepSummary summaries = 2; |
| 98 |
} |
| 99 |
|
| 100 |
message UpdateStepSummaryResponse {} |
| 101 |
|
| 102 |
// Runner Payload |
| 103 |
message Runner { |
| 104 |
int64 id = 1; |
| 105 |
string uuid = 2; |
| 106 |
string token = 3; |
| 107 |
string name = 4; |
| 108 |
RunnerStatus status = 5; |
| 109 |
repeated string agent_labels = 6 [deprecated = true]; |
| 110 |
repeated string custom_labels = 7 [deprecated = true]; |
| 111 |
string version = 8; |
| 112 |
repeated string labels = 9; |
| 113 |
bool ephemeral = 10; |
| 114 |
} |
| 115 |
|
| 116 |
// RunnerStatus runner all status |
| 117 |
enum RunnerStatus { |
| 118 |
RUNNER_STATUS_UNSPECIFIED = 0; |
| 119 |
RUNNER_STATUS_IDLE = 1; |
| 120 |
RUNNER_STATUS_ACTIVE = 2; |
| 121 |
RUNNER_STATUS_OFFLINE = 3; |
| 122 |
} |
| 123 |
|
| 124 |
// The result of a task or a step, see https://docs.github.com/en/actions/learn-github-actions/contexts#jobs-context . |
| 125 |
enum Result { |
| 126 |
RESULT_UNSPECIFIED = 0; |
| 127 |
RESULT_SUCCESS = 1; |
| 128 |
RESULT_FAILURE = 2; |
| 129 |
RESULT_CANCELLED = 3; |
| 130 |
RESULT_SKIPPED = 4; |
| 131 |
} |
| 132 |
|
| 133 |
// Task represents a task. |
| 134 |
message Task { |
| 135 |
int64 id = 1; // A unique number for each workflow run, unlike run_id or job_id, task_id never be reused. |
| 136 |
optional bytes workflow_payload = 2; // The content of the expanded workflow yaml file. |
| 137 |
optional google.protobuf.Struct context = 3; // See https://docs.github.com/en/actions/learn-github-actions/contexts#github-context . |
| 138 |
map<string, string> secrets = 4; // See https://docs.github.com/en/actions/learn-github-actions/contexts#secrets-context . |
| 139 |
string machine = 5 [deprecated = true]; // Unused. |
| 140 |
map<string, TaskNeed> needs = 6; // See https://docs.github.com/en/actions/learn-github-actions/contexts#needs-context . |
| 141 |
map<string, string> vars = 7; // See https://docs.github.com/en/actions/learn-github-actions/contexts#vars-context . |
| 142 |
} |
| 143 |
|
| 144 |
// TaskNeed represents a task need. |
| 145 |
message TaskNeed { |
| 146 |
map<string, string> outputs = 1; // The set of outputs of a job that the current job depends on. |
| 147 |
Result result = 2; // The result of a job that the current job depends on. Possible values are success, failure, cancelled, or skipped. |
| 148 |
} |
| 149 |
|
| 150 |
// TaskState represents the state of a task. |
| 151 |
message TaskState { |
| 152 |
int64 id = 1; |
| 153 |
Result result = 2; |
| 154 |
google.protobuf.Timestamp started_at = 3; |
| 155 |
google.protobuf.Timestamp stopped_at = 4; |
| 156 |
repeated StepState steps = 5; |
| 157 |
} |
| 158 |
|
| 159 |
// TaskState represents the state of a step. |
| 160 |
message StepState { |
| 161 |
int64 id = 1; |
| 162 |
Result result = 2; |
| 163 |
google.protobuf.Timestamp started_at = 3; |
| 164 |
google.protobuf.Timestamp stopped_at = 4; |
| 165 |
int64 log_index = 5; // Where the first line log of the step. |
| 166 |
int64 log_length = 6; // How many logs the step has. |
| 167 |
} |
| 168 |
|
| 169 |
// LogRow represents a row of logs. |
| 170 |
message LogRow { |
| 171 |
google.protobuf.Timestamp time = 1; |
| 172 |
string content = 2; |
| 173 |
} |