Skip to content

Commit

Permalink
fix(uiveri5ExecuteTests): add 'tests' stash to step yaml (#2641)
Browse files Browse the repository at this point in the history
* add tests stash to uiveri5 step

* add stash to uiveri5

* extend step generator with input resources

* add step generator test
  • Loading branch information
lndrschlz authored Mar 1, 2021
1 parent d2eb287 commit 4ca9186
Show file tree
Hide file tree
Showing 18 changed files with 79 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/checkmarxExecuteScan_generated.go

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

3 changes: 3 additions & 0 deletions cmd/cloudFoundryCreateService_generated.go

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

3 changes: 3 additions & 0 deletions cmd/cloudFoundryCreateSpace_generated.go

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

3 changes: 3 additions & 0 deletions cmd/cloudFoundryDeleteSpace_generated.go

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

4 changes: 4 additions & 0 deletions cmd/detectExecuteScan_generated.go

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

7 changes: 7 additions & 0 deletions cmd/fortifyExecuteScan_generated.go

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

3 changes: 3 additions & 0 deletions cmd/gitopsUpdateDeployment_generated.go

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

4 changes: 4 additions & 0 deletions cmd/karmaExecuteTests_generated.go

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

3 changes: 3 additions & 0 deletions cmd/kubernetesDeploy_generated.go

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

4 changes: 4 additions & 0 deletions cmd/nexusUpload_generated.go

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

3 changes: 3 additions & 0 deletions cmd/npmExecuteScripts_generated.go

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

4 changes: 4 additions & 0 deletions cmd/uiVeri5ExecuteTests_generated.go

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

5 changes: 5 additions & 0 deletions cmd/whitesourceExecuteScan_generated.go

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

14 changes: 14 additions & 0 deletions pkg/generator/helper/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type stepInfo struct {
Containers []config.Container
Sidecars []config.Container
Outputs config.StepOutputs
Resources []config.StepResources
}

//StepGoTemplate ...
Expand Down Expand Up @@ -171,6 +172,17 @@ func {{ .StepName }}Metadata() config.StepData {
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
{{ if .Resources -}}
Resources: []config.StepResources{
{{- range $resource := .Resources }}
{
{{- if $resource.Name -}} Name: "{{$resource.Name}}",{{- end }}
{{- if $resource.Description -}} Description: "{{$resource.Description}}",{{- end }}
{{- if $resource.Type -}} Type: "{{$resource.Type}}",{{- end }}
{{- if $resource.Conditions -}} Conditions: []config.Condition{ {{- range $i, $cond := $resource.Conditions }} {ConditionRef: "{{$cond.ConditionRef}}", Params: []config.Param{ {{- range $j, $p := $cond.Params}} { Name: "{{$p.Name}}", Value: "{{$p.Value}}" }, {{end -}} } }, {{ end -}} },{{ end }}
},{{- end }}
},
{{ end -}}
Parameters: []config.StepParameters{
{{- range $key, $value := .StepParameters }}
{
Expand Down Expand Up @@ -223,6 +235,7 @@ func {{ .StepName }}Metadata() config.StepData {
{{ if $p.tags}}{"tags": []map[string]string{ {{- range $j, $t := $p.tags}} {"name": "{{$t.name}}"}, {{end -}} } },{{ end -}}
{{ end }}
{{ if $res.Parameters -}} }, {{- end }}
{{- if $res.Conditions -}} Conditions: []config.Condition{ {{- range $i, $cond := $res.Conditions }} {ConditionRef: "{{$cond.ConditionRef}}", Params: []config.Param{ {{- range $j, $p := $cond.Params}} { Name: "{{$p.Name}}", Value: "{{$p.Value}}" }, {{end -}} } }, {{ end -}} },{{ end }}
}, {{- end }}
},
}, {{- end }}
Expand Down Expand Up @@ -542,6 +555,7 @@ func getStepInfo(stepData *config.StepData, osImport bool, exportPrefix string)
Containers: stepData.Spec.Containers,
Sidecars: stepData.Spec.Sidecars,
Outputs: stepData.Spec.Outputs,
Resources: stepData.Spec.Inputs.Resources,
},
err
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/generator/helper/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ spec:
tags:
- name: t1
inputs:
resources:
- name: stashName
type: stash
params:
- name: param0
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ func testStepMetadata() config.StepData {
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
Resources: []config.StepResources{
{Name: "stashName",Type: "stash",
},
},
Parameters: []config.StepParameters{
{
Name: "param0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ func testStepMetadata() config.StepData {
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
Resources: []config.StepResources{
{Name: "stashName",Type: "stash",
},
},
Parameters: []config.StepParameters{
{
Name: "param0",
Expand Down
5 changes: 5 additions & 0 deletions resources/metadata/uiVeri5ExecuteTests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ metadata:
# In a Kubernetes environment, the containers both need to be referenced with `localhost`.
spec:
inputs:
resources:
- name: buildDescriptor
type: stash
- name: tests
type: stash
params:
- name: installCommand
type: string
Expand Down

0 comments on commit 4ca9186

Please sign in to comment.