From 7abbd84a8a3dbfe64332a9def3a7c7ad9cedda4e Mon Sep 17 00:00:00 2001 From: TheFox0x7 Date: Tue, 9 Apr 2024 20:53:12 +0200 Subject: [PATCH] add label change post runner creation --- internal/app/cmd/daemon.go | 2 +- internal/app/run/runner.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/app/cmd/daemon.go b/internal/app/cmd/daemon.go index 8de19f4..8e47bf6 100644 --- a/internal/app/cmd/daemon.go +++ b/internal/app/cmd/daemon.go @@ -64,7 +64,6 @@ func runDaemon(ctx context.Context, configFile *string) func(cmd *cobra.Command, if len(ls) == 0 { log.Warn("no labels configured, runner may not be able to pick up jobs") } - reg.Labels = ls.ToStrings() if ls.RequireDocker() { 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", 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) + runner.Update(ctx, ls) reg.Labels = ls.ToStrings() if err := config.SaveRegistration(cfg.Runner.File, reg); err != nil { return fmt.Errorf("failed to save runner config: %w", err) diff --git a/internal/app/run/runner.go b/internal/app/run/runner.go index ee12165..ff54fa7 100644 --- a/internal/app/run/runner.go +++ b/internal/app/run/runner.go @@ -242,3 +242,7 @@ func (r *Runner) Declare(ctx context.Context, labels []string) (*connect.Respons Labels: labels, })) } + +func (r *Runner) Update(ctx context.Context, labels labels.Labels) { + r.labels = labels +}