diff --git a/cmd/checkmarxExecuteScan_generated.go b/cmd/checkmarxExecuteScan_generated.go index f25d0dccd..ae34f4041 100644 --- a/cmd/checkmarxExecuteScan_generated.go +++ b/cmd/checkmarxExecuteScan_generated.go @@ -271,6 +271,9 @@ func checkmarxExecuteScanMetadata() config.StepData { }, Spec: config.StepSpec{ Inputs: config.StepInputs{ + Resources: []config.StepResources{ + {Name: "checkmarx", Type: "stash"}, + }, Parameters: []config.StepParameters{ { Name: "avoidDuplicateProjectScans", diff --git a/cmd/cloudFoundryCreateService_generated.go b/cmd/cloudFoundryCreateService_generated.go index 91bb02522..c5e9dfeaa 100644 --- a/cmd/cloudFoundryCreateService_generated.go +++ b/cmd/cloudFoundryCreateService_generated.go @@ -127,6 +127,9 @@ func cloudFoundryCreateServiceMetadata() config.StepData { }, Spec: config.StepSpec{ Inputs: config.StepInputs{ + Resources: []config.StepResources{ + {Name: "deployDescriptor", Type: "stash"}, + }, Parameters: []config.StepParameters{ { Name: "cfApiEndpoint", diff --git a/cmd/cloudFoundryCreateSpace_generated.go b/cmd/cloudFoundryCreateSpace_generated.go index 3a997c26e..a0a0bf67a 100644 --- a/cmd/cloudFoundryCreateSpace_generated.go +++ b/cmd/cloudFoundryCreateSpace_generated.go @@ -105,6 +105,9 @@ func cloudFoundryCreateSpaceMetadata() config.StepData { }, Spec: config.StepSpec{ Inputs: config.StepInputs{ + Resources: []config.StepResources{ + {Name: "deployDescriptor", Type: "stash"}, + }, Parameters: []config.StepParameters{ { Name: "cfApiEndpoint", diff --git a/cmd/cloudFoundryDeleteSpace_generated.go b/cmd/cloudFoundryDeleteSpace_generated.go index 27dcfc09a..d902a37e3 100644 --- a/cmd/cloudFoundryDeleteSpace_generated.go +++ b/cmd/cloudFoundryDeleteSpace_generated.go @@ -105,6 +105,9 @@ func cloudFoundryDeleteSpaceMetadata() config.StepData { }, Spec: config.StepSpec{ Inputs: config.StepInputs{ + Resources: []config.StepResources{ + {Name: "deployDescriptor", Type: "stash"}, + }, Parameters: []config.StepParameters{ { Name: "cfApiEndpoint", diff --git a/cmd/detectExecuteScan_generated.go b/cmd/detectExecuteScan_generated.go index db70398b5..2b6e3f4bd 100644 --- a/cmd/detectExecuteScan_generated.go +++ b/cmd/detectExecuteScan_generated.go @@ -136,6 +136,10 @@ func detectExecuteScanMetadata() config.StepData { }, Spec: config.StepSpec{ Inputs: config.StepInputs{ + Resources: []config.StepResources{ + {Name: "buildDescriptor", Type: "stash"}, + {Name: "checkmarx", Type: "stash"}, + }, Parameters: []config.StepParameters{ { Name: "token", diff --git a/cmd/fortifyExecuteScan_generated.go b/cmd/fortifyExecuteScan_generated.go index 013f26d44..455f0a8b7 100644 --- a/cmd/fortifyExecuteScan_generated.go +++ b/cmd/fortifyExecuteScan_generated.go @@ -258,6 +258,13 @@ func fortifyExecuteScanMetadata() config.StepData { }, Spec: config.StepSpec{ Inputs: config.StepInputs{ + Resources: []config.StepResources{ + {Name: "commonPipelineEnvironment"}, + {Name: "buildDescriptor", Type: "stash"}, + {Name: "deployDescriptor", Type: "stash"}, + {Name: "tests", Type: "stash"}, + {Name: "opensourceConfiguration", Type: "stash"}, + }, Parameters: []config.StepParameters{ { Name: "authToken", diff --git a/cmd/gitopsUpdateDeployment_generated.go b/cmd/gitopsUpdateDeployment_generated.go index b14b11f34..18be23d15 100644 --- a/cmd/gitopsUpdateDeployment_generated.go +++ b/cmd/gitopsUpdateDeployment_generated.go @@ -128,6 +128,9 @@ func gitopsUpdateDeploymentMetadata() config.StepData { }, Spec: config.StepSpec{ Inputs: config.StepInputs{ + Resources: []config.StepResources{ + {Name: "deployDescriptor", Type: "stash"}, + }, Parameters: []config.StepParameters{ { Name: "branchName", diff --git a/cmd/karmaExecuteTests_generated.go b/cmd/karmaExecuteTests_generated.go index 6e77a14ed..8d95c3b97 100644 --- a/cmd/karmaExecuteTests_generated.go +++ b/cmd/karmaExecuteTests_generated.go @@ -105,6 +105,10 @@ func karmaExecuteTestsMetadata() config.StepData { }, Spec: config.StepSpec{ Inputs: config.StepInputs{ + Resources: []config.StepResources{ + {Name: "buildDescriptor", Type: "stash"}, + {Name: "tests", Type: "stash"}, + }, Parameters: []config.StepParameters{ { Name: "installCommand", diff --git a/cmd/kubernetesDeploy_generated.go b/cmd/kubernetesDeploy_generated.go index e7f37e37c..e6e7fb54c 100644 --- a/cmd/kubernetesDeploy_generated.go +++ b/cmd/kubernetesDeploy_generated.go @@ -156,6 +156,9 @@ func kubernetesDeployMetadata() config.StepData { }, Spec: config.StepSpec{ Inputs: config.StepInputs{ + Resources: []config.StepResources{ + {Name: "deployDescriptor", Type: "stash"}, + }, Parameters: []config.StepParameters{ { Name: "additionalParameters", diff --git a/cmd/nexusUpload_generated.go b/cmd/nexusUpload_generated.go index c8dff6d6f..7b4d768d2 100644 --- a/cmd/nexusUpload_generated.go +++ b/cmd/nexusUpload_generated.go @@ -126,6 +126,10 @@ func nexusUploadMetadata() config.StepData { }, Spec: config.StepSpec{ Inputs: config.StepInputs{ + Resources: []config.StepResources{ + {Name: "buildDescriptor", Type: "stash"}, + {Name: "buildResult", Type: "stash"}, + }, Parameters: []config.StepParameters{ { Name: "version", diff --git a/cmd/npmExecuteScripts_generated.go b/cmd/npmExecuteScripts_generated.go index a71e309c6..8cae78735 100644 --- a/cmd/npmExecuteScripts_generated.go +++ b/cmd/npmExecuteScripts_generated.go @@ -100,6 +100,9 @@ func npmExecuteScriptsMetadata() config.StepData { }, Spec: config.StepSpec{ Inputs: config.StepInputs{ + Resources: []config.StepResources{ + {Name: "source", Type: "stash"}, + }, Parameters: []config.StepParameters{ { Name: "install", diff --git a/cmd/uiVeri5ExecuteTests_generated.go b/cmd/uiVeri5ExecuteTests_generated.go index 8114c8e87..5d47b1b25 100644 --- a/cmd/uiVeri5ExecuteTests_generated.go +++ b/cmd/uiVeri5ExecuteTests_generated.go @@ -99,6 +99,10 @@ func uiVeri5ExecuteTestsMetadata() config.StepData { }, Spec: config.StepSpec{ Inputs: config.StepInputs{ + Resources: []config.StepResources{ + {Name: "buildDescriptor", Type: "stash"}, + {Name: "tests", Type: "stash"}, + }, Parameters: []config.StepParameters{ { Name: "installCommand", diff --git a/cmd/whitesourceExecuteScan_generated.go b/cmd/whitesourceExecuteScan_generated.go index bc7c6085f..dd1409660 100644 --- a/cmd/whitesourceExecuteScan_generated.go +++ b/cmd/whitesourceExecuteScan_generated.go @@ -216,6 +216,11 @@ func whitesourceExecuteScanMetadata() config.StepData { }, Spec: config.StepSpec{ Inputs: config.StepInputs{ + Resources: []config.StepResources{ + {Name: "buildDescriptor", Type: "stash"}, + {Name: "opensourceConfiguration", Type: "stash"}, + {Name: "checkmarx", Type: "stash"}, + }, Parameters: []config.StepParameters{ { Name: "agentDownloadUrl", diff --git a/pkg/generator/helper/helper.go b/pkg/generator/helper/helper.go index 03dd732d9..abdc45fed 100644 --- a/pkg/generator/helper/helper.go +++ b/pkg/generator/helper/helper.go @@ -34,6 +34,7 @@ type stepInfo struct { Containers []config.Container Sidecars []config.Container Outputs config.StepOutputs + Resources []config.StepResources } //StepGoTemplate ... @@ -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 }} { @@ -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 }} @@ -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 } diff --git a/pkg/generator/helper/helper_test.go b/pkg/generator/helper/helper_test.go index 5d6911557..9afc7f4a2 100644 --- a/pkg/generator/helper/helper_test.go +++ b/pkg/generator/helper/helper_test.go @@ -42,6 +42,9 @@ spec: tags: - name: t1 inputs: + resources: + - name: stashName + type: stash params: - name: param0 type: string diff --git a/pkg/generator/helper/testdata/TestProcessMetaFiles/custom_step_code_generated.golden b/pkg/generator/helper/testdata/TestProcessMetaFiles/custom_step_code_generated.golden index 2e8915215..6ac0f9244 100644 --- a/pkg/generator/helper/testdata/TestProcessMetaFiles/custom_step_code_generated.golden +++ b/pkg/generator/helper/testdata/TestProcessMetaFiles/custom_step_code_generated.golden @@ -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", diff --git a/pkg/generator/helper/testdata/TestProcessMetaFiles/step_code_generated.golden b/pkg/generator/helper/testdata/TestProcessMetaFiles/step_code_generated.golden index bcc42b529..f0bd8a9c4 100644 --- a/pkg/generator/helper/testdata/TestProcessMetaFiles/step_code_generated.golden +++ b/pkg/generator/helper/testdata/TestProcessMetaFiles/step_code_generated.golden @@ -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", diff --git a/resources/metadata/uiVeri5ExecuteTests.yaml b/resources/metadata/uiVeri5ExecuteTests.yaml index 104d71910..907b3a9f8 100644 --- a/resources/metadata/uiVeri5ExecuteTests.yaml +++ b/resources/metadata/uiVeri5ExecuteTests.yaml @@ -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