mirror of
https://gitea.com/gitea/act_runner.git
synced 2024-12-27 03:18:22 +01:00
chore(proto): replace import path.
Signed-off-by: GiteaBot <teabot@gitea.io>
This commit is contained in:
parent
7d55fd57c9
commit
307c2c63de
@ -3,7 +3,7 @@ package client
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "gitea.com/gitea/proto/gen/proto/v1"
|
||||
runnerv1 "gitea.com/gitea/proto-go/runner/v1"
|
||||
)
|
||||
|
||||
// A Client manages communication with the runner.
|
||||
@ -12,5 +12,5 @@ type Client interface {
|
||||
Ping(ctx context.Context, machine string) error
|
||||
|
||||
// Request requests the next available build stage for execution.
|
||||
Request(ctx context.Context) (*v1.Stage, error)
|
||||
Request(ctx context.Context) (*runnerv1.Stage, error)
|
||||
}
|
||||
|
@ -7,8 +7,10 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
v1 "gitea.com/gitea/proto/gen/proto/v1"
|
||||
"gitea.com/gitea/proto/gen/proto/v1/v1connect"
|
||||
pingv1 "gitea.com/gitea/proto-go/ping/v1"
|
||||
"gitea.com/gitea/proto-go/ping/v1/pingv1connect"
|
||||
runnerv1 "gitea.com/gitea/proto-go/runner/v1"
|
||||
"gitea.com/gitea/proto-go/runner/v1/runnerv1connect"
|
||||
|
||||
"github.com/bufbuild/connect-go"
|
||||
"golang.org/x/net/http2"
|
||||
@ -69,12 +71,12 @@ type HTTPClient struct {
|
||||
|
||||
// Ping sends a ping message to the server to test connectivity.
|
||||
func (p *HTTPClient) Ping(ctx context.Context, machine string) error {
|
||||
client := v1connect.NewPingServiceClient(
|
||||
client := pingv1connect.NewPingServiceClient(
|
||||
p.Client,
|
||||
p.Endpoint,
|
||||
p.opts...,
|
||||
)
|
||||
req := connect.NewRequest(&v1.PingRequest{
|
||||
req := connect.NewRequest(&pingv1.PingRequest{
|
||||
Data: machine,
|
||||
})
|
||||
|
||||
@ -85,13 +87,13 @@ func (p *HTTPClient) Ping(ctx context.Context, machine string) error {
|
||||
}
|
||||
|
||||
// Ping sends a ping message to the server to test connectivity.
|
||||
func (p *HTTPClient) Request(ctx context.Context) (*v1.Stage, error) {
|
||||
client := v1connect.NewRunnerServiceClient(
|
||||
func (p *HTTPClient) Request(ctx context.Context) (*runnerv1.Stage, error) {
|
||||
client := runnerv1connect.NewRunnerServiceClient(
|
||||
p.Client,
|
||||
p.Endpoint,
|
||||
p.opts...,
|
||||
)
|
||||
req := connect.NewRequest(&v1.ConnectRequest{})
|
||||
req := connect.NewRequest(&runnerv1.ConnectRequest{})
|
||||
|
||||
req.Header().Set("X-Gitea-Token", p.Secret)
|
||||
|
||||
|
2
go.mod
2
go.mod
@ -3,7 +3,7 @@ module gitea.com/gitea/act_runner
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
gitea.com/gitea/proto v0.0.0-20220814042910-32799131d693
|
||||
gitea.com/gitea/proto-go v0.0.0-20220817054638-17fb0016dd41
|
||||
github.com/bufbuild/connect-go v0.3.0
|
||||
github.com/docker/docker v20.10.17+incompatible
|
||||
github.com/joho/godotenv v1.4.0
|
||||
|
4
go.sum
4
go.sum
@ -25,8 +25,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
gitea.com/gitea/act v0.0.0-20220812010840-c467b06265ee h1:T0wftx4RaYqbTH4t0A7bXGXxemZloCrjReA7xJvIVdY=
|
||||
gitea.com/gitea/act v0.0.0-20220812010840-c467b06265ee/go.mod h1:G37Vfz4J6kJ5NbcPI5xQUkeWPVkUCP5J+MFkaWU9jNY=
|
||||
gitea.com/gitea/proto v0.0.0-20220814042910-32799131d693 h1:innZDNfMfvOBnvnfuFqCpk2XesFUKyaeFiEbNSsaxsA=
|
||||
gitea.com/gitea/proto v0.0.0-20220814042910-32799131d693/go.mod h1:LWD9G0VCMxaDY4I+J3vSqJF5OYNum33pQtRpx43516s=
|
||||
gitea.com/gitea/proto-go v0.0.0-20220817054638-17fb0016dd41 h1:FIGF6szYd3lBIwvbeedfU5Lc7uG1Xpzi7bkktS6Vdvg=
|
||||
gitea.com/gitea/proto-go v0.0.0-20220817054638-17fb0016dd41/go.mod h1:hD8YwSHusjwjEEgubW6XFvnZuNhMZTHz6lwjfltEt/Y=
|
||||
github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
|
||||
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8=
|
||||
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8=
|
||||
|
@ -5,13 +5,13 @@ import (
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
v1 "gitea.com/gitea/proto/gen/proto/v1"
|
||||
runnerv1 "gitea.com/gitea/proto-go/runner/v1"
|
||||
"gitea.com/gitea/act_runner/client"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func New(cli client.Client, dispatch func(context.Context, *v1.Stage) error) *Poller {
|
||||
func New(cli client.Client, dispatch func(context.Context, *runnerv1.Stage) error) *Poller {
|
||||
return &Poller{
|
||||
Client: cli,
|
||||
Dispatch: dispatch,
|
||||
@ -21,7 +21,7 @@ func New(cli client.Client, dispatch func(context.Context, *v1.Stage) error) *Po
|
||||
|
||||
type Poller struct {
|
||||
Client client.Client
|
||||
Dispatch func(context.Context, *v1.Stage) error
|
||||
Dispatch func(context.Context, *runnerv1.Stage) error
|
||||
|
||||
routineGroup *routineGroup
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package runtime
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "gitea.com/gitea/proto/gen/proto/v1"
|
||||
runnerv1 "gitea.com/gitea/proto-go/runner/v1"
|
||||
"gitea.com/gitea/act_runner/client"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
@ -17,7 +17,7 @@ type Runner struct {
|
||||
}
|
||||
|
||||
// Run runs the pipeline stage.
|
||||
func (s *Runner) Run(ctx context.Context, stage *v1.Stage) error {
|
||||
func (s *Runner) Run(ctx context.Context, stage *runnerv1.Stage) error {
|
||||
l := logrus.
|
||||
WithField("stage.build_uuid", stage.BuildUuid).
|
||||
WithField("stage.runner_uuid", stage.RunnerUuid)
|
||||
@ -28,7 +28,7 @@ func (s *Runner) Run(ctx context.Context, stage *v1.Stage) error {
|
||||
return s.run(ctx, stage)
|
||||
}
|
||||
|
||||
func (s *Runner) run(ctx context.Context, stage *v1.Stage) error {
|
||||
func (s *Runner) run(ctx context.Context, stage *runnerv1.Stage) error {
|
||||
l := logrus.
|
||||
WithField("stage.build_uuid", stage.BuildUuid).
|
||||
WithField("stage.runner_uuid", stage.RunnerUuid)
|
||||
|
Loading…
Reference in New Issue
Block a user