From c161a48a0a5cdea220acc96b9e5df6c0b9c27e54 Mon Sep 17 00:00:00 2001 From: "Bo-Yi.Wu" Date: Fri, 7 Oct 2022 20:59:02 +0800 Subject: [PATCH] chore(register): update proto file. Signed-off-by: Bo-Yi.Wu --- README.md | 11 +++++++++++ config/config.go | 4 ++-- go.mod | 2 +- go.sum | 2 ++ poller/poller.go | 10 +++++----- 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 581ea33..eee5eef 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,14 @@ # act runner 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 +``` diff --git a/config/config.go b/config/config.go index 96881ce..e41e46c 100644 --- a/config/config.go +++ b/config/config.go @@ -32,8 +32,8 @@ type ( Runner struct { Name string `envconfig:"GITEA_RUNNER_NAME"` - URL string `envconfig:"GITEA_URL" required:"true"` - Token string `envconfig:"GITEA_TOKEN" required:"true"` + URL string `envconfig:"GITEA_RUNNER_URL" required:"true"` + Token string `envconfig:"GITEA_RUNNER_TOKEN" required:"true"` Capacity int `envconfig:"GITEA_RUNNER_CAPACITY" default:"1"` Environ map[string]string `envconfig:"GITEA_RUNNER_ENVIRON"` EnvFile string `envconfig:"GITEA_RUNNER_ENV_FILE"` diff --git a/go.mod b/go.mod index 2847917..1ff7331 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module gitea.com/gitea/act_runner go 1.18 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/avast/retry-go/v4 v4.1.0 github.com/bufbuild/connect-go v0.5.0 diff --git a/go.sum b/go.sum index cf4c50a..a687785 100644 --- a/go.sum +++ b/go.sum @@ -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/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-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/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= diff --git a/poller/poller.go b/poller/poller.go index 8e5e480..81e8054 100644 --- a/poller/poller.go +++ b/poller/poller.go @@ -50,11 +50,11 @@ func (p *Poller) Register(ctx context.Context, cfg config.Runner) error { // register new runner. 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, - Token: cfg.Token, + Name: cfg.Name, + Token: cfg.Token, + Url: cfg.URL, + AgentLabels: []string{p.Filter.OS, p.Filter.Arch}, + CustomLabels: p.Filter.Labels, })) if err != nil { log.WithError(err).Error("poller: cannot register new runner")