Skip to content

Commit

Permalink
chore: rename from to use (#1667)
Browse files Browse the repository at this point in the history
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
  • Loading branch information
eddycharly authored Jul 18, 2024
1 parent c2ff8bb commit 047eaf2
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 32 deletions.
8 changes: 4 additions & 4 deletions .crds/chainsaw.kyverno.io_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ spec:
- required:
- cleanup
required:
- from
- use
properties:
bindings:
description: Bindings defines additional binding key/values.
Expand Down Expand Up @@ -3113,9 +3113,6 @@ spec:
type: object
type: object
type: array
from:
description: From references a step template.
type: string
name:
description: Name of the step.
type: string
Expand Down Expand Up @@ -4585,6 +4582,9 @@ spec:
type: object
minItems: 1
type: array
use:
description: Use references a step template.
type: string
type: object
type: array
template:
Expand Down
16 changes: 8 additions & 8 deletions .schemas/json/test-chainsaw-v1alpha1.json
Original file line number Diff line number Diff line change
Expand Up @@ -1684,7 +1684,7 @@
],
"not": {
"required": [
"from"
"use"
],
"anyOf": [
{
Expand Down Expand Up @@ -5311,13 +5311,6 @@
}
}
},
"from": {
"description": "From references a step template.",
"type": [
"string",
"null"
]
},
"name": {
"description": "Name of the step.",
"type": [
Expand Down Expand Up @@ -8897,6 +8890,13 @@
}
}
}
},
"use": {
"description": "Use references a step template.",
"type": [
"string",
"null"
]
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/apis/v1alpha1/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ type StepTemplateSpec struct {
}

// TestStep contains the test step definition used in a test spec.
// +kubebuilder:not:={required:{from},anyOf:{{required:{try}},{required:{catch}},{required:{finally}},{required:{cleanup}}}}
// +kubebuilder:not:={required:{use},anyOf:{{required:{try}},{required:{catch}},{required:{finally}},{required:{cleanup}}}}
type TestStep struct {
// Name of the step.
// +optional
Name string `json:"name,omitempty"`

// From references a step template.
From string `json:"from,omitempty"`
// Use references a step template.
Use string `json:"use,omitempty"`

// TestStepSpec of the step.
TestStepSpec `json:",inline"`
Expand Down
8 changes: 4 additions & 4 deletions pkg/data/crds/chainsaw.kyverno.io_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ spec:
- required:
- cleanup
required:
- from
- use
properties:
bindings:
description: Bindings defines additional binding key/values.
Expand Down Expand Up @@ -3113,9 +3113,6 @@ spec:
type: object
type: object
type: array
from:
description: From references a step template.
type: string
name:
description: Name of the step.
type: string
Expand Down Expand Up @@ -4585,6 +4582,9 @@ spec:
type: object
minItems: 1
type: array
use:
description: Use references a step template.
type: string
type: object
type: array
template:
Expand Down
16 changes: 8 additions & 8 deletions pkg/data/schemas/json/test-chainsaw-v1alpha1.json
Original file line number Diff line number Diff line change
Expand Up @@ -1684,7 +1684,7 @@
],
"not": {
"required": [
"from"
"use"
],
"anyOf": [
{
Expand Down Expand Up @@ -5311,13 +5311,6 @@
}
}
},
"from": {
"description": "From references a step template.",
"type": [
"string",
"null"
]
},
"name": {
"description": "Name of the step.",
"type": [
Expand Down Expand Up @@ -8897,6 +8890,13 @@
}
}
}
},
"use": {
"description": "Use references a step template.",
"type": [
"string",
"null"
]
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/discovery/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ func LoadTest(fileName string, path string, remarshal bool) ([]Test, error) {
for _, apiTest := range apiTests {
for step := range apiTest.Spec.Steps {
step := &apiTest.Spec.Steps[step]
if step.From != "" {
steptpl, err := steptemplate.Load(filepath.Join(path, step.From), remarshal)
if step.Use != "" {
steptpl, err := steptemplate.Load(filepath.Join(path, step.Use), remarshal)
if err != nil {
return nil, err
}
if len(steptpl) != 1 {
return nil, errors.New("step template not found or multiple templates exist")
}
step.From = ""
step.Use = ""
step.Bindings = append(step.Bindings, steptpl[0].Spec.Bindings...)
step.Try = append(step.Try, steptpl[0].Spec.Try...)
step.Catch = append(step.Catch, steptpl[0].Spec.Catch...)
Expand Down
2 changes: 1 addition & 1 deletion testdata/e2e/examples/step-template/chainsaw-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ metadata:
name: quick-start
spec:
steps:
- from: step-template.yaml
- use: step-template.yaml
2 changes: 1 addition & 1 deletion website/docs/reference/apis/chainsaw.v1alpha1.md
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ If a resource doesn't exist yet in the cluster it will fail.</p>
| Field | Type | Required | Inline | Description |
|---|---|---|---|---|
| `name` | `string` | | | <p>Name of the step.</p> |
| `from` | `string` | :white_check_mark: | | <p>From references a step template.</p> |
| `use` | `string` | :white_check_mark: | | <p>Use references a step template.</p> |
| `TestStepSpec` | [`TestStepSpec`](#chainsaw-kyverno-io-v1alpha1-TestStepSpec) | :white_check_mark: | :white_check_mark: | <p>TestStepSpec of the step.</p> |

## TestStepSpec {#chainsaw-kyverno-io-v1alpha1-TestStepSpec}
Expand Down

0 comments on commit 047eaf2

Please sign in to comment.