mirror of
https://gitea.com/gitea/act_runner.git
synced 2025-06-13 01:57:13 +02:00
chore(gRPC): add update and update step for client
Signed-off-by: Bo-Yi.Wu <appleboy.tw@gmail.com>
This commit is contained in:
@ -24,4 +24,10 @@ type Client interface {
|
||||
|
||||
// Request requests the next available build stage for execution.
|
||||
Request(ctx context.Context, args *runnerv1.RequestRequest) (*runnerv1.Stage, error)
|
||||
|
||||
// Update updates the build stage.
|
||||
Update(ctxt context.Context, args *runnerv1.UpdateRequest) error
|
||||
|
||||
// UpdateStep updates the build step.
|
||||
UpdateStep(ctx context.Context, args *runnerv1.UpdateStepRequest) error
|
||||
}
|
||||
|
@ -123,3 +123,33 @@ func (p *HTTPClient) Request(ctx context.Context, arg *runnerv1.RequestRequest)
|
||||
|
||||
return res.Msg.Stage, err
|
||||
}
|
||||
|
||||
// Update updates the build stage.
|
||||
func (p *HTTPClient) Update(ctx context.Context, arg *runnerv1.UpdateRequest) error {
|
||||
client := runnerv1connect.NewRunnerServiceClient(
|
||||
p.Client,
|
||||
p.Endpoint,
|
||||
p.opts...,
|
||||
)
|
||||
req := connect.NewRequest(arg)
|
||||
req.Header().Set("X-Runner-Token", p.Secret)
|
||||
|
||||
_, err := client.Update(ctx, req)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// UpdateStep updates the build step.
|
||||
func (p *HTTPClient) UpdateStep(ctx context.Context, arg *runnerv1.UpdateStepRequest) error {
|
||||
client := runnerv1connect.NewRunnerServiceClient(
|
||||
p.Client,
|
||||
p.Endpoint,
|
||||
p.opts...,
|
||||
)
|
||||
req := connect.NewRequest(arg)
|
||||
req.Header().Set("X-Runner-Token", p.Secret)
|
||||
|
||||
_, err := client.UpdateStep(ctx, req)
|
||||
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user