From 75c79bd9393f9e8b2d146c6e112dd35a1b372de2 Mon Sep 17 00:00:00 2001 From: Vladislav Sukhin Date: Thu, 11 Jul 2024 15:41:44 +0300 Subject: [PATCH] feat: remove test workflow notifications Signed-off-by: Vladislav Sukhin --- api/v1/testkube.yaml | 23 +++--------- .../commands/testworkflows/create.go | 7 ---- docs/docs/cli/testkube.md | 2 +- docs/docs/cli/testkube_agent.md | 1 - docs/docs/cli/testkube_create_testworkflow.md | 9 +++-- docs/docs/cli/testkube_create_webhook.md | 1 + docs/docs/cli/testkube_debug.md | 11 +++--- docs/docs/cli/testkube_debug_agent.md | 35 +++++++++++++++++++ docs/docs/cli/testkube_debug_controlplane.md | 11 +++--- docs/docs/cli/testkube_debug_oss.md | 30 ++++++++++++++++ docs/docs/cli/testkube_update_webhook.md | 1 + go.mod | 2 +- go.sum | 4 +-- .../model_test_suite_execution_request.go | 2 +- ...del_test_suite_execution_update_request.go | 2 +- ...model_test_suite_step_execution_request.go | 2 +- .../testkube/model_test_workflow_execution.go | 2 +- .../model_test_workflow_execution_cr.go | 2 -- .../model_test_workflow_execution_request.go | 2 +- ...odel_test_workflow_notifications_config.go | 15 -------- .../v1/testkube/model_test_workflow_spec.go | 23 ++++++------ .../model_test_workflow_step_parallel.go | 31 ++++++++-------- pkg/mapper/testworkflows/kube_openapi.go | 29 ++++++--------- pkg/mapper/testworkflows/openapi_kube.go | 17 +++------ .../testworkflowexecutor/executor.go | 7 +--- 25 files changed, 136 insertions(+), 135 deletions(-) create mode 100644 docs/docs/cli/testkube_debug_agent.md create mode 100644 docs/docs/cli/testkube_debug_oss.md delete mode 100644 pkg/api/v1/testkube/model_test_workflow_notifications_config.go diff --git a/api/v1/testkube.yaml b/api/v1/testkube.yaml index c46d8fa6348..d5074d950ab 100644 --- a/api/v1/testkube.yaml +++ b/api/v1/testkube.yaml @@ -6595,7 +6595,7 @@ components: description: running context for the test execution disableWebhooks: type: boolean - description: whether webhooks on the executions of this step are disabled + description: whether webhooks on the execution of this step are disabled default: false example: - true @@ -6703,7 +6703,7 @@ components: description: test suite execution name started the test suite execution disableWebhooks: type: boolean - description: whether webhooks on the executions of this test suite are disabled + description: whether webhooks on the execution of this test suite are disabled default: false example: - true @@ -7872,7 +7872,7 @@ components: description: test workflow execution name started the test workflow execution disableWebhooks: type: boolean - description: whether webhooks on the executions of this test workflow are disabled + description: whether webhooks on the execution of this test workflow are disabled default: false TestWorkflowWithExecution: @@ -7960,7 +7960,7 @@ components: description: test workflow execution name started the test workflow execution disableWebhooks: type: boolean - description: whether webhooks on the executions of this test workflow are disabled + description: whether webhooks on the execution of this test workflow are disabled default: false example: - true @@ -8500,9 +8500,6 @@ components: type: array items: $ref: "#/components/schemas/TestWorkflowEvent" - notifications: - $ref: "#/components/schemas/TestWorkflowNotificationsConfig" - TestWorkflowTemplateSpec: type: object @@ -9175,14 +9172,6 @@ components: items: $ref: "#/components/schemas/VolumeMount" - TestWorkflowNotificationsConfig: - type: object - properties: - disableWebhooks: - type: boolean - description: disable webhooks for this test workflow - default: false - TestWorkflowStepRun: type: object properties: @@ -9350,10 +9339,6 @@ components: status: $ref: "#/components/schemas/TestWorkflowExecutionStatusCR" description: test workflow execution status - disableWebhooks: - type: boolean - description: disable webhooks for this execution - default: false TestWorkflowExecutionStatusCR: type: object diff --git a/cmd/kubectl-testkube/commands/testworkflows/create.go b/cmd/kubectl-testkube/commands/testworkflows/create.go index 47e0db5c8c0..1ad1d49a737 100644 --- a/cmd/kubectl-testkube/commands/testworkflows/create.go +++ b/cmd/kubectl-testkube/commands/testworkflows/create.go @@ -61,12 +61,6 @@ func NewCreateTestWorkflowCmd() *cobra.Command { client, _, err := common.GetClient(cmd) ui.ExitOnError("getting client", err) - if cmd.Flag("disable-webhooks").Changed { - obj.Spec.Notifications = &testworkflowsv1.NotificationsConfig{ - DisableWebhooks: true, - } - } - workflow, err := client.GetTestWorkflow(obj.Name) if err != nil { if update { @@ -94,7 +88,6 @@ func NewCreateTestWorkflowCmd() *cobra.Command { cmd.Flags().StringVar(&name, "name", "", "test workflow name") cmd.Flags().BoolVar(&update, "update", false, "update, if test workflow already exists") cmd.Flags().StringVarP(&filePath, "file", "f", "", "file path to get the test workflow specification") - cmd.Flags().Bool("disable-webhooks", false, "disable webhooks for this test workflow") return cmd } diff --git a/docs/docs/cli/testkube.md b/docs/docs/cli/testkube.md index 2c52219ccf3..2a6926f608e 100644 --- a/docs/docs/cli/testkube.md +++ b/docs/docs/cli/testkube.md @@ -28,7 +28,7 @@ testkube [flags] * [testkube create](testkube_create.md) - Create resource * [testkube create-ticket](testkube_create-ticket.md) - Create bug ticket * [testkube dashboard](testkube_dashboard.md) - Open Testkube dashboard -* [testkube debug](testkube_debug.md) - Print environment information for debugging +* [testkube debug](testkube_debug.md) - Print debugging info * [testkube delete](testkube_delete.md) - Delete resources * [testkube disable](testkube_disable.md) - Disable feature * [testkube download](testkube_download.md) - Artifacts management commands diff --git a/docs/docs/cli/testkube_agent.md b/docs/docs/cli/testkube_agent.md index c592f851ff3..0727833a389 100644 --- a/docs/docs/cli/testkube_agent.md +++ b/docs/docs/cli/testkube_agent.md @@ -27,5 +27,4 @@ testkube agent [flags] ### SEE ALSO * [testkube](testkube.md) - Testkube entrypoint for kubectl plugin -* [testkube agent debug](testkube_agent_debug.md) - Debug Agent info diff --git a/docs/docs/cli/testkube_create_testworkflow.md b/docs/docs/cli/testkube_create_testworkflow.md index bdd9e7d8d2e..c39b20d642a 100644 --- a/docs/docs/cli/testkube_create_testworkflow.md +++ b/docs/docs/cli/testkube_create_testworkflow.md @@ -9,11 +9,10 @@ testkube create testworkflow [flags] ### Options ``` - --disable-webhooks disable webhooks for this test workflow - -f, --file string file path to get the test workflow specification - -h, --help help for testworkflow - --name string test workflow name - --update update, if test workflow already exists + -f, --file string file path to get the test workflow specification + -h, --help help for testworkflow + --name string test workflow name + --update update, if test workflow already exists ``` ### Options inherited from parent commands diff --git a/docs/docs/cli/testkube_create_webhook.md b/docs/docs/cli/testkube_create_webhook.md index 94c6b85e24d..9162f023c09 100644 --- a/docs/docs/cli/testkube_create_webhook.md +++ b/docs/docs/cli/testkube_create_webhook.md @@ -20,6 +20,7 @@ testkube create webhook [flags] -h, --help help for webhook -l, --label stringToString label key value pair: --label key1=value1 (default []) -n, --name string unique webhook name - mandatory + --on-state-change specify whether webhook should be triggered only on a state change --payload-field string field to use for notification object payload --payload-template string if webhook needs to send a custom notification, then a path to template file should be provided --payload-template-reference string reference to payload template to use for the webhook diff --git a/docs/docs/cli/testkube_debug.md b/docs/docs/cli/testkube_debug.md index 93522827c6d..1e9f9473c9f 100644 --- a/docs/docs/cli/testkube_debug.md +++ b/docs/docs/cli/testkube_debug.md @@ -1,10 +1,6 @@ ## testkube debug -Print environment information for debugging - -``` -testkube debug [flags] -``` +Print debugging info ### Options @@ -27,6 +23,7 @@ testkube debug [flags] ### SEE ALSO * [testkube](testkube.md) - Testkube entrypoint for kubectl plugin -* [testkube debug controlplane](testkube_debug_controlplane.md) - Show debug info -* [testkube debug info](testkube_debug_info.md) - Show debug info +* [testkube debug agent](testkube_debug_agent.md) - Show Agent debug information +* [testkube debug controlplane](testkube_debug_controlplane.md) - Show Control Plane debug information +* [testkube debug oss](testkube_debug_oss.md) - Show OSS installation debug info diff --git a/docs/docs/cli/testkube_debug_agent.md b/docs/docs/cli/testkube_debug_agent.md new file mode 100644 index 00000000000..f1c08ffba9e --- /dev/null +++ b/docs/docs/cli/testkube_debug_agent.md @@ -0,0 +1,35 @@ +## testkube debug agent + +Show Agent debug information + +### Synopsis + +Get all the necessary information to debug an issue in Testkube Agent you can fiter through comma separated list of items to show with additional flag `--show pods,services,ingresses,events,nats,connection,roundtrip` + +``` +testkube debug agent [flags] +``` + +### Options + +``` + -h, --help help for agent + -s, --show []string Comma-separated list of features to show, one of: pods,services,ingresses,events,nats,connection,roundtrip, defaults to all +``` + +### Options inherited from parent commands + +``` + -a, --api-uri string api uri, default value read from config if set (default "http://localhost:8088") + -c, --client string client used for connecting to Testkube API one of proxy|direct|cluster (default "proxy") + --header stringToString headers for direct client key value pair: --header name=value (default []) + --insecure insecure connection for direct client + --namespace string Kubernetes namespace, default value read from config if set (default "testkube") + --oauth-enabled enable oauth + --verbose show additional debug messages +``` + +### SEE ALSO + +* [testkube debug](testkube_debug.md) - Print debugging info + diff --git a/docs/docs/cli/testkube_debug_controlplane.md b/docs/docs/cli/testkube_debug_controlplane.md index d513f4f5dd4..4cd6f43b561 100644 --- a/docs/docs/cli/testkube_debug_controlplane.md +++ b/docs/docs/cli/testkube_debug_controlplane.md @@ -1,10 +1,10 @@ ## testkube debug controlplane -Show debug info +Show Control Plane debug information ### Synopsis -Get all the necessary information to debug an issue in Testkube Control Plane +Get all the necessary information to debug an issue in Testkube Control Plane you can fiter through comma separated list of items to show with additional flag `--show pods,services,ingresses,storageclasses,events,nats,connection,api,nats,mongo,dex,ui,worker` ``` testkube debug controlplane [flags] @@ -13,9 +13,8 @@ testkube debug controlplane [flags] ### Options ``` - --attach-agent-log Attach agent log to the output keep in mind to configure valid agent first in the Testkube CLI - -h, --help help for controlplane - --labels stringToString Labels to filter logs by (default []) + -h, --help help for controlplane + -s, --show []string Comma-separated list of features to show, one of: pods,services,ingresses,storageclasses,events,nats,connection,api,nats,mongo,dex,ui,worker, defaults to all ``` ### Options inherited from parent commands @@ -32,5 +31,5 @@ testkube debug controlplane [flags] ### SEE ALSO -* [testkube debug](testkube_debug.md) - Print environment information for debugging +* [testkube debug](testkube_debug.md) - Print debugging info diff --git a/docs/docs/cli/testkube_debug_oss.md b/docs/docs/cli/testkube_debug_oss.md new file mode 100644 index 00000000000..a80ade10577 --- /dev/null +++ b/docs/docs/cli/testkube_debug_oss.md @@ -0,0 +1,30 @@ +## testkube debug oss + +Show OSS installation debug info + +``` +testkube debug oss [flags] +``` + +### Options + +``` + -h, --help help for oss +``` + +### Options inherited from parent commands + +``` + -a, --api-uri string api uri, default value read from config if set (default "http://localhost:8088") + -c, --client string client used for connecting to Testkube API one of proxy|direct|cluster (default "proxy") + --header stringToString headers for direct client key value pair: --header name=value (default []) + --insecure insecure connection for direct client + --namespace string Kubernetes namespace, default value read from config if set (default "testkube") + --oauth-enabled enable oauth + --verbose show additional debug messages +``` + +### SEE ALSO + +* [testkube debug](testkube_debug.md) - Print debugging info + diff --git a/docs/docs/cli/testkube_update_webhook.md b/docs/docs/cli/testkube_update_webhook.md index f21fe9d5894..ef33811851c 100644 --- a/docs/docs/cli/testkube_update_webhook.md +++ b/docs/docs/cli/testkube_update_webhook.md @@ -20,6 +20,7 @@ testkube update webhook [flags] -h, --help help for webhook -l, --label stringToString label key value pair: --label key1=value1 (default []) -n, --name string unique webhook name - mandatory + --on-state-change specify whether webhook should be triggered only on a state change --payload-field string field to use for notification object payload --payload-template string if webhook needs to send a custom notification, then a path to template file should be provided --payload-template-reference string reference to payload template to use for the webhook diff --git a/go.mod b/go.mod index 18be0b41937..088fdb8e42a 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 github.com/kelseyhightower/envconfig v1.4.0 github.com/kubepug/kubepug v1.7.1 - github.com/kubeshop/testkube-operator v1.15.2-beta1.0.20240625102049-77e0cc1374e9 + github.com/kubeshop/testkube-operator v1.15.2-beta1.0.20240711115642-7c436d1ac0bc github.com/minio/minio-go/v7 v7.0.47 github.com/montanaflynn/stats v0.6.6 github.com/moogar0880/problems v0.1.1 diff --git a/go.sum b/go.sum index c824cf603b9..fd373011f90 100644 --- a/go.sum +++ b/go.sum @@ -358,8 +358,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kubepug/kubepug v1.7.1 h1:LKhfSxS8Y5mXs50v+3Lpyec+cogErDLcV7CMUuiaisw= github.com/kubepug/kubepug v1.7.1/go.mod h1:lv+HxD0oTFL7ZWjj0u6HKhMbbTIId3eG7aWIW0gyF8g= -github.com/kubeshop/testkube-operator v1.15.2-beta1.0.20240625102049-77e0cc1374e9 h1:zqGRFwBshCRZ+FdHl2Ty5E6NrwfzNUpuDL+BwKe2L7M= -github.com/kubeshop/testkube-operator v1.15.2-beta1.0.20240625102049-77e0cc1374e9/go.mod h1:P47tw1nKQFufdsZndyq2HG2MSa0zK/lU0XpRfZtEmIk= +github.com/kubeshop/testkube-operator v1.15.2-beta1.0.20240711115642-7c436d1ac0bc h1:cDdttvG3Z6x8512z4FtdEQjOFOqjZUQs7X3XfrAt+a4= +github.com/kubeshop/testkube-operator v1.15.2-beta1.0.20240711115642-7c436d1ac0bc/go.mod h1:P47tw1nKQFufdsZndyq2HG2MSa0zK/lU0XpRfZtEmIk= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/lithammer/fuzzysearch v1.1.8 h1:/HIuJnjHuXS8bKaiTMeeDlW2/AyIWk2brx1V8LFgLN4= diff --git a/pkg/api/v1/testkube/model_test_suite_execution_request.go b/pkg/api/v1/testkube/model_test_suite_execution_request.go index a99b2a7f663..fe4c874b0e1 100644 --- a/pkg/api/v1/testkube/model_test_suite_execution_request.go +++ b/pkg/api/v1/testkube/model_test_suite_execution_request.go @@ -54,6 +54,6 @@ type TestSuiteExecutionRequest struct { ConcurrencyLevel int32 `json:"concurrencyLevel,omitempty"` // test suite execution name started the test suite execution TestSuiteExecutionName string `json:"testSuiteExecutionName,omitempty"` - // whether webhooks on the executions of this test suite are disabled + // whether webhooks on the execution of this test suite are disabled DisableWebhooks bool `json:"disableWebhooks,omitempty"` } diff --git a/pkg/api/v1/testkube/model_test_suite_execution_update_request.go b/pkg/api/v1/testkube/model_test_suite_execution_update_request.go index c844f5c48b5..59c41e7d075 100644 --- a/pkg/api/v1/testkube/model_test_suite_execution_update_request.go +++ b/pkg/api/v1/testkube/model_test_suite_execution_update_request.go @@ -54,6 +54,6 @@ type TestSuiteExecutionUpdateRequest struct { ConcurrencyLevel *int32 `json:"concurrencyLevel,omitempty"` // test suite execution name started the test suite execution TestSuiteExecutionName *string `json:"testSuiteExecutionName,omitempty"` - // whether webhooks on the executions of this test suite are disabled + // whether webhooks on the execution of this test suite are disabled DisableWebhooks *bool `json:"disableWebhooks,omitempty"` } diff --git a/pkg/api/v1/testkube/model_test_suite_step_execution_request.go b/pkg/api/v1/testkube/model_test_suite_step_execution_request.go index 053366e55ce..ca7734c0762 100644 --- a/pkg/api/v1/testkube/model_test_suite_step_execution_request.go +++ b/pkg/api/v1/testkube/model_test_suite_step_execution_request.go @@ -45,6 +45,6 @@ type TestSuiteStepExecutionRequest struct { // name of the template resource PvcTemplateReference string `json:"pvcTemplateReference,omitempty"` RunningContext *RunningContext `json:"runningContext,omitempty"` - // whether webhooks on the executions of this step are disabled + // whether webhooks on the execution of this step are disabled DisableWebhooks bool `json:"disableWebhooks,omitempty"` } diff --git a/pkg/api/v1/testkube/model_test_workflow_execution.go b/pkg/api/v1/testkube/model_test_workflow_execution.go index 0c06aca5e27..ff7774c6aa6 100644 --- a/pkg/api/v1/testkube/model_test_workflow_execution.go +++ b/pkg/api/v1/testkube/model_test_workflow_execution.go @@ -37,6 +37,6 @@ type TestWorkflowExecution struct { ResolvedWorkflow *TestWorkflow `json:"resolvedWorkflow,omitempty"` // test workflow execution name started the test workflow execution TestWorkflowExecutionName string `json:"testWorkflowExecutionName,omitempty"` - // whether webhooks on the executions of this test workflow are disabled + // whether webhooks on the execution of this test workflow are disabled DisableWebhooks bool `json:"disableWebhooks,omitempty"` } diff --git a/pkg/api/v1/testkube/model_test_workflow_execution_cr.go b/pkg/api/v1/testkube/model_test_workflow_execution_cr.go index 347122569aa..a80bad3d99a 100644 --- a/pkg/api/v1/testkube/model_test_workflow_execution_cr.go +++ b/pkg/api/v1/testkube/model_test_workflow_execution_cr.go @@ -13,6 +13,4 @@ type TestWorkflowExecutionCr struct { TestWorkflow *ObjectRef `json:"testWorkflow"` ExecutionRequest *TestWorkflowExecutionRequest `json:"executionRequest,omitempty"` Status *TestWorkflowExecutionStatusCr `json:"status,omitempty"` - // disable webhooks for this execution - DisableWebhooks bool `json:"disableWebhooks,omitempty"` } diff --git a/pkg/api/v1/testkube/model_test_workflow_execution_request.go b/pkg/api/v1/testkube/model_test_workflow_execution_request.go index d3ed46b6979..1bf75035185 100644 --- a/pkg/api/v1/testkube/model_test_workflow_execution_request.go +++ b/pkg/api/v1/testkube/model_test_workflow_execution_request.go @@ -15,6 +15,6 @@ type TestWorkflowExecutionRequest struct { Config map[string]string `json:"config,omitempty"` // test workflow execution name started the test workflow execution TestWorkflowExecutionName string `json:"testWorkflowExecutionName,omitempty"` - // whether webhooks on the executions of this test workflow are disabled + // whether webhooks on the execution of this test workflow are disabled DisableWebhooks bool `json:"disableWebhooks,omitempty"` } diff --git a/pkg/api/v1/testkube/model_test_workflow_notifications_config.go b/pkg/api/v1/testkube/model_test_workflow_notifications_config.go deleted file mode 100644 index 14f34fa8dc5..00000000000 --- a/pkg/api/v1/testkube/model_test_workflow_notifications_config.go +++ /dev/null @@ -1,15 +0,0 @@ -/* - * 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 - -type TestWorkflowNotificationsConfig struct { - // disable webhooks for this test workflow - DisableWebhooks bool `json:"disableWebhooks,omitempty"` -} diff --git a/pkg/api/v1/testkube/model_test_workflow_spec.go b/pkg/api/v1/testkube/model_test_workflow_spec.go index e61d0fe83a5..dace346a30d 100644 --- a/pkg/api/v1/testkube/model_test_workflow_spec.go +++ b/pkg/api/v1/testkube/model_test_workflow_spec.go @@ -10,16 +10,15 @@ package testkube type TestWorkflowSpec struct { - Use []TestWorkflowTemplateRef `json:"use,omitempty"` - Config map[string]TestWorkflowParameterSchema `json:"config,omitempty"` - Content *TestWorkflowContent `json:"content,omitempty"` - Services map[string]TestWorkflowServiceSpec `json:"services,omitempty"` - Container *TestWorkflowContainerConfig `json:"container,omitempty"` - Job *TestWorkflowJobConfig `json:"job,omitempty"` - Pod *TestWorkflowPodConfig `json:"pod,omitempty"` - Setup []TestWorkflowStep `json:"setup,omitempty"` - Steps []TestWorkflowStep `json:"steps,omitempty"` - After []TestWorkflowStep `json:"after,omitempty"` - Events []TestWorkflowEvent `json:"events,omitempty"` - Notifications *TestWorkflowNotificationsConfig `json:"notifications,omitempty"` + Use []TestWorkflowTemplateRef `json:"use,omitempty"` + Config map[string]TestWorkflowParameterSchema `json:"config,omitempty"` + Content *TestWorkflowContent `json:"content,omitempty"` + Services map[string]TestWorkflowServiceSpec `json:"services,omitempty"` + Container *TestWorkflowContainerConfig `json:"container,omitempty"` + Job *TestWorkflowJobConfig `json:"job,omitempty"` + Pod *TestWorkflowPodConfig `json:"pod,omitempty"` + Setup []TestWorkflowStep `json:"setup,omitempty"` + Steps []TestWorkflowStep `json:"steps,omitempty"` + After []TestWorkflowStep `json:"after,omitempty"` + Events []TestWorkflowEvent `json:"events,omitempty"` } diff --git a/pkg/api/v1/testkube/model_test_workflow_step_parallel.go b/pkg/api/v1/testkube/model_test_workflow_step_parallel.go index b296a1e92dc..fbea0caff01 100644 --- a/pkg/api/v1/testkube/model_test_workflow_step_parallel.go +++ b/pkg/api/v1/testkube/model_test_workflow_step_parallel.go @@ -28,22 +28,21 @@ type TestWorkflowStepParallel struct { // delay before the step Delay string `json:"delay,omitempty"` // script to run in a default shell for the container - Shell string `json:"shell,omitempty"` - Run *TestWorkflowStepRun `json:"run,omitempty"` - Execute *TestWorkflowStepExecute `json:"execute,omitempty"` - Artifacts *TestWorkflowStepArtifacts `json:"artifacts,omitempty"` - Use []TestWorkflowTemplateRef `json:"use,omitempty"` - Config map[string]TestWorkflowParameterSchema `json:"config,omitempty"` - Content *TestWorkflowContent `json:"content,omitempty"` - Services map[string]TestWorkflowServiceSpec `json:"services,omitempty"` - Container *TestWorkflowContainerConfig `json:"container,omitempty"` - Job *TestWorkflowJobConfig `json:"job,omitempty"` - Pod *TestWorkflowPodConfig `json:"pod,omitempty"` - Setup []TestWorkflowStep `json:"setup,omitempty"` - Steps []TestWorkflowStep `json:"steps,omitempty"` - After []TestWorkflowStep `json:"after,omitempty"` - Events []TestWorkflowEvent `json:"events,omitempty"` - Notifications *TestWorkflowNotificationsConfig `json:"notifications,omitempty"` + Shell string `json:"shell,omitempty"` + Run *TestWorkflowStepRun `json:"run,omitempty"` + Execute *TestWorkflowStepExecute `json:"execute,omitempty"` + Artifacts *TestWorkflowStepArtifacts `json:"artifacts,omitempty"` + Use []TestWorkflowTemplateRef `json:"use,omitempty"` + Config map[string]TestWorkflowParameterSchema `json:"config,omitempty"` + Content *TestWorkflowContent `json:"content,omitempty"` + Services map[string]TestWorkflowServiceSpec `json:"services,omitempty"` + Container *TestWorkflowContainerConfig `json:"container,omitempty"` + Job *TestWorkflowJobConfig `json:"job,omitempty"` + Pod *TestWorkflowPodConfig `json:"pod,omitempty"` + Setup []TestWorkflowStep `json:"setup,omitempty"` + Steps []TestWorkflowStep `json:"steps,omitempty"` + After []TestWorkflowStep `json:"after,omitempty"` + Events []TestWorkflowEvent `json:"events,omitempty"` // how many resources could be scheduled in parallel Parallelism int32 `json:"parallelism,omitempty"` // worker description to display diff --git a/pkg/mapper/testworkflows/kube_openapi.go b/pkg/mapper/testworkflows/kube_openapi.go index 3c38f805984..b87ef748650 100644 --- a/pkg/mapper/testworkflows/kube_openapi.go +++ b/pkg/mapper/testworkflows/kube_openapi.go @@ -1081,18 +1081,17 @@ func MapIndependentStepKubeToAPI(v testworkflowsv1.IndependentStep) testkube.Tes func MapSpecKubeToAPI(v testworkflowsv1.TestWorkflowSpec) testkube.TestWorkflowSpec { return testkube.TestWorkflowSpec{ - Use: common.MapSlice(v.Use, MapTemplateRefKubeToAPI), - Config: common.MapMap(v.Config, MapParameterSchemaKubeToAPI), - Content: common.MapPtr(v.Content, MapContentKubeToAPI), - Services: common.MapMap(v.Services, MapServiceSpecKubeToAPI), - Container: common.MapPtr(v.Container, MapContainerConfigKubeToAPI), - Job: common.MapPtr(v.Job, MapJobConfigKubeToAPI), - Pod: common.MapPtr(v.Pod, MapPodConfigKubeToAPI), - Setup: common.MapSlice(v.Setup, MapStepKubeToAPI), - Steps: common.MapSlice(v.Steps, MapStepKubeToAPI), - After: common.MapSlice(v.After, MapStepKubeToAPI), - Events: common.MapSlice(v.Events, MapEventKubeToAPI), - Notifications: common.MapPtr(v.Notifications, MapNotificationsConfigKubeToAPI), + Use: common.MapSlice(v.Use, MapTemplateRefKubeToAPI), + Config: common.MapMap(v.Config, MapParameterSchemaKubeToAPI), + Content: common.MapPtr(v.Content, MapContentKubeToAPI), + Services: common.MapMap(v.Services, MapServiceSpecKubeToAPI), + Container: common.MapPtr(v.Container, MapContainerConfigKubeToAPI), + Job: common.MapPtr(v.Job, MapJobConfigKubeToAPI), + Pod: common.MapPtr(v.Pod, MapPodConfigKubeToAPI), + Setup: common.MapSlice(v.Setup, MapStepKubeToAPI), + Steps: common.MapSlice(v.Steps, MapStepKubeToAPI), + After: common.MapSlice(v.After, MapStepKubeToAPI), + Events: common.MapSlice(v.Events, MapEventKubeToAPI), } } @@ -1157,9 +1156,3 @@ func MapTemplateListKubeToAPI(v *testworkflowsv1.TestWorkflowTemplateList) []tes } return workflows } - -func MapNotificationsConfigKubeToAPI(v testworkflowsv1.NotificationsConfig) testkube.TestWorkflowNotificationsConfig { - return testkube.TestWorkflowNotificationsConfig{ - DisableWebhooks: v.DisableWebhooks, - } -} diff --git a/pkg/mapper/testworkflows/openapi_kube.go b/pkg/mapper/testworkflows/openapi_kube.go index d7a328bf039..3eaf2f3b924 100644 --- a/pkg/mapper/testworkflows/openapi_kube.go +++ b/pkg/mapper/testworkflows/openapi_kube.go @@ -908,12 +908,11 @@ func MapStepParallelAPIToKube(v testkube.TestWorkflowStepParallel) testworkflows Fetch: common.MapSlice(v.Fetch, MapStepParallelFetchAPIToKube), TestWorkflowSpec: testworkflowsv1.TestWorkflowSpec{ TestWorkflowSpecBase: testworkflowsv1.TestWorkflowSpecBase{ - Config: common.MapMap(v.Config, MapParameterSchemaAPIToKube), - Content: common.MapPtr(v.Content, MapContentAPIToKube), - Container: common.MapPtr(v.Container, MapContainerConfigAPIToKube), - Job: common.MapPtr(v.Job, MapJobConfigAPIToKube), - Pod: common.MapPtr(v.Pod, MapPodConfigAPIToKube), - Notifications: common.MapPtr(v.Notifications, MapNotificationsAPIToKube), + Config: common.MapMap(v.Config, MapParameterSchemaAPIToKube), + Content: common.MapPtr(v.Content, MapContentAPIToKube), + Container: common.MapPtr(v.Container, MapContainerConfigAPIToKube), + Job: common.MapPtr(v.Job, MapJobConfigAPIToKube), + Pod: common.MapPtr(v.Pod, MapPodConfigAPIToKube), }, Use: common.MapSlice(v.Use, MapTemplateRefAPIToKube), Setup: common.MapSlice(v.Setup, MapStepAPIToKube), @@ -1425,9 +1424,3 @@ func MapTestWorkflowAPIToKubeTestWorkflowSummary(v testkube.TestWorkflow) testwo Annotations: v.Annotations, } } - -func MapNotificationsAPIToKube(v testkube.TestWorkflowNotificationsConfig) testworkflowsv1.NotificationsConfig { - return testworkflowsv1.NotificationsConfig{ - DisableWebhooks: v.DisableWebhooks, - } -} diff --git a/pkg/testworkflows/testworkflowexecutor/executor.go b/pkg/testworkflows/testworkflowexecutor/executor.go index f7c02dff686..0a7fef4cb1e 100644 --- a/pkg/testworkflows/testworkflowexecutor/executor.go +++ b/pkg/testworkflows/testworkflowexecutor/executor.go @@ -392,11 +392,6 @@ func (e *executor) Execute(ctx context.Context, workflow testworkflowsv1.TestWor return execution, fmt.Errorf("not supported execution namespace %s", namespace) } - disableWebhooks := request.DisableWebhooks - if !disableWebhooks && workflow.Spec.Notifications != nil { - disableWebhooks = workflow.Spec.Notifications.DisableWebhooks - } - // Build the basic Execution data id := primitive.NewObjectID().Hex() now := time.Now() @@ -519,7 +514,7 @@ func (e *executor) Execute(ctx context.Context, workflow testworkflowsv1.TestWor Workflow: testworkflowmappers.MapKubeToAPI(initialWorkflow), ResolvedWorkflow: testworkflowmappers.MapKubeToAPI(resolvedWorkflow), TestWorkflowExecutionName: testWorkflowExecutionName, - DisableWebhooks: disableWebhooks, + DisableWebhooks: request.DisableWebhooks, } err = e.repository.Insert(ctx, execution) if err != nil {