From a511fbf10c2865b055acb5d53fa3d9e6e026e938 Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Wed, 17 Apr 2019 15:22:26 +0200 Subject: [PATCH] runservice: executor: provide architecture information --- internal/services/runservice/executor/executor.go | 11 +++++++++++ internal/services/runservice/types/types.go | 2 ++ 2 files changed, 13 insertions(+) diff --git a/internal/services/runservice/executor/executor.go b/internal/services/runservice/executor/executor.go index e408107..80a4122 100644 --- a/internal/services/runservice/executor/executor.go +++ b/internal/services/runservice/executor/executor.go @@ -27,6 +27,7 @@ import ( "os" "os/exec" "path/filepath" + "runtime" "strings" "sync" "time" @@ -650,9 +651,19 @@ func (e *Executor) archivePath(taskID string, stepID int) string { } func (e *Executor) sendExecutorStatus(ctx context.Context) error { + labels := e.c.Labels + if labels == nil { + labels = make(map[string]string) + } + + // Add special labels (and override config provided ones) + arch := runtime.GOARCH + labels["arch"] = arch + executor := &types.Executor{ ID: e.id, ListenURL: e.listenURL, + Labels: labels, } log.Debugf("send executor status: %s", util.Dump(executor)) diff --git a/internal/services/runservice/types/types.go b/internal/services/runservice/types/types.go index a6d17f5..d9af754 100644 --- a/internal/services/runservice/types/types.go +++ b/internal/services/runservice/types/types.go @@ -654,6 +654,8 @@ type Executor struct { ID string `json:"id,omitempty"` ListenURL string `json:"listenURL,omitempty"` + Labels map[string]string `json:"labels,omitempty"` + // internal values not saved Revision int64 `json:"-"` }