From 3a9814b712180bc3a873f439d19450f5010443cb Mon Sep 17 00:00:00 2001
From: Povilas Versockas
Date: Mon, 16 Dec 2024 16:20:07 +0200
Subject: [PATCH] feat: [TKC-2995] Store default config variables (#6081)
---
.../testworkflowexecutor/executor.go | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/pkg/testworkflows/testworkflowexecutor/executor.go b/pkg/testworkflows/testworkflowexecutor/executor.go
index 9a91acd528..e0bb794af5 100644
--- a/pkg/testworkflows/testworkflowexecutor/executor.go
+++ b/pkg/testworkflows/testworkflowexecutor/executor.go
@@ -474,15 +474,25 @@ func (e *executor) initialize(ctx context.Context, workflow *testworkflowsv1.Tes
if testworkflows.CountMapBytes(request.Config) < ConfigSizeLimit {
storeConfig := true
schema := workflow.Spec.Config
-
- for k, _ := range request.Config {
- if s, ok := schema[k]; ok && s.Sensitive {
+ config := make(map[string]string)
+ for k, v := range schema {
+ if v.Sensitive {
storeConfig = false
+ break
+ }
+ if v.Default != nil {
+ config[k] = v.Default.String()
+ }
+ }
+
+ for k, v := range request.Config {
+ if _, ok := schema[k]; ok {
+ config[k] = v
}
}
if storeConfig {
- execution.Config = request.Config
+ execution.Config = config
}
}