From c66d03db189f47cb2ed04ac9d013e90b0109ffa3 Mon Sep 17 00:00:00 2001 From: Vladislav Sukhin Date: Wed, 8 Nov 2023 13:02:43 +0300 Subject: [PATCH] feat: pass artifacts testsuite (#193) * feat: download artifacts model * fix: add comments --- api/testsuite/v3/testsuite_types.go | 12 +++++-- api/testsuite/v3/zz_generated.deepcopy.go | 25 +++++++++++++ .../bases/tests.testkube.io_testsuites.yaml | 36 +++++++++++++++++++ 3 files changed, 71 insertions(+), 2 deletions(-) diff --git a/api/testsuite/v3/testsuite_types.go b/api/testsuite/v3/testsuite_types.go index 54b2ffb6..ef51f212 100644 --- a/api/testsuite/v3/testsuite_types.go +++ b/api/testsuite/v3/testsuite_types.go @@ -55,10 +55,18 @@ type TestSuiteStepSpec struct { Delay metav1.Duration `json:"delay,omitempty"` } +// options to download artifacts from previous steps +type DownloadArtifactOptions struct { + AllPreviousSteps bool `json:"allPreviousSteps,omitempty"` + // previous step numbers starting from 1 + PreviousStepNumbers []int32 `json:"previousStepNumbers,omitempty"` +} + // TestSuiteBatchStep is set of steps run in parallel type TestSuiteBatchStep struct { - StopOnFailure bool `json:"stopOnFailure"` - Execute []TestSuiteStepSpec `json:"execute,omitempty"` + StopOnFailure bool `json:"stopOnFailure"` + DownloadArtifacts *DownloadArtifactOptions `json:"downloadArtifacts,omitempty"` + Execute []TestSuiteStepSpec `json:"execute,omitempty"` } // RunningContext for test or test suite execution diff --git a/api/testsuite/v3/zz_generated.deepcopy.go b/api/testsuite/v3/zz_generated.deepcopy.go index 464f2e08..6b5bdd83 100644 --- a/api/testsuite/v3/zz_generated.deepcopy.go +++ b/api/testsuite/v3/zz_generated.deepcopy.go @@ -25,6 +25,26 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DownloadArtifactOptions) DeepCopyInto(out *DownloadArtifactOptions) { + *out = *in + if in.PreviousStepNumbers != nil { + in, out := &in.PreviousStepNumbers, &out.PreviousStepNumbers + *out = make([]int32, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DownloadArtifactOptions. +func (in *DownloadArtifactOptions) DeepCopy() *DownloadArtifactOptions { + if in == nil { + return nil + } + out := new(DownloadArtifactOptions) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RunningContext) DeepCopyInto(out *RunningContext) { *out = *in @@ -70,6 +90,11 @@ func (in *TestSuite) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TestSuiteBatchStep) DeepCopyInto(out *TestSuiteBatchStep) { *out = *in + if in.DownloadArtifacts != nil { + in, out := &in.DownloadArtifacts, &out.DownloadArtifacts + *out = new(DownloadArtifactOptions) + (*in).DeepCopyInto(*out) + } if in.Execute != nil { in, out := &in.Execute, &out.Execute *out = make([]TestSuiteStepSpec, len(*in)) diff --git a/config/crd/bases/tests.testkube.io_testsuites.yaml b/config/crd/bases/tests.testkube.io_testsuites.yaml index db8af5e0..f39bafaa 100644 --- a/config/crd/bases/tests.testkube.io_testsuites.yaml +++ b/config/crd/bases/tests.testkube.io_testsuites.yaml @@ -565,6 +565,18 @@ spec: items: description: TestSuiteBatchStep is set of steps run in parallel properties: + downloadArtifacts: + description: options to download artifacts from previous steps + properties: + allPreviousSteps: + type: boolean + previousStepNumbers: + description: previous step numbers starting from 1 + items: + format: int32 + type: integer + type: array + type: object execute: items: description: TestSuiteStepSpec for particular type will have @@ -591,6 +603,18 @@ spec: items: description: TestSuiteBatchStep is set of steps run in parallel properties: + downloadArtifacts: + description: options to download artifacts from previous steps + properties: + allPreviousSteps: + type: boolean + previousStepNumbers: + description: previous step numbers starting from 1 + items: + format: int32 + type: integer + type: array + type: object execute: items: description: TestSuiteStepSpec for particular type will have @@ -783,6 +807,18 @@ spec: items: description: TestSuiteBatchStep is set of steps run in parallel properties: + downloadArtifacts: + description: options to download artifacts from previous steps + properties: + allPreviousSteps: + type: boolean + previousStepNumbers: + description: previous step numbers starting from 1 + items: + format: int32 + type: integer + type: array + type: object execute: items: description: TestSuiteStepSpec for particular type will have