Skip to content

Commit

Permalink
feat: add option to transfer data in execute step (#243)
Browse files Browse the repository at this point in the history
* feat(testworkflows): add property to pack and expose files tarball in `execute` step
* feat(testworkflows): add content.tarball for unpacking external tarballs
* chore(testworkflows): rename StepExecutePack to StepExecuteTarball
* feat(testworkflows): allow passing DynamicList to StepExecuteTarball
* feat(testworkflows): move TarballRequest to specific tests and workflows in `execute` step
* feat(testworkflows): make mount and tarball files actually optional
  • Loading branch information
rangoo94 authored Apr 22, 2024
1 parent cb78b80 commit ce20f78
Show file tree
Hide file tree
Showing 5 changed files with 306 additions and 9 deletions.
11 changes: 11 additions & 0 deletions api/testworkflows/v1/content_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,20 @@ type ContentFile struct {
Mode *int32 `json:"mode,omitempty"`
}

type ContentTarball struct {
// url for the tarball to extract
Url string `json:"url" expr:"template"`
// path where the tarball should be extracted
Path string `json:"path" expr:"template"`
// should it mount a new volume there
Mount *bool `json:"mount,omitempty" expr:"ignore"`
}

type Content struct {
// git repository details
Git *ContentGit `json:"git,omitempty" expr:"include"`
// files to load
Files []ContentFile `json:"files,omitempty" expr:"include"`
// tarballs to unpack
Tarball []ContentTarball `json:"tarball,omitempty" expr:"include"`
}
20 changes: 20 additions & 0 deletions api/testworkflows/v1/step_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ type StepExecute struct {
Workflows []StepExecuteWorkflow `json:"workflows,omitempty" expr:"include"`
}

type TarballRequest struct {
// path to load the files from
From string `json:"from,omitempty" expr:"template"`

// file patterns to pack
Files *DynamicList `json:"files,omitempty" expr:"template"`
}

type StepExecuteStrategy struct {
// matrix of parameters to spawn instances (static)
// +kubebuilder:validation:Schemaless
Expand Down Expand Up @@ -148,6 +156,12 @@ type StepExecuteTest struct {

StepExecuteStrategy `json:",inline" expr:"include"`

// pack some data from the original file system to serve them down
// +kubebuilder:validation:Schemaless
// +kubebuilder:pruning:PreserveUnknownFields
// +kubebuilder:validation:Type="object"
Tarball map[string]TarballRequest `json:"tarball,omitempty" expr:"template,include"`

// pass the execution request overrides
ExecutionRequest *TestExecutionRequest `json:"executionRequest,omitempty" expr:"include"`
}
Expand All @@ -164,6 +178,12 @@ type StepExecuteWorkflow struct {
// unique execution name to use
ExecutionName string `json:"executionName,omitempty" expr:"template"`

// pack some data from the original file system to serve them down
// +kubebuilder:validation:Schemaless
// +kubebuilder:pruning:PreserveUnknownFields
// +kubebuilder:validation:Type="object"
Tarball map[string]TarballRequest `json:"tarball,omitempty" expr:"template,include"`

// configuration to pass for the workflow
Config map[string]intstr.IntOrString `json:"config,omitempty" expr:"template"`
}
Expand Down
80 changes: 71 additions & 9 deletions api/testworkflows/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

102 changes: 102 additions & 0 deletions config/crd/bases/testworkflows.testkube.io_testworkflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,24 @@ spec:
type: object
type: object
type: object
tarball:
description: tarballs to unpack
items:
properties:
mount:
description: should it mount a new volume there
type: boolean
path:
description: path where the tarball should be extracted
type: string
url:
description: url for the tarball to extract
type: string
required:
- path
- url
type: object
type: array
type: object
delay:
description: delay before the step
Expand Down Expand Up @@ -1165,6 +1183,11 @@ spec:
across sharded instances
type: object
x-kubernetes-preserve-unknown-fields: true
tarball:
description: pack some data from the original file
system to serve them down
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
type: array
workflows:
Expand Down Expand Up @@ -1214,6 +1237,11 @@ spec:
across sharded instances
type: object
x-kubernetes-preserve-unknown-fields: true
tarball:
description: pack some data from the original file
system to serve them down
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
type: array
type: object
Expand Down Expand Up @@ -2482,6 +2510,24 @@ spec:
type: object
type: object
type: object
tarball:
description: tarballs to unpack
items:
properties:
mount:
description: should it mount a new volume there
type: boolean
path:
description: path where the tarball should be extracted
type: string
url:
description: url for the tarball to extract
type: string
required:
- path
- url
type: object
type: array
type: object
events:
description: events triggering execution of the test workflow
Expand Down Expand Up @@ -4924,6 +4970,24 @@ spec:
type: object
type: object
type: object
tarball:
description: tarballs to unpack
items:
properties:
mount:
description: should it mount a new volume there
type: boolean
path:
description: path where the tarball should be extracted
type: string
url:
description: url for the tarball to extract
type: string
required:
- path
- url
type: object
type: array
type: object
delay:
description: delay before the step
Expand Down Expand Up @@ -5289,6 +5353,11 @@ spec:
across sharded instances
type: object
x-kubernetes-preserve-unknown-fields: true
tarball:
description: pack some data from the original file
system to serve them down
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
type: array
workflows:
Expand Down Expand Up @@ -5338,6 +5407,11 @@ spec:
across sharded instances
type: object
x-kubernetes-preserve-unknown-fields: true
tarball:
description: pack some data from the original file
system to serve them down
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
type: array
type: object
Expand Down Expand Up @@ -6599,6 +6673,24 @@ spec:
type: object
type: object
type: object
tarball:
description: tarballs to unpack
items:
properties:
mount:
description: should it mount a new volume there
type: boolean
path:
description: path where the tarball should be extracted
type: string
url:
description: url for the tarball to extract
type: string
required:
- path
- url
type: object
type: array
type: object
delay:
description: delay before the step
Expand Down Expand Up @@ -6964,6 +7056,11 @@ spec:
across sharded instances
type: object
x-kubernetes-preserve-unknown-fields: true
tarball:
description: pack some data from the original file
system to serve them down
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
type: array
workflows:
Expand Down Expand Up @@ -7013,6 +7110,11 @@ spec:
across sharded instances
type: object
x-kubernetes-preserve-unknown-fields: true
tarball:
description: pack some data from the original file
system to serve them down
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
type: array
type: object
Expand Down
Loading

0 comments on commit ce20f78

Please sign in to comment.