From 64f6c9715552071097709c39c2f644cd4ed6ebd2 Mon Sep 17 00:00:00 2001 From: Jacek Wysocki Date: Fri, 30 Aug 2024 11:21:17 +0200 Subject: [PATCH] feat: add tags to test workflow executions (#292) (#296) Signed-off-by: Vladislav Sukhin Co-authored-by: Vladislav Sukhin --- api/testworkflows/v1/base_types.go | 3 ++ api/testworkflows/v1/status_types.go | 2 + .../v1/testworkflowexecution_types.go | 4 ++ api/testworkflows/v1/types.go | 5 ++ api/testworkflows/v1/zz_generated.deepcopy.go | 48 +++++++++++++++++++ ...ws.testkube.io_testworkflowexecutions.yaml | 10 ++++ ...stworkflows.testkube.io_testworkflows.yaml | 14 ++++++ ...ows.testkube.io_testworkflowtemplates.yaml | 9 ++++ 8 files changed, 95 insertions(+) diff --git a/api/testworkflows/v1/base_types.go b/api/testworkflows/v1/base_types.go index f65d6eca..bb70d3cc 100644 --- a/api/testworkflows/v1/base_types.go +++ b/api/testworkflows/v1/base_types.go @@ -27,6 +27,9 @@ type TestWorkflowSpecBase struct { // configuration for notifications // Deprecated: field is not used Notifications *NotificationsConfig `json:"notifications,omitempty" expr:"include"` + + // values to be used for test workflow execution + Execution *TestWorkflowTagSchema `json:"execution,omitempty" expr:"include"` } type TestWorkflowSystem struct { diff --git a/api/testworkflows/v1/status_types.go b/api/testworkflows/v1/status_types.go index 632d5223..2ef887ec 100644 --- a/api/testworkflows/v1/status_types.go +++ b/api/testworkflows/v1/status_types.go @@ -18,6 +18,8 @@ type TestWorkflowExecutionSummary struct { StatusAt metav1.Time `json:"statusAt,omitempty"` Result *TestWorkflowResultSummary `json:"result,omitempty"` Workflow *TestWorkflowSummary `json:"workflow"` + // test workflow execution tags + Tags map[string]string `json:"tags,omitempty"` } // TestWorkflowResultSummary defines TestWorkflow result summary diff --git a/api/testworkflows/v1/testworkflowexecution_types.go b/api/testworkflows/v1/testworkflowexecution_types.go index 964e68fa..c07947f3 100644 --- a/api/testworkflows/v1/testworkflowexecution_types.go +++ b/api/testworkflows/v1/testworkflowexecution_types.go @@ -37,6 +37,8 @@ type TestWorkflowExecutionRequest struct { TestWorkflowExecutionName string `json:"testWorkflowExecutionName,omitempty" expr:"template"` // whether webhooks should be disabled for this execution DisableWebhooks bool `json:"disableWebhooks,omitempty"` + // test workflow execution tags + Tags map[string]string `json:"tags,omitempty" expr:"template"` } // TestWorkflowExecutionStatus defines the observed state of TestWorkflowExecution @@ -79,6 +81,8 @@ type TestWorkflowExecutionDetails struct { TestWorkflowExecutionName string `json:"testWorkflowExecutionName,omitempty"` // whether webhooks should be disabled for this execution DisableWebhooks bool `json:"disableWebhooks,omitempty"` + // test workflow execution tags + Tags map[string]string `json:"tags,omitempty"` } // TestWorkflowSignature has signature of TestWorkflow diff --git a/api/testworkflows/v1/types.go b/api/testworkflows/v1/types.go index a4943386..5d43dbe8 100644 --- a/api/testworkflows/v1/types.go +++ b/api/testworkflows/v1/types.go @@ -223,3 +223,8 @@ type CronJobConfig struct { // annotations to attach to the cron job Annotations map[string]string `json:"annotations,omitempty" expr:"template,template"` } + +type TestWorkflowTagSchema struct { + // test workflow execution tags + Tags map[string]string `json:"tags,omitempty" expr:"template"` +} diff --git a/api/testworkflows/v1/zz_generated.deepcopy.go b/api/testworkflows/v1/zz_generated.deepcopy.go index 9a1a6f5e..cb445387 100644 --- a/api/testworkflows/v1/zz_generated.deepcopy.go +++ b/api/testworkflows/v1/zz_generated.deepcopy.go @@ -1352,6 +1352,13 @@ func (in *TestWorkflowExecutionDetails) DeepCopyInto(out *TestWorkflowExecutionD *out = new(TestWorkflow) (*in).DeepCopyInto(*out) } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TestWorkflowExecutionDetails. @@ -1406,6 +1413,13 @@ func (in *TestWorkflowExecutionRequest) DeepCopyInto(out *TestWorkflowExecutionR (*out)[key] = val } } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TestWorkflowExecutionRequest. @@ -1478,6 +1492,13 @@ func (in *TestWorkflowExecutionSummary) DeepCopyInto(out *TestWorkflowExecutionS *out = new(TestWorkflowSummary) (*in).DeepCopyInto(*out) } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TestWorkflowExecutionSummary. @@ -1786,6 +1807,11 @@ func (in *TestWorkflowSpecBase) DeepCopyInto(out *TestWorkflowSpecBase) { *out = new(NotificationsConfig) **out = **in } + if in.Execution != nil { + in, out := &in.Execution, &out.Execution + *out = new(TestWorkflowTagSchema) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TestWorkflowSpecBase. @@ -1870,6 +1896,28 @@ func (in *TestWorkflowSummary) DeepCopy() *TestWorkflowSummary { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TestWorkflowTagSchema) DeepCopyInto(out *TestWorkflowTagSchema) { + *out = *in + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TestWorkflowTagSchema. +func (in *TestWorkflowTagSchema) DeepCopy() *TestWorkflowTagSchema { + if in == nil { + return nil + } + out := new(TestWorkflowTagSchema) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TestWorkflowTemplate) DeepCopyInto(out *TestWorkflowTemplate) { *out = *in diff --git a/config/crd/bases/testworkflows.testkube.io_testworkflowexecutions.yaml b/config/crd/bases/testworkflows.testkube.io_testworkflowexecutions.yaml index 0012a990..1430fb95 100644 --- a/config/crd/bases/testworkflows.testkube.io_testworkflowexecutions.yaml +++ b/config/crd/bases/testworkflows.testkube.io_testworkflowexecutions.yaml @@ -55,6 +55,11 @@ spec: name: description: custom execution name type: string + tags: + additionalProperties: + type: string + description: test workflow execution tags + type: object testWorkflowExecutionName: description: test workflow execution name started the test workflow execution type: string @@ -325,6 +330,11 @@ spec: description: when the execution result's status has changed last time (queued, passed, failed) format: date-time type: string + tags: + additionalProperties: + type: string + description: test workflow execution tags + type: object testWorkflowExecutionName: description: test workflow execution name started the test workflow execution type: string diff --git a/config/crd/bases/testworkflows.testkube.io_testworkflows.yaml b/config/crd/bases/testworkflows.testkube.io_testworkflows.yaml index 56c2381c..b60d4b20 100644 --- a/config/crd/bases/testworkflows.testkube.io_testworkflows.yaml +++ b/config/crd/bases/testworkflows.testkube.io_testworkflows.yaml @@ -3591,6 +3591,15 @@ spec: type: object type: object type: array + execution: + description: values to be used for test workflow execution + properties: + tags: + additionalProperties: + type: string + description: test workflow execution tags + type: object + type: object job: description: configuration for the scheduled job properties: @@ -10736,6 +10745,11 @@ spec: description: when the execution result's status has changed last time (queued, passed, failed) format: date-time type: string + tags: + additionalProperties: + type: string + description: test workflow execution tags + type: object workflow: description: TestWorkflowSummary fas TestWorkflow summary properties: diff --git a/config/crd/bases/testworkflows.testkube.io_testworkflowtemplates.yaml b/config/crd/bases/testworkflows.testkube.io_testworkflowtemplates.yaml index 1019c3c1..7c7ffa9c 100644 --- a/config/crd/bases/testworkflows.testkube.io_testworkflowtemplates.yaml +++ b/config/crd/bases/testworkflows.testkube.io_testworkflowtemplates.yaml @@ -3517,6 +3517,15 @@ spec: type: object type: object type: array + execution: + description: values to be used for test workflow execution + properties: + tags: + additionalProperties: + type: string + description: test workflow execution tags + type: object + type: object job: description: configuration for the scheduled job properties: