1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00

feat: expose complete step metadata through generated function (#2329)

* exposing step metadata through generator

* add metadata_generated.go

* fix step go test generation

* metadata fields added to generated files

* added generated files

* removed image placeholder from fortify step

* refactored step meta generation

* go generate

* fixed metadata generator and tests

* added output resource fields/tags to metadata generator

* fix string in metadata_generated

* go generate

* fixed generator

* go generate

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
This commit is contained in:
lndrschlz 2020-11-20 08:13:59 +01:00 committed by GitHub
parent cb6b34f042
commit b9bab27833
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
58 changed files with 648 additions and 117 deletions

View File

@ -129,8 +129,9 @@ func addAbapAddonAssemblyKitCheckCVsFlags(cmd *cobra.Command, stepConfig *abapAd
func abapAddonAssemblyKitCheckCVsMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "abapAddonAssemblyKitCheckCVs",
Aliases: []config.Alias{},
Name: "abapAddonAssemblyKitCheckCVs",
Aliases: []config.Alias{},
Description: "This step checks the validity of Software Component Versions.",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -182,6 +183,17 @@ func abapAddonAssemblyKitCheckCVsMetadata() config.StepData {
},
},
},
Outputs: config.StepOutputs{
Resources: []config.StepResources{
{
Name: "commonPipelineEnvironment",
Type: "piperEnvironment",
Parameters: []map[string]interface{}{
{"Name": "abap/addonDescriptor"},
},
},
},
},
},
}
return theMetaData

View File

@ -129,8 +129,9 @@ func addAbapAddonAssemblyKitCheckPVFlags(cmd *cobra.Command, stepConfig *abapAdd
func abapAddonAssemblyKitCheckPVMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "abapAddonAssemblyKitCheckPV",
Aliases: []config.Alias{},
Name: "abapAddonAssemblyKitCheckPV",
Aliases: []config.Alias{},
Description: "This step checks the validity of a Addon Product Version.",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -182,6 +183,17 @@ func abapAddonAssemblyKitCheckPVMetadata() config.StepData {
},
},
},
Outputs: config.StepOutputs{
Resources: []config.StepResources{
{
Name: "commonPipelineEnvironment",
Type: "piperEnvironment",
Parameters: []map[string]interface{}{
{"Name": "abap/addonDescriptor"},
},
},
},
},
},
}
return theMetaData

View File

@ -128,8 +128,9 @@ func addAbapAddonAssemblyKitCreateTargetVectorFlags(cmd *cobra.Command, stepConf
func abapAddonAssemblyKitCreateTargetVectorMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "abapAddonAssemblyKitCreateTargetVector",
Aliases: []config.Alias{},
Name: "abapAddonAssemblyKitCreateTargetVector",
Aliases: []config.Alias{},
Description: "This step creates a Target Vector for software lifecycle operations",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -173,6 +174,17 @@ func abapAddonAssemblyKitCreateTargetVectorMetadata() config.StepData {
},
},
},
Outputs: config.StepOutputs{
Resources: []config.StepResources{
{
Name: "commonPipelineEnvironment",
Type: "piperEnvironment",
Parameters: []map[string]interface{}{
{"Name": "abap/addonDescriptor"},
},
},
},
},
},
}
return theMetaData

View File

@ -97,8 +97,9 @@ func addAbapAddonAssemblyKitPublishTargetVectorFlags(cmd *cobra.Command, stepCon
func abapAddonAssemblyKitPublishTargetVectorMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "abapAddonAssemblyKitPublishTargetVector",
Aliases: []config.Alias{},
Name: "abapAddonAssemblyKitPublishTargetVector",
Aliases: []config.Alias{},
Description: "This step triggers the publication of the Target Vector according to the specified scope.",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{

View File

@ -129,8 +129,9 @@ func addAbapAddonAssemblyKitRegisterPackagesFlags(cmd *cobra.Command, stepConfig
func abapAddonAssemblyKitRegisterPackagesMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "abapAddonAssemblyKitRegisterPackages",
Aliases: []config.Alias{},
Name: "abapAddonAssemblyKitRegisterPackages",
Aliases: []config.Alias{},
Description: "This step uploads the SAR archives and creates physical Delivery Packages in in the File Content Management System of SAP.",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -174,6 +175,17 @@ func abapAddonAssemblyKitRegisterPackagesMetadata() config.StepData {
},
},
},
Outputs: config.StepOutputs{
Resources: []config.StepResources{
{
Name: "commonPipelineEnvironment",
Type: "piperEnvironment",
Parameters: []map[string]interface{}{
{"Name": "abap/addonDescriptor"},
},
},
},
},
},
}
return theMetaData

View File

@ -126,8 +126,9 @@ func addAbapAddonAssemblyKitReleasePackagesFlags(cmd *cobra.Command, stepConfig
func abapAddonAssemblyKitReleasePackagesMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "abapAddonAssemblyKitReleasePackages",
Aliases: []config.Alias{},
Name: "abapAddonAssemblyKitReleasePackages",
Aliases: []config.Alias{},
Description: "This step releases the physical Delivery Packages",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -171,6 +172,17 @@ func abapAddonAssemblyKitReleasePackagesMetadata() config.StepData {
},
},
},
Outputs: config.StepOutputs{
Resources: []config.StepResources{
{
Name: "commonPipelineEnvironment",
Type: "piperEnvironment",
Parameters: []map[string]interface{}{
{"Name": "abap/addonDescriptor"},
},
},
},
},
},
}
return theMetaData

View File

@ -131,8 +131,9 @@ func addAbapAddonAssemblyKitReserveNextPackagesFlags(cmd *cobra.Command, stepCon
func abapAddonAssemblyKitReserveNextPackagesMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "abapAddonAssemblyKitReserveNextPackages",
Aliases: []config.Alias{},
Name: "abapAddonAssemblyKitReserveNextPackages",
Aliases: []config.Alias{},
Description: "This step determines the ABAP delivery packages (name and type), which are needed to deliver Software Component Versions.",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -176,6 +177,17 @@ func abapAddonAssemblyKitReserveNextPackagesMetadata() config.StepData {
},
},
},
Outputs: config.StepOutputs{
Resources: []config.StepResources{
{
Name: "commonPipelineEnvironment",
Type: "piperEnvironment",
Parameters: []map[string]interface{}{
{"Name": "abap/addonDescriptor"},
},
},
},
},
},
}
return theMetaData

View File

@ -139,8 +139,9 @@ func addAbapEnvironmentAssemblePackagesFlags(cmd *cobra.Command, stepConfig *aba
func abapEnvironmentAssemblePackagesMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "abapEnvironmentAssemblePackages",
Aliases: []config.Alias{},
Name: "abapEnvironmentAssemblePackages",
Aliases: []config.Alias{},
Description: "Assembly of installation, support package or patch in SAP Cloud Platform ABAP Environment system",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -232,6 +233,20 @@ func abapEnvironmentAssemblePackagesMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Name: "cf", Image: "ppiper/cf-cli"},
},
Outputs: config.StepOutputs{
Resources: []config.StepResources{
{
Name: "commonPipelineEnvironment",
Type: "piperEnvironment",
Parameters: []map[string]interface{}{
{"Name": "abap/addonDescriptor"},
},
},
},
},
},
}
return theMetaData

View File

@ -111,8 +111,9 @@ func addAbapEnvironmentCheckoutBranchFlags(cmd *cobra.Command, stepConfig *abapE
func abapEnvironmentCheckoutBranchMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "abapEnvironmentCheckoutBranch",
Aliases: []config.Alias{},
Name: "abapEnvironmentCheckoutBranch",
Aliases: []config.Alias{},
Description: "Switches between branches of a git repository on a SAP Cloud Platform ABAP Environment system",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -219,6 +220,9 @@ func abapEnvironmentCheckoutBranchMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Name: "cf", Image: "ppiper/cf-cli"},
},
},
}
return theMetaData

View File

@ -111,8 +111,9 @@ func addAbapEnvironmentCloneGitRepoFlags(cmd *cobra.Command, stepConfig *abapEnv
func abapEnvironmentCloneGitRepoMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "abapEnvironmentCloneGitRepo",
Aliases: []config.Alias{},
Name: "abapEnvironmentCloneGitRepo",
Aliases: []config.Alias{},
Description: "Clones a git repository to a SAP Cloud Platform ABAP Environment system",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -219,6 +220,9 @@ func abapEnvironmentCloneGitRepoMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Name: "cf", Image: "ppiper/cf-cli"},
},
},
}
return theMetaData

View File

@ -121,8 +121,9 @@ func addAbapEnvironmentCreateSystemFlags(cmd *cobra.Command, stepConfig *abapEnv
func abapEnvironmentCreateSystemMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "abapEnvironmentCreateSystem",
Aliases: []config.Alias{},
Name: "abapEnvironmentCreateSystem",
Aliases: []config.Alias{},
Description: "Creates a SAP Cloud Platform ABAP Environment system (aka Steampunk system)",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -289,6 +290,9 @@ func abapEnvironmentCreateSystemMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Name: "cf", Image: "ppiper/cf-cli"},
},
},
}
return theMetaData

View File

@ -111,8 +111,9 @@ func addAbapEnvironmentPullGitRepoFlags(cmd *cobra.Command, stepConfig *abapEnvi
func abapEnvironmentPullGitRepoMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "abapEnvironmentPullGitRepo",
Aliases: []config.Alias{},
Name: "abapEnvironmentPullGitRepo",
Aliases: []config.Alias{},
Description: "Pulls a git repository to a SAP Cloud Platform ABAP Environment system",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -219,6 +220,9 @@ func abapEnvironmentPullGitRepoMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Name: "cf", Image: "ppiper/cf-cli"},
},
},
}
return theMetaData

View File

@ -112,8 +112,9 @@ func addAbapEnvironmentRunATCCheckFlags(cmd *cobra.Command, stepConfig *abapEnvi
func abapEnvironmentRunATCCheckMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "abapEnvironmentRunATCCheck",
Aliases: []config.Alias{},
Name: "abapEnvironmentRunATCCheck",
Aliases: []config.Alias{},
Description: "Runs an ATC Check",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -212,6 +213,9 @@ func abapEnvironmentRunATCCheckMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Name: "cf", Image: "ppiper/cf-cli"},
},
},
}
return theMetaData

View File

@ -219,8 +219,9 @@ func addArtifactPrepareVersionFlags(cmd *cobra.Command, stepConfig *artifactPrep
func artifactPrepareVersionMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "artifactPrepareVersion",
Aliases: []config.Alias{{Name: "artifactSetVersion", Deprecated: false}, {Name: "setVersion", Deprecated: true}},
Name: "artifactPrepareVersion",
Aliases: []config.Alias{{Name: "artifactSetVersion", Deprecated: false}, {Name: "setVersion", Deprecated: true}},
Description: "Prepares and potentially updates the artifact's version before building the artifact.",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -395,6 +396,23 @@ func artifactPrepareVersionMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Image: "maven:3.6-jdk-8", Conditions: []config.Condition{{ConditionRef: "strings-equal", Params: []config.Param{{Name: "buildTool", Value: "maven"}}}}},
},
Outputs: config.StepOutputs{
Resources: []config.StepResources{
{
Name: "commonPipelineEnvironment",
Type: "piperEnvironment",
Parameters: []map[string]interface{}{
{"Name": "artifactVersion"},
{"Name": "originalArtifactVersion"},
{"Name": "git/commitId"},
{"Name": "git/commitMessage"},
},
},
},
},
},
}
return theMetaData

View File

@ -265,8 +265,9 @@ func addCheckmarxExecuteScanFlags(cmd *cobra.Command, stepConfig *checkmarxExecu
func checkmarxExecuteScanMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "checkmarxExecuteScan",
Aliases: []config.Alias{},
Name: "checkmarxExecuteScan",
Aliases: []config.Alias{},
Description: "Checkmarx is the recommended tool for security scans of JavaScript, iOS, Swift and Ruby code.",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -481,6 +482,17 @@ func checkmarxExecuteScanMetadata() config.StepData {
},
},
},
Outputs: config.StepOutputs{
Resources: []config.StepResources{
{
Name: "influx",
Type: "influx",
Parameters: []map[string]interface{}{
{"Name": "checkmarx_data"}, {"fields": []map[string]string{{"name": "high_issues"}, {"name": "high_not_false_positive"}, {"name": "high_not_exploitable"}, {"name": "high_confirmed"}, {"name": "high_urgent"}, {"name": "high_proposed_not_exploitable"}, {"name": "high_to_verify"}, {"name": "medium_issues"}, {"name": "medium_not_false_positive"}, {"name": "medium_not_exploitable"}, {"name": "medium_confirmed"}, {"name": "medium_urgent"}, {"name": "medium_proposed_not_exploitable"}, {"name": "medium_to_verify"}, {"name": "low_issues"}, {"name": "low_not_false_positive"}, {"name": "low_not_exploitable"}, {"name": "low_confirmed"}, {"name": "low_urgent"}, {"name": "low_proposed_not_exploitable"}, {"name": "low_to_verify"}, {"name": "information_issues"}, {"name": "information_not_false_positive"}, {"name": "information_not_exploitable"}, {"name": "information_confirmed"}, {"name": "information_urgent"}, {"name": "information_proposed_not_exploitable"}, {"name": "information_to_verify"}, {"name": "initiator_name"}, {"name": "owner"}, {"name": "scan_id"}, {"name": "project_id"}, {"name": "projectName"}, {"name": "team"}, {"name": "team_full_path_on_report_date"}, {"name": "scan_start"}, {"name": "scan_time"}, {"name": "lines_of_code_scanned"}, {"name": "files_scanned"}, {"name": "checkmarx_version"}, {"name": "scan_type"}, {"name": "preset"}, {"name": "deep_link"}, {"name": "report_creation_time"}}},
},
},
},
},
},
}
return theMetaData

View File

@ -105,8 +105,9 @@ func addCloudFoundryCreateServiceKeyFlags(cmd *cobra.Command, stepConfig *cloudF
func cloudFoundryCreateServiceKeyMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "cloudFoundryCreateServiceKey",
Aliases: []config.Alias{},
Name: "cloudFoundryCreateServiceKey",
Aliases: []config.Alias{},
Description: "cloudFoundryCreateServiceKey",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -201,6 +202,9 @@ func cloudFoundryCreateServiceKeyMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Name: "cf", Image: "ppiper/cf-cli"},
},
},
}
return theMetaData

View File

@ -121,8 +121,9 @@ func addCloudFoundryCreateServiceFlags(cmd *cobra.Command, stepConfig *cloudFoun
func cloudFoundryCreateServiceMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "cloudFoundryCreateService",
Aliases: []config.Alias{},
Name: "cloudFoundryCreateService",
Aliases: []config.Alias{},
Description: "Creates one or multiple Services in Cloud Foundry",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -265,6 +266,9 @@ func cloudFoundryCreateServiceMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Name: "cf", Image: "ppiper/cf-cli"},
},
},
}
return theMetaData

View File

@ -99,8 +99,9 @@ func addCloudFoundryCreateSpaceFlags(cmd *cobra.Command, stepConfig *cloudFoundr
func cloudFoundryCreateSpaceMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "cloudFoundryCreateSpace",
Aliases: []config.Alias{},
Name: "cloudFoundryCreateSpace",
Aliases: []config.Alias{},
Description: "Creates a user defined space in Cloud Foundry",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -159,6 +160,9 @@ func cloudFoundryCreateSpaceMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Name: "cf", Image: "ppiper/cf-cli"},
},
},
}
return theMetaData

View File

@ -102,8 +102,9 @@ func addCloudFoundryDeleteServiceFlags(cmd *cobra.Command, stepConfig *cloudFoun
func cloudFoundryDeleteServiceMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "cloudFoundryDeleteService",
Aliases: []config.Alias{},
Name: "cloudFoundryDeleteService",
Aliases: []config.Alias{},
Description: "DeleteCloudFoundryService",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -190,6 +191,9 @@ func cloudFoundryDeleteServiceMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Name: "cf", Image: "ppiper/cf-cli", WorkingDir: "/home/piper"},
},
},
}
return theMetaData

View File

@ -99,8 +99,9 @@ func addCloudFoundryDeleteSpaceFlags(cmd *cobra.Command, stepConfig *cloudFoundr
func cloudFoundryDeleteSpaceMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "cloudFoundryDeleteSpace",
Aliases: []config.Alias{},
Name: "cloudFoundryDeleteSpace",
Aliases: []config.Alias{},
Description: "Deletes a space in Cloud Foundry",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -159,6 +160,9 @@ func cloudFoundryDeleteSpaceMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Name: "cf", Image: "ppiper/cf-cli"},
},
},
}
return theMetaData

View File

@ -194,8 +194,9 @@ func addCloudFoundryDeployFlags(cmd *cobra.Command, stepConfig *cloudFoundryDepl
func cloudFoundryDeployMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "cloudFoundryDeploy",
Aliases: []config.Alias{},
Name: "cloudFoundryDeploy",
Aliases: []config.Alias{},
Description: "Deploys an application to Cloud Foundry",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -461,6 +462,20 @@ func cloudFoundryDeployMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Name: "cfDeploy", Image: "ppiper/cf-cli"},
},
Outputs: config.StepOutputs{
Resources: []config.StepResources{
{
Name: "influx",
Type: "influx",
Parameters: []map[string]interface{}{
{"Name": "deployment_data"}, {"fields": []map[string]string{{"name": "artifactUrl"}, {"name": "deployTime"}, {"name": "jobTrigger"}}}, {"tags": []map[string]string{{"name": "artifactVersion"}, {"name": "deployUser"}, {"name": "deployResult"}, {"name": "cfApiEndpoint"}, {"name": "cfOrg"}, {"name": "cfSpace"}}},
},
},
},
},
},
}
return theMetaData

View File

@ -92,8 +92,9 @@ func addContainerSaveImageFlags(cmd *cobra.Command, stepConfig *containerSaveIma
func containerSaveImageMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "containerSaveImage",
Aliases: []config.Alias{},
Name: "containerSaveImage",
Aliases: []config.Alias{},
Description: "Saves a container image as a tar file",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{

View File

@ -116,8 +116,9 @@ func addDetectExecuteScanFlags(cmd *cobra.Command, stepConfig *detectExecuteScan
func detectExecuteScanMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "detectExecuteScan",
Aliases: []config.Alias{},
Name: "detectExecuteScan",
Aliases: []config.Alias{},
Description: "Executes Synopsys Detect scan",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -260,6 +261,9 @@ func detectExecuteScanMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Name: "openjdk", Image: "openjdk:11", WorkingDir: "/root", Options: []config.Option{{Name: "-u", Value: "0"}}},
},
},
}
return theMetaData

View File

@ -248,8 +248,9 @@ func addFortifyExecuteScanFlags(cmd *cobra.Command, stepConfig *fortifyExecuteSc
func fortifyExecuteScanMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "fortifyExecuteScan",
Aliases: []config.Alias{},
Name: "fortifyExecuteScan",
Aliases: []config.Alias{},
Description: "This step executes a Fortify scan on the specified project to perform static code analysis and check the source code for security flaws.",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -700,6 +701,20 @@ func fortifyExecuteScanMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{},
},
Outputs: config.StepOutputs{
Resources: []config.StepResources{
{
Name: "influx",
Type: "influx",
Parameters: []map[string]interface{}{
{"Name": "fortify_data"}, {"fields": []map[string]string{{"name": "projectName"}, {"name": "projectVersion"}, {"name": "violations"}, {"name": "corporateTotal"}, {"name": "corporateAudited"}, {"name": "auditAllTotal"}, {"name": "auditAllAudited"}, {"name": "spotChecksTotal"}, {"name": "spotChecksAudited"}, {"name": "spotChecksGap"}, {"name": "suspicious"}, {"name": "exploitable"}, {"name": "suppressed"}}},
},
},
},
},
},
}
return theMetaData

View File

@ -97,8 +97,9 @@ func addGctsCloneRepositoryFlags(cmd *cobra.Command, stepConfig *gctsCloneReposi
func gctsCloneRepositoryMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "gctsCloneRepository",
Aliases: []config.Alias{},
Name: "gctsCloneRepository",
Aliases: []config.Alias{},
Description: "Clones a Git repository",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{

View File

@ -105,8 +105,9 @@ func addGctsCreateRepositoryFlags(cmd *cobra.Command, stepConfig *gctsCreateRepo
func gctsCreateRepositoryMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "gctsCreateRepository",
Aliases: []config.Alias{},
Name: "gctsCreateRepository",
Aliases: []config.Alias{},
Description: "Creates a Git repository on an ABAP system",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{

View File

@ -99,8 +99,9 @@ func addGctsDeployFlags(cmd *cobra.Command, stepConfig *gctsDeployOptions) {
func gctsDeployMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "gctsDeploy",
Aliases: []config.Alias{},
Name: "gctsDeploy",
Aliases: []config.Alias{},
Description: "Pulls a commit from the remote Git repository to a local repository",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{

View File

@ -97,8 +97,9 @@ func addGctsExecuteABAPUnitTestsFlags(cmd *cobra.Command, stepConfig *gctsExecut
func gctsExecuteABAPUnitTestsMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "gctsExecuteABAPUnitTests",
Aliases: []config.Alias{},
Name: "gctsExecuteABAPUnitTests",
Aliases: []config.Alias{},
Description: "Runs ABAP unit tests for all packages of the specified repository",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{

View File

@ -104,8 +104,9 @@ func addGctsRollbackFlags(cmd *cobra.Command, stepConfig *gctsRollbackOptions) {
func gctsRollbackMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "gctsRollback",
Aliases: []config.Alias{},
Name: "gctsRollback",
Aliases: []config.Alias{},
Description: "Perfoms roll back of one (default) or several commit(s)",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{

View File

@ -104,8 +104,9 @@ func addGithubCheckBranchProtectionFlags(cmd *cobra.Command, stepConfig *githubC
func githubCheckBranchProtectionMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "githubCheckBranchProtection",
Aliases: []config.Alias{},
Name: "githubCheckBranchProtection",
Aliases: []config.Alias{},
Description: "Check branch protection of a GitHub branch",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{

View File

@ -114,8 +114,9 @@ func addGithubCreatePullRequestFlags(cmd *cobra.Command, stepConfig *githubCreat
func githubCreatePullRequestMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "githubCreatePullRequest",
Aliases: []config.Alias{},
Name: "githubCreatePullRequest",
Aliases: []config.Alias{},
Description: "Create a pull request on GitHub",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{

View File

@ -127,8 +127,9 @@ func addGithubPublishReleaseFlags(cmd *cobra.Command, stepConfig *githubPublishR
func githubPublishReleaseMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "githubPublishRelease",
Aliases: []config.Alias{},
Name: "githubPublishRelease",
Aliases: []config.Alias{},
Description: "Publish a release in GitHub",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{

View File

@ -115,8 +115,9 @@ func addGithubSetCommitStatusFlags(cmd *cobra.Command, stepConfig *githubSetComm
func githubSetCommitStatusMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "githubSetCommitStatus",
Aliases: []config.Alias{},
Name: "githubSetCommitStatus",
Aliases: []config.Alias{},
Description: "Set a status of a certain commit.",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{

View File

@ -122,8 +122,9 @@ func addGitopsUpdateDeploymentFlags(cmd *cobra.Command, stepConfig *gitopsUpdate
func gitopsUpdateDeploymentMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "gitopsUpdateDeployment",
Aliases: []config.Alias{},
Name: "gitopsUpdateDeployment",
Aliases: []config.Alias{},
Description: "Updates Kubernetes Deployment Manifest in an Infrastructure Git Repository",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -256,6 +257,10 @@ func gitopsUpdateDeploymentMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Image: "dtzar/helm-kubectl:3.3.4", WorkingDir: "/config", Options: []config.Option{{Name: "-u", Value: "0"}}, Conditions: []config.Condition{{ConditionRef: "strings-equal", Params: []config.Param{{Name: "tool", Value: "helm"}}}}},
{Image: "dtzar/helm-kubectl:2.12.1", WorkingDir: "/config", Options: []config.Option{{Name: "-u", Value: "0"}}, Conditions: []config.Condition{{ConditionRef: "strings-equal", Params: []config.Param{{Name: "tool", Value: "kubectl"}}}}},
},
},
}
return theMetaData

View File

@ -95,8 +95,9 @@ func addHadolintExecuteFlags(cmd *cobra.Command, stepConfig *hadolintExecuteOpti
func hadolintExecuteMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "hadolintExecute",
Aliases: []config.Alias{},
Name: "hadolintExecute",
Aliases: []config.Alias{},
Description: "Executes the Haskell Dockerfile Linter which is a smarter Dockerfile linter that helps you build [best practice](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/) Docker images.",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -163,6 +164,9 @@ func hadolintExecuteMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Name: "hadolint", Image: "hadolint/hadolint:latest-debian"},
},
},
}
return theMetaData

View File

@ -90,8 +90,9 @@ func addJsonApplyPatchFlags(cmd *cobra.Command, stepConfig *jsonApplyPatchOption
func jsonApplyPatchMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "jsonApplyPatch",
Aliases: []config.Alias{},
Name: "jsonApplyPatch",
Aliases: []config.Alias{},
Description: "Patches a json with a patch file",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{

View File

@ -135,8 +135,9 @@ func addKanikoExecuteFlags(cmd *cobra.Command, stepConfig *kanikoExecuteOptions)
func kanikoExecuteMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "kanikoExecute",
Aliases: []config.Alias{},
Name: "kanikoExecute",
Aliases: []config.Alias{},
Description: "Executes a [Kaniko](https://github.com/GoogleContainerTools/kaniko) build for creating a Docker container.",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -244,6 +245,21 @@ func kanikoExecuteMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Image: "gcr.io/kaniko-project/executor:debug", Options: []config.Option{{Name: "-u", Value: "0"}, {Name: "--entrypoint", Value: "''"}}},
},
Outputs: config.StepOutputs{
Resources: []config.StepResources{
{
Name: "commonPipelineEnvironment",
Type: "piperEnvironment",
Parameters: []map[string]interface{}{
{"Name": "container/registryUrl"},
{"Name": "container/imageNameTag"},
},
},
},
},
},
}
return theMetaData

View File

@ -99,8 +99,9 @@ func addKarmaExecuteTestsFlags(cmd *cobra.Command, stepConfig *karmaExecuteTests
func karmaExecuteTestsMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "karmaExecuteTests",
Aliases: []config.Alias{},
Name: "karmaExecuteTests",
Aliases: []config.Alias{},
Description: "Executes the Karma test runner",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -131,6 +132,12 @@ func karmaExecuteTestsMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Name: "karma", Image: "node:lts-stretch", EnvVars: []config.EnvVar{{Name: "no_proxy", Value: "localhost,selenium,$no_proxy"}, {Name: "NO_PROXY", Value: "localhost,selenium,$NO_PROXY"}}, WorkingDir: "/home/node"},
},
Sidecars: []config.Container{
{Name: "selenium", Image: "selenium/standalone-chrome", EnvVars: []config.EnvVar{{Name: "NO_PROXY", Value: "localhost,karma,$NO_PROXY"}, {Name: "no_proxy", Value: "localhost,selenium,$no_proxy"}}},
},
},
}
return theMetaData

View File

@ -148,8 +148,9 @@ func addKubernetesDeployFlags(cmd *cobra.Command, stepConfig *kubernetesDeployOp
func kubernetesDeployMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "kubernetesDeploy",
Aliases: []config.Alias{{Name: "deployToKubernetes", Deprecated: true}},
Name: "kubernetesDeploy",
Aliases: []config.Alias{{Name: "deployToKubernetes", Deprecated: true}},
Description: "Deployment to Kubernetes test or production namespace within the specified Kubernetes cluster.",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -362,6 +363,11 @@ func kubernetesDeployMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Image: "dtzar/helm-kubectl:3.1.2", WorkingDir: "/config", Options: []config.Option{{Name: "-u", Value: "0"}}, Conditions: []config.Condition{{ConditionRef: "strings-equal", Params: []config.Param{{Name: "deployTool", Value: "helm3"}}}}},
{Image: "dtzar/helm-kubectl:2.12.1", WorkingDir: "/config", Options: []config.Option{{Name: "-u", Value: "0"}}, Conditions: []config.Condition{{ConditionRef: "strings-equal", Params: []config.Param{{Name: "deployTool", Value: "helm"}}}}},
{Image: "dtzar/helm-kubectl:2.12.1", WorkingDir: "/config", Options: []config.Option{{Name: "-u", Value: "0"}}, Conditions: []config.Condition{{ConditionRef: "strings-equal", Params: []config.Param{{Name: "deployTool", Value: "kubectl"}}}}},
},
},
}
return theMetaData

View File

@ -96,8 +96,9 @@ func addMalwareExecuteScanFlags(cmd *cobra.Command, stepConfig *malwareExecuteSc
func malwareExecuteScanMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "malwareExecuteScan",
Aliases: []config.Alias{},
Name: "malwareExecuteScan",
Aliases: []config.Alias{},
Description: "Performs a malware scan",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{

View File

@ -96,8 +96,9 @@ func addMavenBuildFlags(cmd *cobra.Command, stepConfig *mavenBuildOptions) {
func mavenBuildMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "mavenBuild",
Aliases: []config.Alias{{Name: "mavenExecute", Deprecated: false}},
Name: "mavenBuild",
Aliases: []config.Alias{{Name: "mavenExecute", Deprecated: false}},
Description: "This step will install the maven project into the local maven repository.",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -160,6 +161,9 @@ func mavenBuildMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Name: "mvn", Image: "maven:3.6-jdk-8"},
},
},
}
return theMetaData

View File

@ -95,8 +95,9 @@ func addMavenExecuteIntegrationFlags(cmd *cobra.Command, stepConfig *mavenExecut
func mavenExecuteIntegrationMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "mavenExecuteIntegration",
Aliases: []config.Alias{{Name: "mavenExecute", Deprecated: false}},
Name: "mavenExecuteIntegration",
Aliases: []config.Alias{{Name: "mavenExecute", Deprecated: false}},
Description: "This step will execute backend integration tests via the Jacoco Maven-plugin.",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -159,6 +160,12 @@ func mavenExecuteIntegrationMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Name: "mvn", Image: "maven:3.6-jdk-8"},
},
Sidecars: []config.Container{
{},
},
},
}
return theMetaData

View File

@ -113,8 +113,9 @@ func addMavenExecuteStaticCodeChecksFlags(cmd *cobra.Command, stepConfig *mavenE
func mavenExecuteStaticCodeChecksMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "mavenExecuteStaticCodeChecks",
Aliases: []config.Alias{{Name: "mavenExecute", Deprecated: false}},
Name: "mavenExecuteStaticCodeChecks",
Aliases: []config.Alias{{Name: "mavenExecute", Deprecated: false}},
Description: "Execute static code checks for Maven based projects. The plugins SpotBugs and PMD are used.",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -225,6 +226,9 @@ func mavenExecuteStaticCodeChecksMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Name: "mvn", Image: "maven:3.6-jdk-8"},
},
},
}
return theMetaData

View File

@ -99,8 +99,9 @@ func addMavenExecuteFlags(cmd *cobra.Command, stepConfig *mavenExecuteOptions) {
func mavenExecuteMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "mavenExecute",
Aliases: []config.Alias{},
Name: "mavenExecute",
Aliases: []config.Alias{},
Description: "This step allows to run maven commands",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -179,6 +180,9 @@ func mavenExecuteMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Name: "mvn", Image: "maven:3.6-jdk-8"},
},
},
}
return theMetaData

64
cmd/metadata_generated.go Normal file
View File

@ -0,0 +1,64 @@
// Code generated by piper's step-generator. DO NOT EDIT.
package cmd
import "github.com/SAP/jenkins-library/pkg/config"
// GetStepMetadata return a map with all the step metadata mapped to their stepName
func GetAllStepMetadata() map[string]config.StepData {
return map[string]config.StepData{
"abapAddonAssemblyKitCheckCVs": abapAddonAssemblyKitCheckCVsMetadata(),
"abapAddonAssemblyKitCheckPV": abapAddonAssemblyKitCheckPVMetadata(),
"abapAddonAssemblyKitCreateTargetVector": abapAddonAssemblyKitCreateTargetVectorMetadata(),
"abapAddonAssemblyKitPublishTargetVector": abapAddonAssemblyKitPublishTargetVectorMetadata(),
"abapAddonAssemblyKitRegisterPackages": abapAddonAssemblyKitRegisterPackagesMetadata(),
"abapAddonAssemblyKitReleasePackages": abapAddonAssemblyKitReleasePackagesMetadata(),
"abapAddonAssemblyKitReserveNextPackages": abapAddonAssemblyKitReserveNextPackagesMetadata(),
"abapEnvironmentAssemblePackages": abapEnvironmentAssemblePackagesMetadata(),
"abapEnvironmentCheckoutBranch": abapEnvironmentCheckoutBranchMetadata(),
"abapEnvironmentCloneGitRepo": abapEnvironmentCloneGitRepoMetadata(),
"abapEnvironmentCreateSystem": abapEnvironmentCreateSystemMetadata(),
"abapEnvironmentPullGitRepo": abapEnvironmentPullGitRepoMetadata(),
"abapEnvironmentRunATCCheck": abapEnvironmentRunATCCheckMetadata(),
"checkmarxExecuteScan": checkmarxExecuteScanMetadata(),
"cloudFoundryCreateService": cloudFoundryCreateServiceMetadata(),
"cloudFoundryCreateServiceKey": cloudFoundryCreateServiceKeyMetadata(),
"cloudFoundryCreateSpace": cloudFoundryCreateSpaceMetadata(),
"cloudFoundryDeleteService": cloudFoundryDeleteServiceMetadata(),
"cloudFoundryDeleteSpace": cloudFoundryDeleteSpaceMetadata(),
"cloudFoundryDeploy": cloudFoundryDeployMetadata(),
"detectExecuteScan": detectExecuteScanMetadata(),
"fortifyExecuteScan": fortifyExecuteScanMetadata(),
"gctsCloneRepository": gctsCloneRepositoryMetadata(),
"gctsCreateRepository": gctsCreateRepositoryMetadata(),
"gctsDeploy": gctsDeployMetadata(),
"gctsExecuteABAPUnitTests": gctsExecuteABAPUnitTestsMetadata(),
"gctsRollback": gctsRollbackMetadata(),
"githubCheckBranchProtection": githubCheckBranchProtectionMetadata(),
"githubCreatePullRequest": githubCreatePullRequestMetadata(),
"githubPublishRelease": githubPublishReleaseMetadata(),
"githubSetCommitStatus": githubSetCommitStatusMetadata(),
"gitopsUpdateDeployment": gitopsUpdateDeploymentMetadata(),
"hadolintExecute": hadolintExecuteMetadata(),
"jsonApplyPatch": jsonApplyPatchMetadata(),
"kanikoExecute": kanikoExecuteMetadata(),
"karmaExecuteTests": karmaExecuteTestsMetadata(),
"kubernetesDeploy": kubernetesDeployMetadata(),
"malwareExecuteScan": malwareExecuteScanMetadata(),
"mavenBuild": mavenBuildMetadata(),
"mavenExecute": mavenExecuteMetadata(),
"mavenExecuteIntegration": mavenExecuteIntegrationMetadata(),
"mavenExecuteStaticCodeChecks": mavenExecuteStaticCodeChecksMetadata(),
"mtaBuild": mtaBuildMetadata(),
"nexusUpload": nexusUploadMetadata(),
"npmExecuteLint": npmExecuteLintMetadata(),
"npmExecuteScripts": npmExecuteScriptsMetadata(),
"protecodeExecuteScan": protecodeExecuteScanMetadata(),
"containerSaveImage": containerSaveImageMetadata(),
"sonarExecuteScan": sonarExecuteScanMetadata(),
"vaultRotateSecretId": vaultRotateSecretIdMetadata(),
"artifactPrepareVersion": artifactPrepareVersionMetadata(),
"whitesourceExecuteScan": whitesourceExecuteScanMetadata(),
"xsDeploy": xsDeployMetadata(),
}
}

View File

@ -134,8 +134,9 @@ func addMtaBuildFlags(cmd *cobra.Command, stepConfig *mtaBuildOptions) {
func mtaBuildMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "mtaBuild",
Aliases: []config.Alias{},
Name: "mtaBuild",
Aliases: []config.Alias{},
Description: "Performs an mta build",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -238,6 +239,21 @@ func mtaBuildMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Image: "devxci/mbtci:1.0.16.1", Conditions: []config.Condition{{ConditionRef: "strings-equal", Params: []config.Param{{Name: "mtaBuildTool", Value: "cloudMbt"}}}}},
{Image: "ppiper/mta-archive-builder:v1", Conditions: []config.Condition{{ConditionRef: "strings-equal", Params: []config.Param{{Name: "mtaBuildTool", Value: "classic"}}}}},
},
Outputs: config.StepOutputs{
Resources: []config.StepResources{
{
Name: "commonPipelineEnvironment",
Type: "piperEnvironment",
Parameters: []map[string]interface{}{
{"Name": "mtarFilePath"},
},
},
},
},
},
}
return theMetaData

View File

@ -120,8 +120,9 @@ func addNexusUploadFlags(cmd *cobra.Command, stepConfig *nexusUploadOptions) {
func nexusUploadMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "nexusUpload",
Aliases: []config.Alias{{Name: "mavenExecute", Deprecated: false}},
Name: "nexusUpload",
Aliases: []config.Alias{{Name: "mavenExecute", Deprecated: false}},
Description: "Upload artifacts to Nexus Repository Manager",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -220,6 +221,9 @@ func nexusUploadMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Name: "mvn-npm", Image: "devxci/mbtci:1.0.16.1"},
},
},
}
return theMetaData

View File

@ -85,8 +85,9 @@ func addNpmExecuteLintFlags(cmd *cobra.Command, stepConfig *npmExecuteLintOption
func npmExecuteLintMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "npmExecuteLint",
Aliases: []config.Alias{{Name: "executeNpm", Deprecated: false}},
Name: "npmExecuteLint",
Aliases: []config.Alias{{Name: "executeNpm", Deprecated: false}},
Description: "Execute ci-lint script on all npm packages in a project or execute default linting",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -109,6 +110,9 @@ func npmExecuteLintMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Name: "node", Image: "node:12-buster"},
},
},
}
return theMetaData

View File

@ -94,8 +94,9 @@ func addNpmExecuteScriptsFlags(cmd *cobra.Command, stepConfig *npmExecuteScripts
func npmExecuteScriptsMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "npmExecuteScripts",
Aliases: []config.Alias{{Name: "executeNpm", Deprecated: false}},
Name: "npmExecuteScripts",
Aliases: []config.Alias{{Name: "executeNpm", Deprecated: false}},
Description: "Execute npm run scripts on all npm packages in a project",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -158,6 +159,9 @@ func npmExecuteScriptsMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Name: "node", Image: "node:12-buster-slim"},
},
},
}
return theMetaData

View File

@ -173,8 +173,9 @@ func addProtecodeExecuteScanFlags(cmd *cobra.Command, stepConfig *protecodeExecu
func protecodeExecuteScanMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "protecodeExecuteScan",
Aliases: []config.Alias{},
Name: "protecodeExecuteScan",
Aliases: []config.Alias{},
Description: "Protecode is an Open Source Vulnerability Scanner that is capable of scanning binaries. It can be used to scan docker images but is supports many other programming languages especially those of the C family.",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -363,6 +364,17 @@ func protecodeExecuteScanMetadata() config.StepData {
},
},
},
Outputs: config.StepOutputs{
Resources: []config.StepResources{
{
Name: "influx",
Type: "influx",
Parameters: []map[string]interface{}{
{"Name": "protecode_data"}, {"fields": []map[string]string{{"name": "historical_vulnerabilities"}, {"name": "triaged_vulnerabilities"}, {"name": "excluded_vulnerabilities"}, {"name": "minor_vulnerabilities"}, {"name": "major_vulnerabilities"}, {"name": "vulnerabilities"}}},
},
},
},
},
},
}
return theMetaData

View File

@ -169,8 +169,9 @@ func addSonarExecuteScanFlags(cmd *cobra.Command, stepConfig *sonarExecuteScanOp
func sonarExecuteScanMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "sonarExecuteScan",
Aliases: []config.Alias{},
Name: "sonarExecuteScan",
Aliases: []config.Alias{},
Description: "Executes the Sonar scanner",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -408,6 +409,20 @@ func sonarExecuteScanMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Name: "sonar", Image: "sonarsource/sonar-scanner-cli:4.5"},
},
Outputs: config.StepOutputs{
Resources: []config.StepResources{
{
Name: "influx",
Type: "influx",
Parameters: []map[string]interface{}{
{"Name": "step_data"}, {"fields": []map[string]string{{"name": "sonar"}}},
},
},
},
},
},
}
return theMetaData

View File

@ -103,8 +103,9 @@ func addVaultRotateSecretIdFlags(cmd *cobra.Command, stepConfig *vaultRotateSecr
func vaultRotateSecretIdMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "vaultRotateSecretId",
Aliases: []config.Alias{},
Name: "vaultRotateSecretId",
Aliases: []config.Alias{},
Description: "Rotate vault AppRole Secret ID",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{

View File

@ -208,8 +208,9 @@ func addWhitesourceExecuteScanFlags(cmd *cobra.Command, stepConfig *whitesourceE
func whitesourceExecuteScanMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "whitesourceExecuteScan",
Aliases: []config.Alias{},
Name: "whitesourceExecuteScan",
Aliases: []config.Alias{},
Description: "BETA",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -535,6 +536,23 @@ func whitesourceExecuteScanMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Image: "maven:3.5-jdk-8", WorkingDir: "/home/java", Conditions: []config.Condition{{ConditionRef: "strings-equal", Params: []config.Param{{Name: "scanType", Value: "maven"}}}}},
{Image: "node:lts-stretch", WorkingDir: "/home/node", Conditions: []config.Condition{{ConditionRef: "strings-equal", Params: []config.Param{{Name: "scanType", Value: "npm"}}}}},
{Image: "hseeberger/scala-sbt:8u181_2.12.8_1.2.8", WorkingDir: "/home/scala", Conditions: []config.Condition{{ConditionRef: "strings-equal", Params: []config.Param{{Name: "scanType", Value: "sbt"}}}}},
{Image: "buildpack-deps:stretch-curl", WorkingDir: "/home/dub", Conditions: []config.Condition{{ConditionRef: "strings-equal", Params: []config.Param{{Name: "scanType", Value: "dub"}}}}},
},
Outputs: config.StepOutputs{
Resources: []config.StepResources{
{
Name: "commonPipelineEnvironment",
Type: "piperEnvironment",
Parameters: []map[string]interface{}{
{"Name": "custom/whitesourceProjectNames"},
},
},
},
},
},
}
return theMetaData

View File

@ -146,8 +146,9 @@ func addXsDeployFlags(cmd *cobra.Command, stepConfig *xsDeployOptions) {
func xsDeployMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "xsDeploy",
Aliases: []config.Alias{},
Name: "xsDeploy",
Aliases: []config.Alias{},
Description: "Performs xs deployment",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -280,6 +281,20 @@ func xsDeployMetadata() config.StepData {
},
},
},
Containers: []config.Container{
{Name: "xs", Image: "ppiper/xs-cli"},
},
Outputs: config.StepOutputs{
Resources: []config.StepResources{
{
Name: "commonPipelineEnvironment",
Type: "piperEnvironment",
Parameters: []map[string]interface{}{
{"Name": "operationId"},
},
},
},
},
},
}
return theMetaData

View File

@ -31,6 +31,9 @@ type stepInfo struct {
StepFunc string
StepName string
StepSecrets []string
Containers []config.Container
Sidecars []config.Container
Outputs config.StepOutputs
}
//StepGoTemplate ...
@ -164,6 +167,7 @@ func {{ .StepName }}Metadata() config.StepData {
Metadata: config.StepMetadata{
Name: "{{ .StepName }}",
Aliases: []config.Alias{{ "{" }}{{ range $notused, $alias := .StepAliases }}{{ "{" }}Name: "{{ $alias.Name }}", Deprecated: {{ $alias.Deprecated }}{{ "}" }},{{ end }}{{ "}" }},
Description: "{{ .Short }}",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -179,6 +183,49 @@ func {{ .StepName }}Metadata() config.StepData {
},{{ end }}
},
},
{{ if .Containers -}}
Containers: []config.Container{
{{- range $container := .Containers }}
{
{{- if $container.Name -}} Name: "{{$container.Name}}",{{- end }}
{{- if $container.Image -}} Image: "{{$container.Image}}",{{- end }}
{{- if $container.EnvVars -}} EnvVars: []config.EnvVar{ {{- range $i, $env := $container.EnvVars }} {Name: "{{$env.Name}}", Value: "{{$env.Value}}"}, {{ end -}} },{{- end }}
{{- if $container.WorkingDir -}} WorkingDir: "{{$container.WorkingDir}}",{{- end }}
{{- if $container.Options -}} Options: []config.Option{ {{- range $i, $option := $container.Options }} {Name: "{{$option.Name}}", Value: "{{$option.Value}}"}, {{ end -}} },{{ end }}
{{- if $container.Conditions -}} Conditions: []config.Condition{ {{- range $i, $cond := $container.Conditions }} {ConditionRef: "{{$cond.ConditionRef}}", Params: []config.Param{ {{- range $j, $p := $cond.Params}} { Name: "{{$p.Name}}", Value: "{{$p.Value}}" }, {{end -}} } }, {{ end -}} },{{ end }}
}, {{ end }}
},
{{ end -}}
{{ if .Sidecars -}}
Sidecars: []config.Container{
{{- range $container := .Sidecars }}
{
{{- if $container.Name -}} Name: "{{$container.Name}}", {{- end }}
{{- if $container.Image -}} Image: "{{$container.Image}}", {{- end }}
{{- if $container.EnvVars -}} EnvVars: []config.EnvVar{ {{- range $i, $env := $container.EnvVars }} {Name: "{{$env.Name}}", Value: "{{$env.Value}}"}, {{ end -}} }, {{- end }}
{{- if $container.WorkingDir -}} WorkingDir: "{{$container.WorkingDir}}", {{- end }}
{{- if $container.Options -}} Options: []config.Option{ {{- range $i, $option := $container.Options }} {Name: "{{$option.Name}}", Value: "{{$option.Value}}"}, {{ end -}} }, {{- end }}
{{- if $container.Conditions -}} Conditions: []config.Condition{ {{- range $i, $cond := $container.Conditions }} {ConditionRef: "{{$cond.ConditionRef}}", Params: []config.Param{ {{- range $j, $p := $cond.Params}} { Name: "{{$p.Name}}", Value: "{{$p.Value}}" }, {{end -}} } }, {{ end -}} }, {{- end }}
}, {{ end }}
},
{{ end -}}
{{- if .Outputs.Resources -}}
Outputs: config.StepOutputs{
Resources: []config.StepResources{
{{- range $res := .Outputs.Resources }}
{
{{ if $res.Name }}Name: "{{$res.Name}}", {{- end }}
{{ if $res.Type }}Type: "{{$res.Type}}", {{- end }}
{{ if $res.Parameters }}Parameters: []map[string]interface{}{ {{- end -}}
{{ range $i, $p := $res.Parameters }}
{{ if $p.name}}{"Name": "{{$p.name}}"},{{ end -}}
{{ if $p.fields}}{"fields": []map[string]string{ {{- range $j, $f := $p.fields}} {"name": "{{$f.name}}"}, {{end -}} } },{{ end -}}
{{ if $p.tags}}{"tags": []map[string]string{ {{- range $j, $t := $p.tags}} {"name": "{{$t.name}}"}, {{end -}} } },{{ end -}}
{{ end }}
{{ if $res.Parameters -}} }, {{- end }}
}, {{- end }}
},
}, {{- end }}
},
}
return theMetaData
@ -336,9 +383,26 @@ func TestRun{{.StepName | title}}(t *testing.T) {
}
`
const metadataGeneratedFileName = "metadata_generated.go"
const metadataGeneratedTemplate = `// Code generated by piper's step-generator. DO NOT EDIT.
package cmd
import "github.com/SAP/jenkins-library/pkg/config"
// GetStepMetadata return a map with all the step metadata mapped to their stepName
func GetAllStepMetadata() map[string]config.StepData {
return map[string]config.StepData{
{{range $stepName := .Steps }} "{{$stepName}}": {{$stepName}}Metadata(),
{{end}}
}
}
`
// ProcessMetaFiles generates step coding based on step configuration provided in yaml files
func ProcessMetaFiles(metadataFiles []string, targetDir string, stepHelperData StepHelperData) error {
allSteps := struct{ Steps []string }{}
for key := range metadataFiles {
var stepData config.StepData
@ -354,7 +418,9 @@ func ProcessMetaFiles(metadataFiles []string, targetDir string, stepHelperData S
err = stepData.ReadPipelineStepData(metadataFile)
checkError(err)
fmt.Printf("Step name: %v\n", stepData.Metadata.Name)
stepName := stepData.Metadata.Name
fmt.Printf("Step name: %v\n", stepName)
allSteps.Steps = append(allSteps.Steps, stepName)
osImport := false
osImport, err = setDefaultParameters(&stepData)
@ -364,27 +430,32 @@ func ProcessMetaFiles(metadataFiles []string, targetDir string, stepHelperData S
checkError(err)
step := stepTemplate(myStepInfo, "step", stepGoTemplate)
err = stepHelperData.WriteFile(filepath.Join(targetDir, fmt.Sprintf("%v_generated.go", stepData.Metadata.Name)), step, 0644)
err = stepHelperData.WriteFile(filepath.Join(targetDir, fmt.Sprintf("%v_generated.go", stepName)), step, 0644)
checkError(err)
test := stepTemplate(myStepInfo, "stepTest", stepTestGoTemplate)
err = stepHelperData.WriteFile(filepath.Join(targetDir, fmt.Sprintf("%v_generated_test.go", stepData.Metadata.Name)), test, 0644)
err = stepHelperData.WriteFile(filepath.Join(targetDir, fmt.Sprintf("%v_generated_test.go", stepName)), test, 0644)
checkError(err)
exists, _ := piperutils.FileExists(filepath.Join(targetDir, fmt.Sprintf("%v.go", stepData.Metadata.Name)))
exists, _ := piperutils.FileExists(filepath.Join(targetDir, fmt.Sprintf("%v.go", stepName)))
if !exists {
impl := stepImplementation(myStepInfo, "impl", stepGoImplementationTemplate)
err = stepHelperData.WriteFile(filepath.Join(targetDir, fmt.Sprintf("%v.go", stepData.Metadata.Name)), impl, 0644)
err = stepHelperData.WriteFile(filepath.Join(targetDir, fmt.Sprintf("%v.go", stepName)), impl, 0644)
checkError(err)
}
exists, _ = piperutils.FileExists(filepath.Join(targetDir, fmt.Sprintf("%v_test.go", stepData.Metadata.Name)))
exists, _ = piperutils.FileExists(filepath.Join(targetDir, fmt.Sprintf("%v_test.go", stepName)))
if !exists {
impl := stepImplementation(myStepInfo, "implTest", stepGoImplementationTestTemplate)
err = stepHelperData.WriteFile(filepath.Join(targetDir, fmt.Sprintf("%v_test.go", stepData.Metadata.Name)), impl, 0644)
err = stepHelperData.WriteFile(filepath.Join(targetDir, fmt.Sprintf("%v_test.go", stepName)), impl, 0644)
checkError(err)
}
}
// expose metadata functions
code := generateCode(allSteps, "metadata", metadataGeneratedTemplate, nil)
err := stepHelperData.WriteFile(filepath.Join(targetDir, metadataGeneratedFileName), code, 0644)
checkError(err)
return nil
}
@ -457,6 +528,9 @@ func getStepInfo(stepData *config.StepData, osImport bool, exportPrefix string)
OutputResources: oRes,
ExportPrefix: exportPrefix,
StepSecrets: getSecretFields(stepData),
Containers: stepData.Spec.Containers,
Sidecars: stepData.Spec.Sidecars,
Outputs: stepData.Spec.Outputs,
},
err
}
@ -577,12 +651,12 @@ func stepImplementation(myStepInfo stepInfo, templateName, goTemplate string) []
return generateCode(myStepInfo, templateName, goTemplate, funcMap)
}
func generateCode(myStepInfo stepInfo, templateName, goTemplate string, funcMap template.FuncMap) []byte {
func generateCode(dataObject interface{}, templateName, goTemplate string, funcMap template.FuncMap) []byte {
tmpl, err := template.New(templateName).Funcs(funcMap).Parse(goTemplate)
checkError(err)
var generatedCode bytes.Buffer
err = tmpl.Execute(&generatedCode, myStepInfo)
err = tmpl.Execute(&generatedCode, dataObject)
checkError(err)
return generatedCode.Bytes()

View File

@ -170,6 +170,7 @@ func testStepMetadata() config.StepData {
Metadata: config.StepMetadata{
Name: "testStep",
Aliases: []config.Alias{{Name: "testStepAlias", Deprecated: true},},
Description: "Test description",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -200,6 +201,27 @@ func testStepMetadata() config.StepData {
},
},
},
Outputs: config.StepOutputs{
Resources: []config.StepResources{
{
Name: "commonPipelineEnvironment",
Type: "piperEnvironment",
Parameters: []map[string]interface{}{
{"Name": "artifactVersion"},
{"Name": "git/commitId"},
{"Name": "git/branch"},
{"Name": "custom/customList"},
},
},
{
Name: "influxTest",
Type: "influx",
Parameters: []map[string]interface{}{
{"Name": "m1"},{"fields": []map[string]string{ {"name": "f1"}, } },{"tags": []map[string]string{ {"name": "t1"}, } },
},
},
},
},
},
}
return theMetaData

View File

@ -169,6 +169,7 @@ func testStepMetadata() config.StepData {
Metadata: config.StepMetadata{
Name: "testStep",
Aliases: []config.Alias{{Name: "testStepAlias", Deprecated: true},},
Description: "Test description",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
@ -199,6 +200,27 @@ func testStepMetadata() config.StepData {
},
},
},
Outputs: config.StepOutputs{
Resources: []config.StepResources{
{
Name: "commonPipelineEnvironment",
Type: "piperEnvironment",
Parameters: []map[string]interface{}{
{"Name": "artifactVersion"},
{"Name": "git/commitId"},
{"Name": "git/branch"},
{"Name": "custom/customList"},
},
},
{
Name: "influxTest",
Type: "influx",
Parameters: []map[string]interface{}{
{"Name": "m1"},{"fields": []map[string]string{ {"name": "f1"}, } },{"tags": []map[string]string{ {"name": "t1"}, } },
},
},
},
},
},
}
return theMetaData

View File

@ -541,8 +541,7 @@ spec:
- STAGES
- PARAMETERS
containers:
- image: "<<please bring your own fortify image>>"
workingDir: "/home/piper"
- image: ""
outputs:
resources:
- name: influx