chore(register): update proto file.

Signed-off-by: Bo-Yi.Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi.Wu 2022-10-07 20:59:02 +08:00 committed by Jason Song
parent 3a1503138b
commit c161a48a0a
5 changed files with 21 additions and 8 deletions

View File

@ -1,3 +1,14 @@
# act runner # act runner
Act runner is a runner for Forges supports Github Actions protocol. Act runner is a runner for Forges supports Github Actions protocol.
## Rigister
create a new file as name `.env`
```sh
GITEA_RUNNER_NAME=foobar
GITEA_RUNNER_URL=localhost:3001/foo/bar
GITEA_RUNNER_TOKEN=1234567890abcde
GITEA_RUNNER_LABELS=foo,bar
```

View File

@ -32,8 +32,8 @@ type (
Runner struct { Runner struct {
Name string `envconfig:"GITEA_RUNNER_NAME"` Name string `envconfig:"GITEA_RUNNER_NAME"`
URL string `envconfig:"GITEA_URL" required:"true"` URL string `envconfig:"GITEA_RUNNER_URL" required:"true"`
Token string `envconfig:"GITEA_TOKEN" required:"true"` Token string `envconfig:"GITEA_RUNNER_TOKEN" required:"true"`
Capacity int `envconfig:"GITEA_RUNNER_CAPACITY" default:"1"` Capacity int `envconfig:"GITEA_RUNNER_CAPACITY" default:"1"`
Environ map[string]string `envconfig:"GITEA_RUNNER_ENVIRON"` Environ map[string]string `envconfig:"GITEA_RUNNER_ENVIRON"`
EnvFile string `envconfig:"GITEA_RUNNER_ENV_FILE"` EnvFile string `envconfig:"GITEA_RUNNER_ENV_FILE"`

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-go v0.0.0-20221002020351-750a3b99a850 gitea.com/gitea/proto-go v0.0.0-20221007122649-939e445f4abb
github.com/appleboy/com v0.1.6 github.com/appleboy/com v0.1.6
github.com/avast/retry-go/v4 v4.1.0 github.com/avast/retry-go/v4 v4.1.0
github.com/bufbuild/connect-go v0.5.0 github.com/bufbuild/connect-go v0.5.0

2
go.sum
View File

@ -27,6 +27,8 @@ gitea.com/gitea/act v0.0.0-20220922135643-52a5bba9e7fa h1:HHqlvfIvqFlny3sgJgAM1B
gitea.com/gitea/act v0.0.0-20220922135643-52a5bba9e7fa/go.mod h1:9W/Nz16tjfnWp7O5DUo3EjZBnZFBI/5rlWstX4o7+hU= gitea.com/gitea/act v0.0.0-20220922135643-52a5bba9e7fa/go.mod h1:9W/Nz16tjfnWp7O5DUo3EjZBnZFBI/5rlWstX4o7+hU=
gitea.com/gitea/proto-go v0.0.0-20221002020351-750a3b99a850 h1:BDnr9A52zCPb5BH64yTm8cIfhhjTvql0u6QvWjJViGo= gitea.com/gitea/proto-go v0.0.0-20221002020351-750a3b99a850 h1:BDnr9A52zCPb5BH64yTm8cIfhhjTvql0u6QvWjJViGo=
gitea.com/gitea/proto-go v0.0.0-20221002020351-750a3b99a850/go.mod h1:hD8YwSHusjwjEEgubW6XFvnZuNhMZTHz6lwjfltEt/Y= gitea.com/gitea/proto-go v0.0.0-20221002020351-750a3b99a850/go.mod h1:hD8YwSHusjwjEEgubW6XFvnZuNhMZTHz6lwjfltEt/Y=
gitea.com/gitea/proto-go v0.0.0-20221007122649-939e445f4abb h1:Wi8BEd1hStpvZW0PUP6W74mQRMJOJ/EhPoqWW5dcHQc=
gitea.com/gitea/proto-go v0.0.0-20221007122649-939e445f4abb/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

@ -50,11 +50,11 @@ func (p *Poller) Register(ctx context.Context, cfg config.Runner) error {
// register new runner. // register new runner.
resp, err := p.Client.Register(ctx, connect.NewRequest(&runnerv1.RegisterRequest{ resp, err := p.Client.Register(ctx, connect.NewRequest(&runnerv1.RegisterRequest{
Os: p.Filter.OS,
Arch: p.Filter.Arch,
Labels: p.Filter.Labels,
Name: cfg.Name, Name: cfg.Name,
Token: cfg.Token, Token: cfg.Token,
Url: cfg.URL,
AgentLabels: []string{p.Filter.OS, p.Filter.Arch},
CustomLabels: p.Filter.Labels,
})) }))
if err != nil { if err != nil {
log.WithError(err).Error("poller: cannot register new runner") log.WithError(err).Error("poller: cannot register new runner")