mirror of https://code.forgejo.org/forgejo/runner
feat(register): add labels to local runner file
parent
64c9856ba7
commit
86f66eaa45
|
@ -295,6 +295,7 @@ func doRegister(cfg *config.Config, inputs *registerInputs) error {
|
||||||
)
|
)
|
||||||
cfg.Runner.Name = inputs.RunnerName
|
cfg.Runner.Name = inputs.RunnerName
|
||||||
cfg.Runner.Token = inputs.Token
|
cfg.Runner.Token = inputs.Token
|
||||||
|
cfg.Runner.Labels = inputs.CustomLabels
|
||||||
_, err := register.Register(ctx, cfg.Runner)
|
_, err := register.Register(ctx, cfg.Runner)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithError(err).Errorln("Cannot register the runner")
|
log.WithError(err).Errorln("Cannot register the runner")
|
||||||
|
|
|
@ -7,9 +7,10 @@ const (
|
||||||
|
|
||||||
// Runner struct
|
// Runner struct
|
||||||
type Runner struct {
|
type Runner struct {
|
||||||
ID int64 `json:"id"`
|
ID int64 `json:"id"`
|
||||||
UUID string `json:"uuid"`
|
UUID string `json:"uuid"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Token string `json:"token"`
|
Token string `json:"token"`
|
||||||
Address string `json:"address"`
|
Address string `json:"address"`
|
||||||
|
Labels []string `json:"labels"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@ func (p *Register) Register(ctx context.Context, cfg config.Runner) (*core.Runne
|
||||||
Name: resp.Msg.Runner.Name,
|
Name: resp.Msg.Runner.Name,
|
||||||
Token: resp.Msg.Runner.Token,
|
Token: resp.Msg.Runner.Token,
|
||||||
Address: p.Client.Address(),
|
Address: p.Client.Address(),
|
||||||
|
Labels: cfg.Labels,
|
||||||
}
|
}
|
||||||
|
|
||||||
file, err := json.MarshalIndent(data, "", " ")
|
file, err := json.MarshalIndent(data, "", " ")
|
||||||
|
|
Loading…
Reference in New Issue