1// SPDX-License-Identifier: MIT
2
3// Code generated by protoc-gen-connect-go. DO NOT EDIT.
4//
5// Source: ermite/run.proto
6
7package ermiteconnect
8
9import (
10 ermite "bnema.dev/ermite-api/gen/ermite"
11 connect "connectrpc.com/connect"
12 context "context"
13 errors "errors"
14 http "net/http"
15 strings "strings"
16)
17
18// This is a compile-time assertion to ensure that this generated file and the connect package are
19// compatible. If you get a compiler error that this constant is not defined, this code was
20// generated with a version of connect newer than the one compiled into your binary. You can fix the
21// problem by either regenerating this code with an older version of connect or updating the connect
22// version compiled into your binary.
23const _ = connect.IsAtLeastVersion1_13_0
24
25const (
26 // RunServiceName is the fully-qualified name of the RunService service.
27 RunServiceName = "ermite.RunService"
28)
29
30// These constants are the fully-qualified names of the RPCs defined in this package. They're
31// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
32//
33// Note that these are different from the fully-qualified method names used by
34// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
35// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
36// period.
37const (
38 // RunServiceListRunsProcedure is the fully-qualified name of the RunService's ListRuns RPC.
39 RunServiceListRunsProcedure = "/ermite.RunService/ListRuns"
40 // RunServiceGetRunProcedure is the fully-qualified name of the RunService's GetRun RPC.
41 RunServiceGetRunProcedure = "/ermite.RunService/GetRun"
42 // RunServiceGetJobProcedure is the fully-qualified name of the RunService's GetJob RPC.
43 RunServiceGetJobProcedure = "/ermite.RunService/GetJob"
44 // RunServiceListAnnotationsProcedure is the fully-qualified name of the RunService's
45 // ListAnnotations RPC.
46 RunServiceListAnnotationsProcedure = "/ermite.RunService/ListAnnotations"
47 // RunServiceGetStepSummariesProcedure is the fully-qualified name of the RunService's
48 // GetStepSummaries RPC.
49 RunServiceGetStepSummariesProcedure = "/ermite.RunService/GetStepSummaries"
50 // RunServiceGetJobLogProcedure is the fully-qualified name of the RunService's GetJobLog RPC.
51 RunServiceGetJobLogProcedure = "/ermite.RunService/GetJobLog"
52 // RunServiceCancelRunProcedure is the fully-qualified name of the RunService's CancelRun RPC.
53 RunServiceCancelRunProcedure = "/ermite.RunService/CancelRun"
54 // RunServiceRerunRunProcedure is the fully-qualified name of the RunService's RerunRun RPC.
55 RunServiceRerunRunProcedure = "/ermite.RunService/RerunRun"
56 // RunServiceDispatchWorkflowProcedure is the fully-qualified name of the RunService's
57 // DispatchWorkflow RPC.
58 RunServiceDispatchWorkflowProcedure = "/ermite.RunService/DispatchWorkflow"
59 // RunServiceListWorkflowsProcedure is the fully-qualified name of the RunService's ListWorkflows
60 // RPC.
61 RunServiceListWorkflowsProcedure = "/ermite.RunService/ListWorkflows"
62 // RunServiceDisableWorkflowProcedure is the fully-qualified name of the RunService's
63 // DisableWorkflow RPC.
64 RunServiceDisableWorkflowProcedure = "/ermite.RunService/DisableWorkflow"
65 // RunServiceEnableWorkflowProcedure is the fully-qualified name of the RunService's EnableWorkflow
66 // RPC.
67 RunServiceEnableWorkflowProcedure = "/ermite.RunService/EnableWorkflow"
68 // RunServiceListChecksProcedure is the fully-qualified name of the RunService's ListChecks RPC.
69 RunServiceListChecksProcedure = "/ermite.RunService/ListChecks"
70 // RunServiceListRunnersProcedure is the fully-qualified name of the RunService's ListRunners RPC.
71 RunServiceListRunnersProcedure = "/ermite.RunService/ListRunners"
72 // RunServiceRemoveRunnerProcedure is the fully-qualified name of the RunService's RemoveRunner RPC.
73 RunServiceRemoveRunnerProcedure = "/ermite.RunService/RemoveRunner"
74)
75
76// RunServiceClient is a client for the ermite.RunService service.
77type RunServiceClient interface {
78 // ListRuns lists the runs of a repository, highest id (newest) first. Each
79 // run is described by its latest attempt. The filters narrow the result; a
80 // server without the feature "ci.runs.filters" ignores them and returns
81 // every run, so a client that needs them checks the feature. Fails with
82 // invalid_argument if a filter is malformed.
83 ListRuns(context.Context, *connect.Request[ermite.ListRunsRequest]) (*connect.Response[ermite.ListRunsResponse], error)
84 // GetRun returns a run with its jobs and their steps, for the latest attempt
85 // or for the one asked. Fails with not_found if the run or the attempt does
86 // not exist.
87 GetRun(context.Context, *connect.Request[ermite.GetRunRequest]) (*connect.Response[ermite.GetRunResponse], error)
88 // GetJob returns one job with its steps. Fails with not_found if the job
89 // or the attempt does not exist.
90 GetJob(context.Context, *connect.Request[ermite.GetJobRequest]) (*connect.Response[ermite.GetJobResponse], error)
91 // ListAnnotations lists the annotations of a run attempt, optionally of one
92 // job, ordered by job (as in GetRun), step number, then the order in which
93 // the step produced them. For each job it gives the annotations of the
94 // attempt in which that job executed (RunJob.attempt), which is lower than
95 // the attempt of the run for a job kept by a re-run of failed jobs only. Needs the same access as GetRun. Returns at most
96 // 1,000 annotations (truncated tells). A run without annotations gives an
97 // empty list. Only servers with the feature "ci.annotations" implement it
98 // (unimplemented otherwise). Fails with not_found if the run, the attempt or
99 // the job does not exist, or if the job is not a job of the run.
100 ListAnnotations(context.Context, *connect.Request[ermite.ListAnnotationsRequest]) (*connect.Response[ermite.ListAnnotationsResponse], error)
101 // GetStepSummaries returns the job summaries (the Markdown written to
102 // GITHUB_STEP_SUMMARY) of the steps of a job that have one, ordered by step
103 // number. Like GitHub, it returns at most 20 summaries per job: the first 20
104 // steps that have one, in step order; truncated says there are more. Needs
105 // the same access as GetJob. Only servers with the feature
106 // "ci.summaries" implement it (unimplemented otherwise). A job without
107 // summaries gives an empty list. Fails with not_found if the job or the
108 // attempt does not exist.
109 GetStepSummaries(context.Context, *connect.Request[ermite.GetStepSummariesRequest]) (*connect.Response[ermite.GetStepSummariesResponse], error)
110 // GetJobLog streams the lines of the log of a job, from a line number. The
111 // server sends them in order in messages of at most 1,000 lines and 64 KiB of
112 // text each.
113 //
114 // Without follow, the stream ends after the last line stored when the call
115 // was made. With follow, it goes on as lines arrive, with at most 1 second of
116 // delay after the runner's AppendLog, and ends without error once the job has
117 // completed and all its lines were sent; on a completed job follow changes
118 // nothing. A client that loses the stream calls again with the offset after
119 // the last line it received. The client may cancel at any time.
120 //
121 // Fails with not_found if the job, the attempt or its log does not exist (the
122 // log is removed by the retention sweep, and a queued job has none: with
123 // follow, the call waits for the first line instead), with out_of_range if
124 // offset is beyond the end of the log of a job without follow, and with
125 // resource_exhausted when there are too many concurrent log streams, in
126 // total or from one client. Like Watch, a stream ends with unauthenticated
127 // when the token was revoked or expired.
128 GetJobLog(context.Context, *connect.Request[ermite.GetJobLogRequest]) (*connect.ServerStreamForClient[ermite.GetJobLogResponse], error)
129 // CancelRun asks to cancel the latest attempt of a run. Needs the ci:write
130 // scope. Jobs that have not started are cancelled at once; jobs in progress
131 // get a CANCEL_REASON_USER request through WatchJob, and the run completes
132 // when they have ended, so the returned run may still be IN_PROGRESS.
133 // Cancelling a run that already has a cancellation requested succeeds and
134 // changes nothing. Fails with failed_precondition if the run has completed.
135 CancelRun(context.Context, *connect.Request[ermite.CancelRunRequest]) (*connect.Response[ermite.CancelRunResponse], error)
136 // RerunRun starts a new attempt of a completed run: same run id and number,
137 // attempt + 1, same commit and same workflow file as at the original run (the
138 // file of the repository is not read again). Needs the ci:write scope. Fails
139 // with failed_precondition if the latest attempt has not completed, or if
140 // failed_only is set and no job failed. The new attempt is returned QUEUED.
141 RerunRun(context.Context, *connect.Request[ermite.RerunRunRequest]) (*connect.Response[ermite.RerunRunResponse], error)
142 // DispatchWorkflow starts a run of a workflow file by hand, like `gh
143 // workflow run` and GitHub's "workflow_dispatch" event. Needs the ci:write
144 // scope on the repository. The workflow is read at ref and must have
145 // "workflow_dispatch" among its events. The run has event
146 // "workflow_dispatch", ref and the commit ref points to, and the caller as
147 // actor; it is trusted when the caller is the owner and not trusted when the
148 // caller is a token limited to branches. The run is returned QUEUED, before
149 // any job has been given to a runner. Only servers with the feature
150 // "ci.dispatch" implement it (unimplemented otherwise). Fails with
151 // not_found if the repository, the workflow file or ref does not exist,
152 // with failed_precondition if the workflow does not declare
153 // "workflow_dispatch", and with invalid_argument if an input is unknown, is
154 // missing while required without default, or has a value of the wrong type
155 // or outside its choices, or if the workflow file is not valid.
156 DispatchWorkflow(context.Context, *connect.Request[ermite.DispatchWorkflowRequest]) (*connect.Response[ermite.DispatchWorkflowResponse], error)
157 // ListWorkflows lists the workflow files of a repository with their state,
158 // like `gh workflow list --all`, ordered by path: the files of
159 // .github/workflows at the tip of the default branch, and the files that are
160 // disabled even if the default branch has no such file (a repository that
161 // is empty, or a file not pushed yet). Needs the same access as reading the
162 // repository. A repository without a default branch lists only its disabled
163 // files. Only servers with the feature "ci.workflows" implement it
164 // (unimplemented otherwise). Fails with not_found if the repository does not
165 // exist or cannot be read.
166 ListWorkflows(context.Context, *connect.Request[ermite.ListWorkflowsRequest]) (*connect.Response[ermite.ListWorkflowsResponse], error)
167 // DisableWorkflow disables a workflow file of a repository, like `gh
168 // workflow disable`: no event starts a run of it any more (push,
169 // pull_request, pull_request_target, schedule, workflow_run, create,
170 // delete, and workflow_dispatch). Runs already started are not affected.
171 // The state belongs to the repository and to the file path, not to a
172 // commit or a branch, and the file does not have to exist: it can be set on
173 // an empty repository, before the first push. Disabling a disabled workflow
174 // succeeds and changes nothing. Needs the repo:admin scope on the
175 // repository, and a token that is not limited to branch prefixes. Only
176 // servers with the feature "ci.workflows" implement it (unimplemented
177 // otherwise). Fails with not_found if the repository does not exist or the
178 // caller cannot read it, permission_denied without the scope, and
179 // invalid_argument if the workflow is not a file name or a path of
180 // .github/workflows ending in .yml or .yaml.
181 DisableWorkflow(context.Context, *connect.Request[ermite.DisableWorkflowRequest]) (*connect.Response[ermite.DisableWorkflowResponse], error)
182 // EnableWorkflow undoes DisableWorkflow, like `gh workflow enable`. Enabling
183 // a workflow that is not disabled succeeds and changes nothing. Same access
184 // and errors as DisableWorkflow. Events that happened while the workflow was
185 // disabled are not replayed.
186 EnableWorkflow(context.Context, *connect.Request[ermite.EnableWorkflowRequest]) (*connect.Response[ermite.EnableWorkflowResponse], error)
187 // ListChecks lists the checks of a commit: for each job of each run on that
188 // sha, the one of the latest attempt, ordered by creation time then name.
189 // A commit without a run has no check: the list is empty, which is not an
190 // error, and the server does not verify that the commit exists. Returns at
191 // most 1,000 checks (truncated tells).
192 ListChecks(context.Context, *connect.Request[ermite.ListChecksRequest]) (*connect.Response[ermite.ListChecksResponse], error)
193 // ListRunners lists the registered runners, ordered by name. Needs the
194 // runner:register scope.
195 ListRunners(context.Context, *connect.Request[ermite.ListRunnersRequest]) (*connect.Response[ermite.ListRunnersResponse], error)
196 // RemoveRunner removes a runner: its runner token stops working at once (a
197 // FetchJob in progress ends with unauthenticated) and it no longer gets
198 // jobs. A job it is running is not affected: it ends normally, or fails as
199 // a lost runner without heartbeats. Needs the runner:register scope. Fails
200 // with not_found if the id is unknown.
201 RemoveRunner(context.Context, *connect.Request[ermite.RemoveRunnerRequest]) (*connect.Response[ermite.RemoveRunnerResponse], error)
202}
203
204// NewRunServiceClient constructs a client for the ermite.RunService service. By default, it uses
205// the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends
206// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or
207// connect.WithGRPCWeb() options.
208//
209// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
210// http://api.acme.com or https://acme.com/grpc).
211func NewRunServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) RunServiceClient {
212 baseURL = strings.TrimRight(baseURL, "/")
213 runServiceMethods := ermite.File_ermite_run_proto.Services().ByName("RunService").Methods()
214 return &runServiceClient{
215 listRuns: connect.NewClient[ermite.ListRunsRequest, ermite.ListRunsResponse](
216 httpClient,
217 baseURL+RunServiceListRunsProcedure,
218 connect.WithSchema(runServiceMethods.ByName("ListRuns")),
219 connect.WithClientOptions(opts...),
220 ),
221 getRun: connect.NewClient[ermite.GetRunRequest, ermite.GetRunResponse](
222 httpClient,
223 baseURL+RunServiceGetRunProcedure,
224 connect.WithSchema(runServiceMethods.ByName("GetRun")),
225 connect.WithClientOptions(opts...),
226 ),
227 getJob: connect.NewClient[ermite.GetJobRequest, ermite.GetJobResponse](
228 httpClient,
229 baseURL+RunServiceGetJobProcedure,
230 connect.WithSchema(runServiceMethods.ByName("GetJob")),
231 connect.WithClientOptions(opts...),
232 ),
233 listAnnotations: connect.NewClient[ermite.ListAnnotationsRequest, ermite.ListAnnotationsResponse](
234 httpClient,
235 baseURL+RunServiceListAnnotationsProcedure,
236 connect.WithSchema(runServiceMethods.ByName("ListAnnotations")),
237 connect.WithClientOptions(opts...),
238 ),
239 getStepSummaries: connect.NewClient[ermite.GetStepSummariesRequest, ermite.GetStepSummariesResponse](
240 httpClient,
241 baseURL+RunServiceGetStepSummariesProcedure,
242 connect.WithSchema(runServiceMethods.ByName("GetStepSummaries")),
243 connect.WithClientOptions(opts...),
244 ),
245 getJobLog: connect.NewClient[ermite.GetJobLogRequest, ermite.GetJobLogResponse](
246 httpClient,
247 baseURL+RunServiceGetJobLogProcedure,
248 connect.WithSchema(runServiceMethods.ByName("GetJobLog")),
249 connect.WithClientOptions(opts...),
250 ),
251 cancelRun: connect.NewClient[ermite.CancelRunRequest, ermite.CancelRunResponse](
252 httpClient,
253 baseURL+RunServiceCancelRunProcedure,
254 connect.WithSchema(runServiceMethods.ByName("CancelRun")),
255 connect.WithClientOptions(opts...),
256 ),
257 rerunRun: connect.NewClient[ermite.RerunRunRequest, ermite.RerunRunResponse](
258 httpClient,
259 baseURL+RunServiceRerunRunProcedure,
260 connect.WithSchema(runServiceMethods.ByName("RerunRun")),
261 connect.WithClientOptions(opts...),
262 ),
263 dispatchWorkflow: connect.NewClient[ermite.DispatchWorkflowRequest, ermite.DispatchWorkflowResponse](
264 httpClient,
265 baseURL+RunServiceDispatchWorkflowProcedure,
266 connect.WithSchema(runServiceMethods.ByName("DispatchWorkflow")),
267 connect.WithClientOptions(opts...),
268 ),
269 listWorkflows: connect.NewClient[ermite.ListWorkflowsRequest, ermite.ListWorkflowsResponse](
270 httpClient,
271 baseURL+RunServiceListWorkflowsProcedure,
272 connect.WithSchema(runServiceMethods.ByName("ListWorkflows")),
273 connect.WithClientOptions(opts...),
274 ),
275 disableWorkflow: connect.NewClient[ermite.DisableWorkflowRequest, ermite.DisableWorkflowResponse](
276 httpClient,
277 baseURL+RunServiceDisableWorkflowProcedure,
278 connect.WithSchema(runServiceMethods.ByName("DisableWorkflow")),
279 connect.WithClientOptions(opts...),
280 ),
281 enableWorkflow: connect.NewClient[ermite.EnableWorkflowRequest, ermite.EnableWorkflowResponse](
282 httpClient,
283 baseURL+RunServiceEnableWorkflowProcedure,
284 connect.WithSchema(runServiceMethods.ByName("EnableWorkflow")),
285 connect.WithClientOptions(opts...),
286 ),
287 listChecks: connect.NewClient[ermite.ListChecksRequest, ermite.ListChecksResponse](
288 httpClient,
289 baseURL+RunServiceListChecksProcedure,
290 connect.WithSchema(runServiceMethods.ByName("ListChecks")),
291 connect.WithClientOptions(opts...),
292 ),
293 listRunners: connect.NewClient[ermite.ListRunnersRequest, ermite.ListRunnersResponse](
294 httpClient,
295 baseURL+RunServiceListRunnersProcedure,
296 connect.WithSchema(runServiceMethods.ByName("ListRunners")),
297 connect.WithClientOptions(opts...),
298 ),
299 removeRunner: connect.NewClient[ermite.RemoveRunnerRequest, ermite.RemoveRunnerResponse](
300 httpClient,
301 baseURL+RunServiceRemoveRunnerProcedure,
302 connect.WithSchema(runServiceMethods.ByName("RemoveRunner")),
303 connect.WithClientOptions(opts...),
304 ),
305 }
306}
307
308// runServiceClient implements RunServiceClient.
309type runServiceClient struct {
310 listRuns *connect.Client[ermite.ListRunsRequest, ermite.ListRunsResponse]
311 getRun *connect.Client[ermite.GetRunRequest, ermite.GetRunResponse]
312 getJob *connect.Client[ermite.GetJobRequest, ermite.GetJobResponse]
313 listAnnotations *connect.Client[ermite.ListAnnotationsRequest, ermite.ListAnnotationsResponse]
314 getStepSummaries *connect.Client[ermite.GetStepSummariesRequest, ermite.GetStepSummariesResponse]
315 getJobLog *connect.Client[ermite.GetJobLogRequest, ermite.GetJobLogResponse]
316 cancelRun *connect.Client[ermite.CancelRunRequest, ermite.CancelRunResponse]
317 rerunRun *connect.Client[ermite.RerunRunRequest, ermite.RerunRunResponse]
318 dispatchWorkflow *connect.Client[ermite.DispatchWorkflowRequest, ermite.DispatchWorkflowResponse]
319 listWorkflows *connect.Client[ermite.ListWorkflowsRequest, ermite.ListWorkflowsResponse]
320 disableWorkflow *connect.Client[ermite.DisableWorkflowRequest, ermite.DisableWorkflowResponse]
321 enableWorkflow *connect.Client[ermite.EnableWorkflowRequest, ermite.EnableWorkflowResponse]
322 listChecks *connect.Client[ermite.ListChecksRequest, ermite.ListChecksResponse]
323 listRunners *connect.Client[ermite.ListRunnersRequest, ermite.ListRunnersResponse]
324 removeRunner *connect.Client[ermite.RemoveRunnerRequest, ermite.RemoveRunnerResponse]
325}
326
327// ListRuns calls ermite.RunService.ListRuns.
328func (c *runServiceClient) ListRuns(ctx context.Context, req *connect.Request[ermite.ListRunsRequest]) (*connect.Response[ermite.ListRunsResponse], error) {
329 return c.listRuns.CallUnary(ctx, req)
330}
331
332// GetRun calls ermite.RunService.GetRun.
333func (c *runServiceClient) GetRun(ctx context.Context, req *connect.Request[ermite.GetRunRequest]) (*connect.Response[ermite.GetRunResponse], error) {
334 return c.getRun.CallUnary(ctx, req)
335}
336
337// GetJob calls ermite.RunService.GetJob.
338func (c *runServiceClient) GetJob(ctx context.Context, req *connect.Request[ermite.GetJobRequest]) (*connect.Response[ermite.GetJobResponse], error) {
339 return c.getJob.CallUnary(ctx, req)
340}
341
342// ListAnnotations calls ermite.RunService.ListAnnotations.
343func (c *runServiceClient) ListAnnotations(ctx context.Context, req *connect.Request[ermite.ListAnnotationsRequest]) (*connect.Response[ermite.ListAnnotationsResponse], error) {
344 return c.listAnnotations.CallUnary(ctx, req)
345}
346
347// GetStepSummaries calls ermite.RunService.GetStepSummaries.
348func (c *runServiceClient) GetStepSummaries(ctx context.Context, req *connect.Request[ermite.GetStepSummariesRequest]) (*connect.Response[ermite.GetStepSummariesResponse], error) {
349 return c.getStepSummaries.CallUnary(ctx, req)
350}
351
352// GetJobLog calls ermite.RunService.GetJobLog.
353func (c *runServiceClient) GetJobLog(ctx context.Context, req *connect.Request[ermite.GetJobLogRequest]) (*connect.ServerStreamForClient[ermite.GetJobLogResponse], error) {
354 return c.getJobLog.CallServerStream(ctx, req)
355}
356
357// CancelRun calls ermite.RunService.CancelRun.
358func (c *runServiceClient) CancelRun(ctx context.Context, req *connect.Request[ermite.CancelRunRequest]) (*connect.Response[ermite.CancelRunResponse], error) {
359 return c.cancelRun.CallUnary(ctx, req)
360}
361
362// RerunRun calls ermite.RunService.RerunRun.
363func (c *runServiceClient) RerunRun(ctx context.Context, req *connect.Request[ermite.RerunRunRequest]) (*connect.Response[ermite.RerunRunResponse], error) {
364 return c.rerunRun.CallUnary(ctx, req)
365}
366
367// DispatchWorkflow calls ermite.RunService.DispatchWorkflow.
368func (c *runServiceClient) DispatchWorkflow(ctx context.Context, req *connect.Request[ermite.DispatchWorkflowRequest]) (*connect.Response[ermite.DispatchWorkflowResponse], error) {
369 return c.dispatchWorkflow.CallUnary(ctx, req)
370}
371
372// ListWorkflows calls ermite.RunService.ListWorkflows.
373func (c *runServiceClient) ListWorkflows(ctx context.Context, req *connect.Request[ermite.ListWorkflowsRequest]) (*connect.Response[ermite.ListWorkflowsResponse], error) {
374 return c.listWorkflows.CallUnary(ctx, req)
375}
376
377// DisableWorkflow calls ermite.RunService.DisableWorkflow.
378func (c *runServiceClient) DisableWorkflow(ctx context.Context, req *connect.Request[ermite.DisableWorkflowRequest]) (*connect.Response[ermite.DisableWorkflowResponse], error) {
379 return c.disableWorkflow.CallUnary(ctx, req)
380}
381
382// EnableWorkflow calls ermite.RunService.EnableWorkflow.
383func (c *runServiceClient) EnableWorkflow(ctx context.Context, req *connect.Request[ermite.EnableWorkflowRequest]) (*connect.Response[ermite.EnableWorkflowResponse], error) {
384 return c.enableWorkflow.CallUnary(ctx, req)
385}
386
387// ListChecks calls ermite.RunService.ListChecks.
388func (c *runServiceClient) ListChecks(ctx context.Context, req *connect.Request[ermite.ListChecksRequest]) (*connect.Response[ermite.ListChecksResponse], error) {
389 return c.listChecks.CallUnary(ctx, req)
390}
391
392// ListRunners calls ermite.RunService.ListRunners.
393func (c *runServiceClient) ListRunners(ctx context.Context, req *connect.Request[ermite.ListRunnersRequest]) (*connect.Response[ermite.ListRunnersResponse], error) {
394 return c.listRunners.CallUnary(ctx, req)
395}
396
397// RemoveRunner calls ermite.RunService.RemoveRunner.
398func (c *runServiceClient) RemoveRunner(ctx context.Context, req *connect.Request[ermite.RemoveRunnerRequest]) (*connect.Response[ermite.RemoveRunnerResponse], error) {
399 return c.removeRunner.CallUnary(ctx, req)
400}
401
402// RunServiceHandler is an implementation of the ermite.RunService service.
403type RunServiceHandler interface {
404 // ListRuns lists the runs of a repository, highest id (newest) first. Each
405 // run is described by its latest attempt. The filters narrow the result; a
406 // server without the feature "ci.runs.filters" ignores them and returns
407 // every run, so a client that needs them checks the feature. Fails with
408 // invalid_argument if a filter is malformed.
409 ListRuns(context.Context, *connect.Request[ermite.ListRunsRequest]) (*connect.Response[ermite.ListRunsResponse], error)
410 // GetRun returns a run with its jobs and their steps, for the latest attempt
411 // or for the one asked. Fails with not_found if the run or the attempt does
412 // not exist.
413 GetRun(context.Context, *connect.Request[ermite.GetRunRequest]) (*connect.Response[ermite.GetRunResponse], error)
414 // GetJob returns one job with its steps. Fails with not_found if the job
415 // or the attempt does not exist.
416 GetJob(context.Context, *connect.Request[ermite.GetJobRequest]) (*connect.Response[ermite.GetJobResponse], error)
417 // ListAnnotations lists the annotations of a run attempt, optionally of one
418 // job, ordered by job (as in GetRun), step number, then the order in which
419 // the step produced them. For each job it gives the annotations of the
420 // attempt in which that job executed (RunJob.attempt), which is lower than
421 // the attempt of the run for a job kept by a re-run of failed jobs only. Needs the same access as GetRun. Returns at most
422 // 1,000 annotations (truncated tells). A run without annotations gives an
423 // empty list. Only servers with the feature "ci.annotations" implement it
424 // (unimplemented otherwise). Fails with not_found if the run, the attempt or
425 // the job does not exist, or if the job is not a job of the run.
426 ListAnnotations(context.Context, *connect.Request[ermite.ListAnnotationsRequest]) (*connect.Response[ermite.ListAnnotationsResponse], error)
427 // GetStepSummaries returns the job summaries (the Markdown written to
428 // GITHUB_STEP_SUMMARY) of the steps of a job that have one, ordered by step
429 // number. Like GitHub, it returns at most 20 summaries per job: the first 20
430 // steps that have one, in step order; truncated says there are more. Needs
431 // the same access as GetJob. Only servers with the feature
432 // "ci.summaries" implement it (unimplemented otherwise). A job without
433 // summaries gives an empty list. Fails with not_found if the job or the
434 // attempt does not exist.
435 GetStepSummaries(context.Context, *connect.Request[ermite.GetStepSummariesRequest]) (*connect.Response[ermite.GetStepSummariesResponse], error)
436 // GetJobLog streams the lines of the log of a job, from a line number. The
437 // server sends them in order in messages of at most 1,000 lines and 64 KiB of
438 // text each.
439 //
440 // Without follow, the stream ends after the last line stored when the call
441 // was made. With follow, it goes on as lines arrive, with at most 1 second of
442 // delay after the runner's AppendLog, and ends without error once the job has
443 // completed and all its lines were sent; on a completed job follow changes
444 // nothing. A client that loses the stream calls again with the offset after
445 // the last line it received. The client may cancel at any time.
446 //
447 // Fails with not_found if the job, the attempt or its log does not exist (the
448 // log is removed by the retention sweep, and a queued job has none: with
449 // follow, the call waits for the first line instead), with out_of_range if
450 // offset is beyond the end of the log of a job without follow, and with
451 // resource_exhausted when there are too many concurrent log streams, in
452 // total or from one client. Like Watch, a stream ends with unauthenticated
453 // when the token was revoked or expired.
454 GetJobLog(context.Context, *connect.Request[ermite.GetJobLogRequest], *connect.ServerStream[ermite.GetJobLogResponse]) error
455 // CancelRun asks to cancel the latest attempt of a run. Needs the ci:write
456 // scope. Jobs that have not started are cancelled at once; jobs in progress
457 // get a CANCEL_REASON_USER request through WatchJob, and the run completes
458 // when they have ended, so the returned run may still be IN_PROGRESS.
459 // Cancelling a run that already has a cancellation requested succeeds and
460 // changes nothing. Fails with failed_precondition if the run has completed.
461 CancelRun(context.Context, *connect.Request[ermite.CancelRunRequest]) (*connect.Response[ermite.CancelRunResponse], error)
462 // RerunRun starts a new attempt of a completed run: same run id and number,
463 // attempt + 1, same commit and same workflow file as at the original run (the
464 // file of the repository is not read again). Needs the ci:write scope. Fails
465 // with failed_precondition if the latest attempt has not completed, or if
466 // failed_only is set and no job failed. The new attempt is returned QUEUED.
467 RerunRun(context.Context, *connect.Request[ermite.RerunRunRequest]) (*connect.Response[ermite.RerunRunResponse], error)
468 // DispatchWorkflow starts a run of a workflow file by hand, like `gh
469 // workflow run` and GitHub's "workflow_dispatch" event. Needs the ci:write
470 // scope on the repository. The workflow is read at ref and must have
471 // "workflow_dispatch" among its events. The run has event
472 // "workflow_dispatch", ref and the commit ref points to, and the caller as
473 // actor; it is trusted when the caller is the owner and not trusted when the
474 // caller is a token limited to branches. The run is returned QUEUED, before
475 // any job has been given to a runner. Only servers with the feature
476 // "ci.dispatch" implement it (unimplemented otherwise). Fails with
477 // not_found if the repository, the workflow file or ref does not exist,
478 // with failed_precondition if the workflow does not declare
479 // "workflow_dispatch", and with invalid_argument if an input is unknown, is
480 // missing while required without default, or has a value of the wrong type
481 // or outside its choices, or if the workflow file is not valid.
482 DispatchWorkflow(context.Context, *connect.Request[ermite.DispatchWorkflowRequest]) (*connect.Response[ermite.DispatchWorkflowResponse], error)
483 // ListWorkflows lists the workflow files of a repository with their state,
484 // like `gh workflow list --all`, ordered by path: the files of
485 // .github/workflows at the tip of the default branch, and the files that are
486 // disabled even if the default branch has no such file (a repository that
487 // is empty, or a file not pushed yet). Needs the same access as reading the
488 // repository. A repository without a default branch lists only its disabled
489 // files. Only servers with the feature "ci.workflows" implement it
490 // (unimplemented otherwise). Fails with not_found if the repository does not
491 // exist or cannot be read.
492 ListWorkflows(context.Context, *connect.Request[ermite.ListWorkflowsRequest]) (*connect.Response[ermite.ListWorkflowsResponse], error)
493 // DisableWorkflow disables a workflow file of a repository, like `gh
494 // workflow disable`: no event starts a run of it any more (push,
495 // pull_request, pull_request_target, schedule, workflow_run, create,
496 // delete, and workflow_dispatch). Runs already started are not affected.
497 // The state belongs to the repository and to the file path, not to a
498 // commit or a branch, and the file does not have to exist: it can be set on
499 // an empty repository, before the first push. Disabling a disabled workflow
500 // succeeds and changes nothing. Needs the repo:admin scope on the
501 // repository, and a token that is not limited to branch prefixes. Only
502 // servers with the feature "ci.workflows" implement it (unimplemented
503 // otherwise). Fails with not_found if the repository does not exist or the
504 // caller cannot read it, permission_denied without the scope, and
505 // invalid_argument if the workflow is not a file name or a path of
506 // .github/workflows ending in .yml or .yaml.
507 DisableWorkflow(context.Context, *connect.Request[ermite.DisableWorkflowRequest]) (*connect.Response[ermite.DisableWorkflowResponse], error)
508 // EnableWorkflow undoes DisableWorkflow, like `gh workflow enable`. Enabling
509 // a workflow that is not disabled succeeds and changes nothing. Same access
510 // and errors as DisableWorkflow. Events that happened while the workflow was
511 // disabled are not replayed.
512 EnableWorkflow(context.Context, *connect.Request[ermite.EnableWorkflowRequest]) (*connect.Response[ermite.EnableWorkflowResponse], error)
513 // ListChecks lists the checks of a commit: for each job of each run on that
514 // sha, the one of the latest attempt, ordered by creation time then name.
515 // A commit without a run has no check: the list is empty, which is not an
516 // error, and the server does not verify that the commit exists. Returns at
517 // most 1,000 checks (truncated tells).
518 ListChecks(context.Context, *connect.Request[ermite.ListChecksRequest]) (*connect.Response[ermite.ListChecksResponse], error)
519 // ListRunners lists the registered runners, ordered by name. Needs the
520 // runner:register scope.
521 ListRunners(context.Context, *connect.Request[ermite.ListRunnersRequest]) (*connect.Response[ermite.ListRunnersResponse], error)
522 // RemoveRunner removes a runner: its runner token stops working at once (a
523 // FetchJob in progress ends with unauthenticated) and it no longer gets
524 // jobs. A job it is running is not affected: it ends normally, or fails as
525 // a lost runner without heartbeats. Needs the runner:register scope. Fails
526 // with not_found if the id is unknown.
527 RemoveRunner(context.Context, *connect.Request[ermite.RemoveRunnerRequest]) (*connect.Response[ermite.RemoveRunnerResponse], error)
528}
529
530// NewRunServiceHandler builds an HTTP handler from the service implementation. It returns the path
531// on which to mount the handler and the handler itself.
532//
533// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
534// and JSON codecs. They also support gzip compression.
535func NewRunServiceHandler(svc RunServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
536 runServiceMethods := ermite.File_ermite_run_proto.Services().ByName("RunService").Methods()
537 runServiceListRunsHandler := connect.NewUnaryHandler(
538 RunServiceListRunsProcedure,
539 svc.ListRuns,
540 connect.WithSchema(runServiceMethods.ByName("ListRuns")),
541 connect.WithHandlerOptions(opts...),
542 )
543 runServiceGetRunHandler := connect.NewUnaryHandler(
544 RunServiceGetRunProcedure,
545 svc.GetRun,
546 connect.WithSchema(runServiceMethods.ByName("GetRun")),
547 connect.WithHandlerOptions(opts...),
548 )
549 runServiceGetJobHandler := connect.NewUnaryHandler(
550 RunServiceGetJobProcedure,
551 svc.GetJob,
552 connect.WithSchema(runServiceMethods.ByName("GetJob")),
553 connect.WithHandlerOptions(opts...),
554 )
555 runServiceListAnnotationsHandler := connect.NewUnaryHandler(
556 RunServiceListAnnotationsProcedure,
557 svc.ListAnnotations,
558 connect.WithSchema(runServiceMethods.ByName("ListAnnotations")),
559 connect.WithHandlerOptions(opts...),
560 )
561 runServiceGetStepSummariesHandler := connect.NewUnaryHandler(
562 RunServiceGetStepSummariesProcedure,
563 svc.GetStepSummaries,
564 connect.WithSchema(runServiceMethods.ByName("GetStepSummaries")),
565 connect.WithHandlerOptions(opts...),
566 )
567 runServiceGetJobLogHandler := connect.NewServerStreamHandler(
568 RunServiceGetJobLogProcedure,
569 svc.GetJobLog,
570 connect.WithSchema(runServiceMethods.ByName("GetJobLog")),
571 connect.WithHandlerOptions(opts...),
572 )
573 runServiceCancelRunHandler := connect.NewUnaryHandler(
574 RunServiceCancelRunProcedure,
575 svc.CancelRun,
576 connect.WithSchema(runServiceMethods.ByName("CancelRun")),
577 connect.WithHandlerOptions(opts...),
578 )
579 runServiceRerunRunHandler := connect.NewUnaryHandler(
580 RunServiceRerunRunProcedure,
581 svc.RerunRun,
582 connect.WithSchema(runServiceMethods.ByName("RerunRun")),
583 connect.WithHandlerOptions(opts...),
584 )
585 runServiceDispatchWorkflowHandler := connect.NewUnaryHandler(
586 RunServiceDispatchWorkflowProcedure,
587 svc.DispatchWorkflow,
588 connect.WithSchema(runServiceMethods.ByName("DispatchWorkflow")),
589 connect.WithHandlerOptions(opts...),
590 )
591 runServiceListWorkflowsHandler := connect.NewUnaryHandler(
592 RunServiceListWorkflowsProcedure,
593 svc.ListWorkflows,
594 connect.WithSchema(runServiceMethods.ByName("ListWorkflows")),
595 connect.WithHandlerOptions(opts...),
596 )
597 runServiceDisableWorkflowHandler := connect.NewUnaryHandler(
598 RunServiceDisableWorkflowProcedure,
599 svc.DisableWorkflow,
600 connect.WithSchema(runServiceMethods.ByName("DisableWorkflow")),
601 connect.WithHandlerOptions(opts...),
602 )
603 runServiceEnableWorkflowHandler := connect.NewUnaryHandler(
604 RunServiceEnableWorkflowProcedure,
605 svc.EnableWorkflow,
606 connect.WithSchema(runServiceMethods.ByName("EnableWorkflow")),
607 connect.WithHandlerOptions(opts...),
608 )
609 runServiceListChecksHandler := connect.NewUnaryHandler(
610 RunServiceListChecksProcedure,
611 svc.ListChecks,
612 connect.WithSchema(runServiceMethods.ByName("ListChecks")),
613 connect.WithHandlerOptions(opts...),
614 )
615 runServiceListRunnersHandler := connect.NewUnaryHandler(
616 RunServiceListRunnersProcedure,
617 svc.ListRunners,
618 connect.WithSchema(runServiceMethods.ByName("ListRunners")),
619 connect.WithHandlerOptions(opts...),
620 )
621 runServiceRemoveRunnerHandler := connect.NewUnaryHandler(
622 RunServiceRemoveRunnerProcedure,
623 svc.RemoveRunner,
624 connect.WithSchema(runServiceMethods.ByName("RemoveRunner")),
625 connect.WithHandlerOptions(opts...),
626 )
627 return "/ermite.RunService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
628 switch r.URL.Path {
629 case RunServiceListRunsProcedure:
630 runServiceListRunsHandler.ServeHTTP(w, r)
631 case RunServiceGetRunProcedure:
632 runServiceGetRunHandler.ServeHTTP(w, r)
633 case RunServiceGetJobProcedure:
634 runServiceGetJobHandler.ServeHTTP(w, r)
635 case RunServiceListAnnotationsProcedure:
636 runServiceListAnnotationsHandler.ServeHTTP(w, r)
637 case RunServiceGetStepSummariesProcedure:
638 runServiceGetStepSummariesHandler.ServeHTTP(w, r)
639 case RunServiceGetJobLogProcedure:
640 runServiceGetJobLogHandler.ServeHTTP(w, r)
641 case RunServiceCancelRunProcedure:
642 runServiceCancelRunHandler.ServeHTTP(w, r)
643 case RunServiceRerunRunProcedure:
644 runServiceRerunRunHandler.ServeHTTP(w, r)
645 case RunServiceDispatchWorkflowProcedure:
646 runServiceDispatchWorkflowHandler.ServeHTTP(w, r)
647 case RunServiceListWorkflowsProcedure:
648 runServiceListWorkflowsHandler.ServeHTTP(w, r)
649 case RunServiceDisableWorkflowProcedure:
650 runServiceDisableWorkflowHandler.ServeHTTP(w, r)
651 case RunServiceEnableWorkflowProcedure:
652 runServiceEnableWorkflowHandler.ServeHTTP(w, r)
653 case RunServiceListChecksProcedure:
654 runServiceListChecksHandler.ServeHTTP(w, r)
655 case RunServiceListRunnersProcedure:
656 runServiceListRunnersHandler.ServeHTTP(w, r)
657 case RunServiceRemoveRunnerProcedure:
658 runServiceRemoveRunnerHandler.ServeHTTP(w, r)
659 default:
660 http.NotFound(w, r)
661 }
662 })
663}
664
665// UnimplementedRunServiceHandler returns CodeUnimplemented from all methods.
666type UnimplementedRunServiceHandler struct{}
667
668func (UnimplementedRunServiceHandler) ListRuns(context.Context, *connect.Request[ermite.ListRunsRequest]) (*connect.Response[ermite.ListRunsResponse], error) {
669 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RunService.ListRuns is not implemented"))
670}
671
672func (UnimplementedRunServiceHandler) GetRun(context.Context, *connect.Request[ermite.GetRunRequest]) (*connect.Response[ermite.GetRunResponse], error) {
673 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RunService.GetRun is not implemented"))
674}
675
676func (UnimplementedRunServiceHandler) GetJob(context.Context, *connect.Request[ermite.GetJobRequest]) (*connect.Response[ermite.GetJobResponse], error) {
677 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RunService.GetJob is not implemented"))
678}
679
680func (UnimplementedRunServiceHandler) ListAnnotations(context.Context, *connect.Request[ermite.ListAnnotationsRequest]) (*connect.Response[ermite.ListAnnotationsResponse], error) {
681 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RunService.ListAnnotations is not implemented"))
682}
683
684func (UnimplementedRunServiceHandler) GetStepSummaries(context.Context, *connect.Request[ermite.GetStepSummariesRequest]) (*connect.Response[ermite.GetStepSummariesResponse], error) {
685 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RunService.GetStepSummaries is not implemented"))
686}
687
688func (UnimplementedRunServiceHandler) GetJobLog(context.Context, *connect.Request[ermite.GetJobLogRequest], *connect.ServerStream[ermite.GetJobLogResponse]) error {
689 return connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RunService.GetJobLog is not implemented"))
690}
691
692func (UnimplementedRunServiceHandler) CancelRun(context.Context, *connect.Request[ermite.CancelRunRequest]) (*connect.Response[ermite.CancelRunResponse], error) {
693 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RunService.CancelRun is not implemented"))
694}
695
696func (UnimplementedRunServiceHandler) RerunRun(context.Context, *connect.Request[ermite.RerunRunRequest]) (*connect.Response[ermite.RerunRunResponse], error) {
697 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RunService.RerunRun is not implemented"))
698}
699
700func (UnimplementedRunServiceHandler) DispatchWorkflow(context.Context, *connect.Request[ermite.DispatchWorkflowRequest]) (*connect.Response[ermite.DispatchWorkflowResponse], error) {
701 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RunService.DispatchWorkflow is not implemented"))
702}
703
704func (UnimplementedRunServiceHandler) ListWorkflows(context.Context, *connect.Request[ermite.ListWorkflowsRequest]) (*connect.Response[ermite.ListWorkflowsResponse], error) {
705 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RunService.ListWorkflows is not implemented"))
706}
707
708func (UnimplementedRunServiceHandler) DisableWorkflow(context.Context, *connect.Request[ermite.DisableWorkflowRequest]) (*connect.Response[ermite.DisableWorkflowResponse], error) {
709 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RunService.DisableWorkflow is not implemented"))
710}
711
712func (UnimplementedRunServiceHandler) EnableWorkflow(context.Context, *connect.Request[ermite.EnableWorkflowRequest]) (*connect.Response[ermite.EnableWorkflowResponse], error) {
713 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RunService.EnableWorkflow is not implemented"))
714}
715
716func (UnimplementedRunServiceHandler) ListChecks(context.Context, *connect.Request[ermite.ListChecksRequest]) (*connect.Response[ermite.ListChecksResponse], error) {
717 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RunService.ListChecks is not implemented"))
718}
719
720func (UnimplementedRunServiceHandler) ListRunners(context.Context, *connect.Request[ermite.ListRunnersRequest]) (*connect.Response[ermite.ListRunnersResponse], error) {
721 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RunService.ListRunners is not implemented"))
722}
723
724func (UnimplementedRunServiceHandler) RemoveRunner(context.Context, *connect.Request[ermite.RemoveRunnerRequest]) (*connect.Response[ermite.RemoveRunnerResponse], error) {
725 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RunService.RemoveRunner is not implemented"))
726}