chore(proto): replace import path.

Signed-off-by: GiteaBot <teabot@gitea.io>
This commit is contained in:
GiteaBot 2022-08-17 14:25:14 +08:00 committed by Jason Song
parent 7d55fd57c9
commit 307c2c63de
6 changed files with 20 additions and 18 deletions

View File

@ -3,7 +3,7 @@ package client
import ( import (
"context" "context"
v1 "gitea.com/gitea/proto/gen/proto/v1" runnerv1 "gitea.com/gitea/proto-go/runner/v1"
) )
// A Client manages communication with the runner. // A Client manages communication with the runner.
@ -12,5 +12,5 @@ type Client interface {
Ping(ctx context.Context, machine string) error Ping(ctx context.Context, machine string) error
// Request requests the next available build stage for execution. // Request requests the next available build stage for execution.
Request(ctx context.Context) (*v1.Stage, error) Request(ctx context.Context) (*runnerv1.Stage, error)
} }

View File

@ -7,8 +7,10 @@ import (
"net/http" "net/http"
"time" "time"
v1 "gitea.com/gitea/proto/gen/proto/v1" pingv1 "gitea.com/gitea/proto-go/ping/v1"
"gitea.com/gitea/proto/gen/proto/v1/v1connect" "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" "github.com/bufbuild/connect-go"
"golang.org/x/net/http2" "golang.org/x/net/http2"
@ -69,12 +71,12 @@ type HTTPClient struct {
// Ping sends a ping message to the server to test connectivity. // Ping sends a ping message to the server to test connectivity.
func (p *HTTPClient) Ping(ctx context.Context, machine string) error { func (p *HTTPClient) Ping(ctx context.Context, machine string) error {
client := v1connect.NewPingServiceClient( client := pingv1connect.NewPingServiceClient(
p.Client, p.Client,
p.Endpoint, p.Endpoint,
p.opts..., p.opts...,
) )
req := connect.NewRequest(&v1.PingRequest{ req := connect.NewRequest(&pingv1.PingRequest{
Data: machine, 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. // Ping sends a ping message to the server to test connectivity.
func (p *HTTPClient) Request(ctx context.Context) (*v1.Stage, error) { func (p *HTTPClient) Request(ctx context.Context) (*runnerv1.Stage, error) {
client := v1connect.NewRunnerServiceClient( client := runnerv1connect.NewRunnerServiceClient(
p.Client, p.Client,
p.Endpoint, p.Endpoint,
p.opts..., p.opts...,
) )
req := connect.NewRequest(&v1.ConnectRequest{}) req := connect.NewRequest(&runnerv1.ConnectRequest{})
req.Header().Set("X-Gitea-Token", p.Secret) req.Header().Set("X-Gitea-Token", p.Secret)

2
go.mod
View File

@ -3,7 +3,7 @@ module gitea.com/gitea/act_runner
go 1.18 go 1.18
require ( 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/bufbuild/connect-go v0.3.0
github.com/docker/docker v20.10.17+incompatible github.com/docker/docker v20.10.17+incompatible
github.com/joho/godotenv v1.4.0 github.com/joho/godotenv v1.4.0

4
go.sum
View File

@ -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= 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 h1:T0wftx4RaYqbTH4t0A7bXGXxemZloCrjReA7xJvIVdY=
gitea.com/gitea/act v0.0.0-20220812010840-c467b06265ee/go.mod h1:G37Vfz4J6kJ5NbcPI5xQUkeWPVkUCP5J+MFkaWU9jNY= 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-go v0.0.0-20220817054638-17fb0016dd41 h1:FIGF6szYd3lBIwvbeedfU5Lc7uG1Xpzi7bkktS6Vdvg=
gitea.com/gitea/proto v0.0.0-20220814042910-32799131d693/go.mod h1:LWD9G0VCMxaDY4I+J3vSqJF5OYNum33pQtRpx43516s= 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/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 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8=
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8=

View File

@ -5,13 +5,13 @@ import (
"errors" "errors"
"time" "time"
v1 "gitea.com/gitea/proto/gen/proto/v1" runnerv1 "gitea.com/gitea/proto-go/runner/v1"
"gitea.com/gitea/act_runner/client" "gitea.com/gitea/act_runner/client"
log "github.com/sirupsen/logrus" 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{ return &Poller{
Client: cli, Client: cli,
Dispatch: dispatch, Dispatch: dispatch,
@ -21,7 +21,7 @@ func New(cli client.Client, dispatch func(context.Context, *v1.Stage) error) *Po
type Poller struct { type Poller struct {
Client client.Client Client client.Client
Dispatch func(context.Context, *v1.Stage) error Dispatch func(context.Context, *runnerv1.Stage) error
routineGroup *routineGroup routineGroup *routineGroup
} }

View File

@ -3,7 +3,7 @@ package runtime
import ( import (
"context" "context"
v1 "gitea.com/gitea/proto/gen/proto/v1" runnerv1 "gitea.com/gitea/proto-go/runner/v1"
"gitea.com/gitea/act_runner/client" "gitea.com/gitea/act_runner/client"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
@ -17,7 +17,7 @@ type Runner struct {
} }
// Run runs the pipeline stage. // 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. l := logrus.
WithField("stage.build_uuid", stage.BuildUuid). WithField("stage.build_uuid", stage.BuildUuid).
WithField("stage.runner_uuid", stage.RunnerUuid) 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) 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. l := logrus.
WithField("stage.build_uuid", stage.BuildUuid). WithField("stage.build_uuid", stage.BuildUuid).
WithField("stage.runner_uuid", stage.RunnerUuid) WithField("stage.runner_uuid", stage.RunnerUuid)