add label change post runner creation
This commit is contained in:
parent
f1181cc62a
commit
7abbd84a8a
2 changed files with 5 additions and 1 deletions
|
@ -64,7 +64,6 @@ func runDaemon(ctx context.Context, configFile *string) func(cmd *cobra.Command,
|
||||||
if len(ls) == 0 {
|
if len(ls) == 0 {
|
||||||
log.Warn("no labels configured, runner may not be able to pick up jobs")
|
log.Warn("no labels configured, runner may not be able to pick up jobs")
|
||||||
}
|
}
|
||||||
reg.Labels = ls.ToStrings()
|
|
||||||
|
|
||||||
if ls.RequireDocker() {
|
if ls.RequireDocker() {
|
||||||
dockerSocketPath, err := getDockerSocketPath(cfg.Container.DockerHost)
|
dockerSocketPath, err := getDockerSocketPath(cfg.Container.DockerHost)
|
||||||
|
@ -112,6 +111,7 @@ func runDaemon(ctx context.Context, configFile *string) func(cmd *cobra.Command,
|
||||||
log.Infof("runner: %s, with version: %s, with labels: %v, declared successfully",
|
log.Infof("runner: %s, with version: %s, with labels: %v, declared successfully",
|
||||||
resp.Msg.Runner.Name, resp.Msg.Runner.Version, resp.Msg.Runner.Labels)
|
resp.Msg.Runner.Name, resp.Msg.Runner.Version, resp.Msg.Runner.Labels)
|
||||||
// if declared successfully, override the labels in the.runner file with valid labels in the config file (if specified)
|
// if declared successfully, override the labels in the.runner file with valid labels in the config file (if specified)
|
||||||
|
runner.Update(ctx, ls)
|
||||||
reg.Labels = ls.ToStrings()
|
reg.Labels = ls.ToStrings()
|
||||||
if err := config.SaveRegistration(cfg.Runner.File, reg); err != nil {
|
if err := config.SaveRegistration(cfg.Runner.File, reg); err != nil {
|
||||||
return fmt.Errorf("failed to save runner config: %w", err)
|
return fmt.Errorf("failed to save runner config: %w", err)
|
||||||
|
|
|
@ -242,3 +242,7 @@ func (r *Runner) Declare(ctx context.Context, labels []string) (*connect.Respons
|
||||||
Labels: labels,
|
Labels: labels,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *Runner) Update(ctx context.Context, labels labels.Labels) {
|
||||||
|
r.labels = labels
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue