From e56e548b77c580fef4ead3a28e9551c2df83946a Mon Sep 17 00:00:00 2001 From: Vladislav Sukhin Date: Mon, 9 Dec 2024 20:06:48 +0300 Subject: [PATCH] fix: send org and env ids Signed-off-by: Vladislav Sukhin --- pkg/agent/agent.go | 4 ++-- pkg/agent/testworkflows.go | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/agent/agent.go b/pkg/agent/agent.go index 02acc8c0ee..07178e4b5e 100644 --- a/pkg/agent/agent.go +++ b/pkg/agent/agent.go @@ -26,8 +26,8 @@ import ( const ( clusterIDMeta = "cluster-id" cloudMigrateMeta = "migrate" - orgIdMeta = "environment-id" - envIdMeta = "organization-id" + orgIdMeta = "organization-id" + envIdMeta = "environment-id" healthcheckCommand = "healthcheck" dockerImageVersionMeta = "docker-image-version" ) diff --git a/pkg/agent/testworkflows.go b/pkg/agent/testworkflows.go index 18c7da3e1b..8909e608ef 100644 --- a/pkg/agent/testworkflows.go +++ b/pkg/agent/testworkflows.go @@ -12,6 +12,7 @@ import ( "golang.org/x/sync/errgroup" "google.golang.org/grpc" "google.golang.org/grpc/encoding/gzip" + "google.golang.org/grpc/metadata" "github.com/kubeshop/testkube/internal/common" agentclient "github.com/kubeshop/testkube/pkg/agent/client" @@ -86,6 +87,8 @@ func (ag *Agent) runTestWorkflowNotificationsLoop(ctx context.Context) error { func (ag *Agent) runTestWorkflowServiceNotificationsLoop(ctx context.Context) error { ctx = agentclient.AddAPIKeyMeta(ctx, ag.apiKey) + ctx = metadata.AppendToOutgoingContext(ctx, envIdMeta, ag.proContext.EnvID) + ctx = metadata.AppendToOutgoingContext(ctx, orgIdMeta, ag.proContext.OrgID) ag.logger.Infow("initiating workflow service notifications streaming connection with Cloud API") // creates a new Stream from the client side. ctx is used for the lifetime of the stream. @@ -131,6 +134,8 @@ func (ag *Agent) runTestWorkflowServiceNotificationsLoop(ctx context.Context) er func (ag *Agent) runTestWorkflowParallelStepNotificationsLoop(ctx context.Context) error { ctx = agentclient.AddAPIKeyMeta(ctx, ag.apiKey) + ctx = metadata.AppendToOutgoingContext(ctx, envIdMeta, ag.proContext.EnvID) + ctx = metadata.AppendToOutgoingContext(ctx, orgIdMeta, ag.proContext.OrgID) ag.logger.Infow("initiating workflow parallel step notifications streaming connection with Cloud API") // creates a new Stream from the client side. ctx is used for the lifetime of the stream.