Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [TKC-3010] Change Execution config model #6084

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions api/v1/testkube.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8244,7 +8244,7 @@ components:
description: running context for the test workflow execution (Pro edition only)
$ref: "#/components/schemas/TestWorkflowRunningContext"
config:
$ref: "#/components/schemas/TestWorkflowConfigValue"
$ref: "#/components/schemas/TestWorkflowExecutionConfig"
required:
- id
- name
Expand Down Expand Up @@ -8283,7 +8283,7 @@ components:
description: running context for the test workflow execution (Pro edition only)
$ref: "#/components/schemas/TestWorkflowRunningContext"
config:
$ref: "#/components/schemas/TestWorkflowConfigValue"
$ref: "#/components/schemas/TestWorkflowExecutionConfig"
required:
- id
- name
Expand Down Expand Up @@ -9518,6 +9518,24 @@ components:
items:
$ref: "#/components/schemas/VolumeMount"

TestWorkflowExecutionConfig:
type: object
description: map of configuration values used in the test workflow execution
additionalProperties:
$ref: "#/components/schemas/TestWorkflowExecutionConfigValue"

TestWorkflowExecutionConfigValue:
type: object
description: configuration values used in the test workflow execution
properties:
value:
type: string
description: configuration value
defaultValue:
type: string
description: configuration value default


TestWorkflowConfigValue:
type: object
description: configuration values to pass to the template
Expand Down
8 changes: 4 additions & 4 deletions pkg/api/v1/testkube/model_test_workflow_execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ type TestWorkflowExecution struct {
// test workflow execution name started the test workflow execution
TestWorkflowExecutionName string `json:"testWorkflowExecutionName,omitempty"`
// whether webhooks on the execution of this test workflow are disabled
DisableWebhooks bool `json:"disableWebhooks,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
RunningContext *TestWorkflowRunningContext `json:"runningContext,omitempty"`
Config map[string]string `json:"config,omitempty"`
DisableWebhooks bool `json:"disableWebhooks,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
RunningContext *TestWorkflowRunningContext `json:"runningContext,omitempty"`
Config map[string]TestWorkflowExecutionConfigValue `json:"config,omitempty"`
}
18 changes: 18 additions & 0 deletions pkg/api/v1/testkube/model_test_workflow_execution_config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Testkube API
*
* Testkube provides a Kubernetes-native framework for test definition, execution and results
*
* API version: 1.0.0
* Contact: testkube@kubeshop.io
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package testkube

// configuration values used in the test workflow execution
type TestWorkflowExecutionConfig struct {
// configuration value
Value string `json:"value,omitempty"`
// configuration value
DefaultValue string `json:"defaultValue,omitempty"`
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Testkube API
*
* Testkube provides a Kubernetes-native framework for test definition, execution and results
*
* API version: 1.0.0
* Contact: testkube@kubeshop.io
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package testkube

// configuration values used in the test workflow execution
type TestWorkflowExecutionConfigValue struct {
// configuration value
Value string `json:"value,omitempty"`
// configuration value default
DefaultValue string `json:"defaultValue,omitempty"`
}
12 changes: 6 additions & 6 deletions pkg/api/v1/testkube/model_test_workflow_execution_summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ type TestWorkflowExecutionSummary struct {
// when the execution has been scheduled to run
ScheduledAt time.Time `json:"scheduledAt,omitempty"`
// when the execution result's status has changed last time (queued, passed, failed)
StatusAt time.Time `json:"statusAt,omitempty"`
Result *TestWorkflowResultSummary `json:"result,omitempty"`
Workflow *TestWorkflowSummary `json:"workflow"`
Tags map[string]string `json:"tags,omitempty"`
RunningContext *TestWorkflowRunningContext `json:"runningContext,omitempty"`
Config map[string]string `json:"config,omitempty"`
StatusAt time.Time `json:"statusAt,omitempty"`
Result *TestWorkflowResultSummary `json:"result,omitempty"`
Workflow *TestWorkflowSummary `json:"workflow"`
Tags map[string]string `json:"tags,omitempty"`
RunningContext *TestWorkflowRunningContext `json:"runningContext,omitempty"`
Config map[string]TestWorkflowExecutionConfigValue `json:"config,omitempty"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ type TestWorkflowStepExecuteTestWorkflowRef struct {
ExecutionName string `json:"executionName,omitempty"`
Tarball map[string]TestWorkflowTarballRequest `json:"tarball,omitempty"`
Config map[string]string `json:"config,omitempty"`
Selector *LabelSelector `json:"selector,omitempty"`
Count *BoxedString `json:"count,omitempty"`
MaxCount *BoxedString `json:"maxCount,omitempty"`
// matrix of parameters to spawn instances
Matrix map[string]interface{} `json:"matrix,omitempty"`
// parameters that should be distributed across sharded instances
Shards map[string]interface{} `json:"shards,omitempty"`
Selector *LabelSelector `json:"selector,omitempty"`
Shards map[string]interface{} `json:"shards,omitempty"`
}
11 changes: 5 additions & 6 deletions pkg/testworkflows/testworkflowexecutor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,20 +474,19 @@ func (e *executor) initialize(ctx context.Context, workflow *testworkflowsv1.Tes
if testworkflows.CountMapBytes(request.Config) < ConfigSizeLimit {
storeConfig := true
schema := workflow.Spec.Config
config := make(map[string]string)
for k, v := range schema {
config := make(map[string]testkube.TestWorkflowExecutionConfigValue)
for _, 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
config[k] = testkube.TestWorkflowExecutionConfigValue{
Value: v,
}
}
}

Expand Down
Loading