github.com/jaylevin/jenkins-library@v1.230.4/cmd/whitesourceExecuteScan_generated.go (about) 1 // Code generated by piper's step-generator. DO NOT EDIT. 2 3 package cmd 4 5 import ( 6 "fmt" 7 "os" 8 "path/filepath" 9 "reflect" 10 "strings" 11 "time" 12 13 "github.com/SAP/jenkins-library/pkg/config" 14 "github.com/SAP/jenkins-library/pkg/gcs" 15 "github.com/SAP/jenkins-library/pkg/log" 16 "github.com/SAP/jenkins-library/pkg/piperenv" 17 "github.com/SAP/jenkins-library/pkg/splunk" 18 "github.com/SAP/jenkins-library/pkg/telemetry" 19 "github.com/SAP/jenkins-library/pkg/validation" 20 "github.com/bmatcuk/doublestar" 21 "github.com/spf13/cobra" 22 ) 23 24 type whitesourceExecuteScanOptions struct { 25 AgentDownloadURL string `json:"agentDownloadUrl,omitempty"` 26 AgentFileName string `json:"agentFileName,omitempty"` 27 AgentParameters []string `json:"agentParameters,omitempty"` 28 AgentURL string `json:"agentUrl,omitempty"` 29 AggregateVersionWideReport bool `json:"aggregateVersionWideReport,omitempty"` 30 BuildDescriptorExcludeList []string `json:"buildDescriptorExcludeList,omitempty"` 31 BuildDescriptorFile string `json:"buildDescriptorFile,omitempty"` 32 BuildTool string `json:"buildTool,omitempty"` 33 ConfigFilePath string `json:"configFilePath,omitempty"` 34 ContainerRegistryPassword string `json:"containerRegistryPassword,omitempty"` 35 ContainerRegistryUser string `json:"containerRegistryUser,omitempty"` 36 CreateProductFromPipeline bool `json:"createProductFromPipeline,omitempty"` 37 CustomScanVersion string `json:"customScanVersion,omitempty"` 38 CvssSeverityLimit string `json:"cvssSeverityLimit,omitempty"` 39 ScanPath string `json:"scanPath,omitempty"` 40 DockerConfigJSON string `json:"dockerConfigJSON,omitempty"` 41 EmailAddressesOfInitialProductAdmins []string `json:"emailAddressesOfInitialProductAdmins,omitempty"` 42 Excludes []string `json:"excludes,omitempty"` 43 Includes []string `json:"includes,omitempty"` 44 InstallCommand string `json:"installCommand,omitempty"` 45 JreDownloadURL string `json:"jreDownloadUrl,omitempty"` 46 LicensingVulnerabilities bool `json:"licensingVulnerabilities,omitempty"` 47 OrgToken string `json:"orgToken,omitempty"` 48 ProductName string `json:"productName,omitempty"` 49 ProductToken string `json:"productToken,omitempty"` 50 Version string `json:"version,omitempty"` 51 ProjectName string `json:"projectName,omitempty"` 52 ProjectToken string `json:"projectToken,omitempty"` 53 Reporting bool `json:"reporting,omitempty"` 54 ScanImage string `json:"scanImage,omitempty"` 55 ScanImageRegistryURL string `json:"scanImageRegistryUrl,omitempty"` 56 SecurityVulnerabilities bool `json:"securityVulnerabilities,omitempty"` 57 ServiceURL string `json:"serviceUrl,omitempty"` 58 Timeout int `json:"timeout,omitempty"` 59 UserToken string `json:"userToken,omitempty"` 60 VersioningModel string `json:"versioningModel,omitempty"` 61 VulnerabilityReportFormat string `json:"vulnerabilityReportFormat,omitempty" validate:"possible-values=xlsx json xml"` 62 VulnerabilityReportTitle string `json:"vulnerabilityReportTitle,omitempty"` 63 ProjectSettingsFile string `json:"projectSettingsFile,omitempty"` 64 GlobalSettingsFile string `json:"globalSettingsFile,omitempty"` 65 M2Path string `json:"m2Path,omitempty"` 66 InstallArtifacts bool `json:"installArtifacts,omitempty"` 67 DefaultNpmRegistry string `json:"defaultNpmRegistry,omitempty"` 68 GithubToken string `json:"githubToken,omitempty"` 69 CreateResultIssue bool `json:"createResultIssue,omitempty"` 70 GithubAPIURL string `json:"githubApiUrl,omitempty"` 71 Owner string `json:"owner,omitempty"` 72 Repository string `json:"repository,omitempty"` 73 Assignees []string `json:"assignees,omitempty"` 74 CustomTLSCertificateLinks []string `json:"customTlsCertificateLinks,omitempty"` 75 } 76 77 type whitesourceExecuteScanCommonPipelineEnvironment struct { 78 custom struct { 79 whitesourceProjectNames []string 80 } 81 } 82 83 func (p *whitesourceExecuteScanCommonPipelineEnvironment) persist(path, resourceName string) { 84 content := []struct { 85 category string 86 name string 87 value interface{} 88 }{ 89 {category: "custom", name: "whitesourceProjectNames", value: p.custom.whitesourceProjectNames}, 90 } 91 92 errCount := 0 93 for _, param := range content { 94 err := piperenv.SetResourceParameter(path, resourceName, filepath.Join(param.category, param.name), param.value) 95 if err != nil { 96 log.Entry().WithError(err).Error("Error persisting piper environment.") 97 errCount++ 98 } 99 } 100 if errCount > 0 { 101 log.Entry().Error("failed to persist Piper environment") 102 } 103 } 104 105 type whitesourceExecuteScanInflux struct { 106 step_data struct { 107 fields struct { 108 whitesource bool 109 } 110 tags struct { 111 } 112 } 113 whitesource_data struct { 114 fields struct { 115 vulnerabilities int 116 major_vulnerabilities int 117 minor_vulnerabilities int 118 policy_violations int 119 } 120 tags struct { 121 } 122 } 123 } 124 125 func (i *whitesourceExecuteScanInflux) persist(path, resourceName string) { 126 measurementContent := []struct { 127 measurement string 128 valType string 129 name string 130 value interface{} 131 }{ 132 {valType: config.InfluxField, measurement: "step_data", name: "whitesource", value: i.step_data.fields.whitesource}, 133 {valType: config.InfluxField, measurement: "whitesource_data", name: "vulnerabilities", value: i.whitesource_data.fields.vulnerabilities}, 134 {valType: config.InfluxField, measurement: "whitesource_data", name: "major_vulnerabilities", value: i.whitesource_data.fields.major_vulnerabilities}, 135 {valType: config.InfluxField, measurement: "whitesource_data", name: "minor_vulnerabilities", value: i.whitesource_data.fields.minor_vulnerabilities}, 136 {valType: config.InfluxField, measurement: "whitesource_data", name: "policy_violations", value: i.whitesource_data.fields.policy_violations}, 137 } 138 139 errCount := 0 140 for _, metric := range measurementContent { 141 err := piperenv.SetResourceParameter(path, resourceName, filepath.Join(metric.measurement, fmt.Sprintf("%vs", metric.valType), metric.name), metric.value) 142 if err != nil { 143 log.Entry().WithError(err).Error("Error persisting influx environment.") 144 errCount++ 145 } 146 } 147 if errCount > 0 { 148 log.Entry().Error("failed to persist Influx environment") 149 } 150 } 151 152 type whitesourceExecuteScanReports struct { 153 } 154 155 func (p *whitesourceExecuteScanReports) persist(stepConfig whitesourceExecuteScanOptions, gcpJsonKeyFilePath string, gcsBucketId string, gcsFolderPath string, gcsSubFolder string) { 156 if gcsBucketId == "" { 157 log.Entry().Info("persisting reports to GCS is disabled, because gcsBucketId is empty") 158 return 159 } 160 log.Entry().Info("Uploading reports to Google Cloud Storage...") 161 content := []gcs.ReportOutputParam{ 162 {FilePattern: "**/whitesource-ip.json", ParamRef: "", StepResultType: "whitesource-ip"}, 163 {FilePattern: "whitesource-riskReport.pdf", ParamRef: "", StepResultType: "whitesource-ip"}, 164 {FilePattern: "**/toolrun_whitesource_*.json", ParamRef: "", StepResultType: "whitesource-ip"}, 165 {FilePattern: "**/piper_whitesource_vulnerability_report.html", ParamRef: "", StepResultType: "whitesource-security"}, 166 {FilePattern: "whitesource-riskReport.pdf", ParamRef: "", StepResultType: "whitesource-security"}, 167 {FilePattern: "**/toolrun_whitesource_*.json", ParamRef: "", StepResultType: "whitesource-security"}, 168 } 169 envVars := []gcs.EnvVar{ 170 {Name: "GOOGLE_APPLICATION_CREDENTIALS", Value: gcpJsonKeyFilePath, Modified: false}, 171 } 172 gcsClient, err := gcs.NewClient(gcs.WithEnvVars(envVars)) 173 if err != nil { 174 log.Entry().Errorf("creation of GCS client failed: %v", err) 175 return 176 } 177 defer gcsClient.Close() 178 structVal := reflect.ValueOf(&stepConfig).Elem() 179 inputParameters := map[string]string{} 180 for i := 0; i < structVal.NumField(); i++ { 181 field := structVal.Type().Field(i) 182 if field.Type.String() == "string" { 183 paramName := strings.Split(field.Tag.Get("json"), ",") 184 paramValue, _ := structVal.Field(i).Interface().(string) 185 inputParameters[paramName[0]] = paramValue 186 } 187 } 188 if err := gcs.PersistReportsToGCS(gcsClient, content, inputParameters, gcsFolderPath, gcsBucketId, gcsSubFolder, doublestar.Glob, os.Stat); err != nil { 189 log.Entry().Errorf("failed to persist reports: %v", err) 190 } 191 } 192 193 // WhitesourceExecuteScanCommand Execute a WhiteSource scan 194 func WhitesourceExecuteScanCommand() *cobra.Command { 195 const STEP_NAME = "whitesourceExecuteScan" 196 197 metadata := whitesourceExecuteScanMetadata() 198 var stepConfig whitesourceExecuteScanOptions 199 var startTime time.Time 200 var commonPipelineEnvironment whitesourceExecuteScanCommonPipelineEnvironment 201 var influx whitesourceExecuteScanInflux 202 var reports whitesourceExecuteScanReports 203 var logCollector *log.CollectorHook 204 var splunkClient *splunk.Splunk 205 telemetryClient := &telemetry.Telemetry{} 206 207 var createWhitesourceExecuteScanCmd = &cobra.Command{ 208 Use: STEP_NAME, 209 Short: "Execute a WhiteSource scan", 210 Long: `With this step [WhiteSource](https://www.whitesourcesoftware.com) security and license compliance scans can be executed and assessed. 211 WhiteSource is a Software as a Service offering based on a so called unified agent that locally determines the dependency 212 tree of a node.js, Java, Python, Ruby, or Scala based solution and sends it to the WhiteSource server for a policy based license compliance 213 check and additional Free and Open Source Software Publicly Known Vulnerabilities detection. 214 215 The step uses the so-called WhiteSource Unified Agent. For details please refer to the [WhiteSource Unified Agent Documentation](https://whitesource.atlassian.net/wiki/spaces/WD/pages/33718339/Unified+Agent). 216 217 !!! note "Docker Images" 218 The underlying Docker images are public and specific to the solution's programming language(s) and therefore may have to be exchanged 219 to fit to and support the relevant scenario. The default Python environment used is i.e. Python 3 based.`, 220 PreRunE: func(cmd *cobra.Command, _ []string) error { 221 startTime = time.Now() 222 log.SetStepName(STEP_NAME) 223 log.SetVerbose(GeneralConfig.Verbose) 224 225 GeneralConfig.GitHubAccessTokens = ResolveAccessTokens(GeneralConfig.GitHubTokens) 226 227 path, _ := os.Getwd() 228 fatalHook := &log.FatalHook{CorrelationID: GeneralConfig.CorrelationID, Path: path} 229 log.RegisterHook(fatalHook) 230 231 err := PrepareConfig(cmd, &metadata, STEP_NAME, &stepConfig, config.OpenPiperFile) 232 if err != nil { 233 log.SetErrorCategory(log.ErrorConfiguration) 234 return err 235 } 236 log.RegisterSecret(stepConfig.ContainerRegistryPassword) 237 log.RegisterSecret(stepConfig.ContainerRegistryUser) 238 log.RegisterSecret(stepConfig.DockerConfigJSON) 239 log.RegisterSecret(stepConfig.OrgToken) 240 log.RegisterSecret(stepConfig.UserToken) 241 log.RegisterSecret(stepConfig.GithubToken) 242 243 if len(GeneralConfig.HookConfig.SentryConfig.Dsn) > 0 { 244 sentryHook := log.NewSentryHook(GeneralConfig.HookConfig.SentryConfig.Dsn, GeneralConfig.CorrelationID) 245 log.RegisterHook(&sentryHook) 246 } 247 248 if len(GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 { 249 splunkClient = &splunk.Splunk{} 250 logCollector = &log.CollectorHook{CorrelationID: GeneralConfig.CorrelationID} 251 log.RegisterHook(logCollector) 252 } 253 254 validation, err := validation.New(validation.WithJSONNamesForStructFields(), validation.WithPredefinedErrorMessages()) 255 if err != nil { 256 return err 257 } 258 if err = validation.ValidateStruct(stepConfig); err != nil { 259 log.SetErrorCategory(log.ErrorConfiguration) 260 return err 261 } 262 263 return nil 264 }, 265 Run: func(_ *cobra.Command, _ []string) { 266 stepTelemetryData := telemetry.CustomData{} 267 stepTelemetryData.ErrorCode = "1" 268 handler := func() { 269 commonPipelineEnvironment.persist(GeneralConfig.EnvRootPath, "commonPipelineEnvironment") 270 influx.persist(GeneralConfig.EnvRootPath, "influx") 271 reports.persist(stepConfig, GeneralConfig.GCPJsonKeyFilePath, GeneralConfig.GCSBucketId, GeneralConfig.GCSFolderPath, GeneralConfig.GCSSubFolder) 272 config.RemoveVaultSecretFiles() 273 stepTelemetryData.Duration = fmt.Sprintf("%v", time.Since(startTime).Milliseconds()) 274 stepTelemetryData.ErrorCategory = log.GetErrorCategory().String() 275 stepTelemetryData.PiperCommitHash = GitCommit 276 telemetryClient.SetData(&stepTelemetryData) 277 telemetryClient.Send() 278 if len(GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 { 279 splunkClient.Send(telemetryClient.GetData(), logCollector) 280 } 281 } 282 log.DeferExitHandler(handler) 283 defer handler() 284 telemetryClient.Initialize(GeneralConfig.NoTelemetry, STEP_NAME) 285 if len(GeneralConfig.HookConfig.SplunkConfig.Dsn) > 0 { 286 splunkClient.Initialize(GeneralConfig.CorrelationID, 287 GeneralConfig.HookConfig.SplunkConfig.Dsn, 288 GeneralConfig.HookConfig.SplunkConfig.Token, 289 GeneralConfig.HookConfig.SplunkConfig.Index, 290 GeneralConfig.HookConfig.SplunkConfig.SendLogs) 291 } 292 whitesourceExecuteScan(stepConfig, &stepTelemetryData, &commonPipelineEnvironment, &influx) 293 stepTelemetryData.ErrorCode = "0" 294 log.Entry().Info("SUCCESS") 295 }, 296 } 297 298 addWhitesourceExecuteScanFlags(createWhitesourceExecuteScanCmd, &stepConfig) 299 return createWhitesourceExecuteScanCmd 300 } 301 302 func addWhitesourceExecuteScanFlags(cmd *cobra.Command, stepConfig *whitesourceExecuteScanOptions) { 303 cmd.Flags().StringVar(&stepConfig.AgentDownloadURL, "agentDownloadUrl", `https://github.com/whitesource/unified-agent-distribution/releases/latest/download/wss-unified-agent.jar`, "URL used to download the latest version of the WhiteSource Unified Agent.") 304 cmd.Flags().StringVar(&stepConfig.AgentFileName, "agentFileName", `wss-unified-agent.jar`, "Locally used name for the Unified Agent jar file after download.") 305 cmd.Flags().StringSliceVar(&stepConfig.AgentParameters, "agentParameters", []string{}, "[NOT IMPLEMENTED] List of additional parameters passed to the Unified Agent command line.") 306 cmd.Flags().StringVar(&stepConfig.AgentURL, "agentUrl", `https://saas.whitesourcesoftware.com/agent`, "URL to the WhiteSource agent endpoint.") 307 cmd.Flags().BoolVar(&stepConfig.AggregateVersionWideReport, "aggregateVersionWideReport", false, "This does not run a scan, instead just generated a report for all projects with projectVersion = config.ProductVersion") 308 cmd.Flags().StringSliceVar(&stepConfig.BuildDescriptorExcludeList, "buildDescriptorExcludeList", []string{`unit-tests/pom.xml`, `integration-tests/pom.xml`}, "List of build descriptors and therefore modules to exclude from the scan and assessment activities.") 309 cmd.Flags().StringVar(&stepConfig.BuildDescriptorFile, "buildDescriptorFile", os.Getenv("PIPER_buildDescriptorFile"), "Explicit path to the build descriptor file.") 310 cmd.Flags().StringVar(&stepConfig.BuildTool, "buildTool", os.Getenv("PIPER_buildTool"), "Defines the tool which is used for building the artifact.") 311 cmd.Flags().StringVar(&stepConfig.ConfigFilePath, "configFilePath", `./wss-unified-agent.config`, "Explicit path to the WhiteSource Unified Agent configuration file.") 312 cmd.Flags().StringVar(&stepConfig.ContainerRegistryPassword, "containerRegistryPassword", os.Getenv("PIPER_containerRegistryPassword"), "For `buildTool: docker`: Password for container registry access - typically provided by the CI/CD environment.") 313 cmd.Flags().StringVar(&stepConfig.ContainerRegistryUser, "containerRegistryUser", os.Getenv("PIPER_containerRegistryUser"), "For `buildTool: docker`: Username for container registry access - typically provided by the CI/CD environment.") 314 cmd.Flags().BoolVar(&stepConfig.CreateProductFromPipeline, "createProductFromPipeline", true, "Whether to create the related WhiteSource product on the fly based on the supplied pipeline configuration.") 315 cmd.Flags().StringVar(&stepConfig.CustomScanVersion, "customScanVersion", os.Getenv("PIPER_customScanVersion"), "Custom version of the WhiteSource project used as source.") 316 cmd.Flags().StringVar(&stepConfig.CvssSeverityLimit, "cvssSeverityLimit", `-1`, "Limit of tolerable CVSS v3 score upon assessment and in consequence fails the build.") 317 cmd.Flags().StringVar(&stepConfig.ScanPath, "scanPath", `.`, "Directory where to start WhiteSource scan.") 318 cmd.Flags().StringVar(&stepConfig.DockerConfigJSON, "dockerConfigJSON", os.Getenv("PIPER_dockerConfigJSON"), "Path to the file `.docker/config.json` - this is typically provided by your CI/CD system. You can find more details about the Docker credentials in the [Docker documentation](https://docs.docker.com/engine/reference/commandline/login/).") 319 cmd.Flags().StringSliceVar(&stepConfig.EmailAddressesOfInitialProductAdmins, "emailAddressesOfInitialProductAdmins", []string{}, "The list of email addresses to assign as product admins for newly created WhiteSource products.") 320 cmd.Flags().StringSliceVar(&stepConfig.Excludes, "excludes", []string{}, "List of file path patterns to exclude in the scan.") 321 cmd.Flags().StringSliceVar(&stepConfig.Includes, "includes", []string{}, "List of file path patterns to include in the scan.") 322 cmd.Flags().StringVar(&stepConfig.InstallCommand, "installCommand", os.Getenv("PIPER_installCommand"), "[NOT IMPLEMENTED] Install command that can be used to populate the default docker image for some scenarios.") 323 cmd.Flags().StringVar(&stepConfig.JreDownloadURL, "jreDownloadUrl", `https://github.com/SAP/SapMachine/releases/download/sapmachine-11.0.2/sapmachine-jre-11.0.2_linux-x64_bin.tar.gz`, "URL used for downloading the Java Runtime Environment (JRE) required to run the WhiteSource Unified Agent.") 324 cmd.Flags().BoolVar(&stepConfig.LicensingVulnerabilities, "licensingVulnerabilities", true, "[NOT IMPLEMENTED] Whether license compliance is considered and reported as part of the assessment.") 325 cmd.Flags().StringVar(&stepConfig.OrgToken, "orgToken", os.Getenv("PIPER_orgToken"), "WhiteSource token identifying your organization.") 326 cmd.Flags().StringVar(&stepConfig.ProductName, "productName", os.Getenv("PIPER_productName"), "Name of the WhiteSource product used for results aggregation. This parameter is mandatory if the parameter `createProductFromPipeline` is set to `true` and the WhiteSource product does not yet exist. It is also mandatory if the parameter `productToken` is not provided.") 327 cmd.Flags().StringVar(&stepConfig.ProductToken, "productToken", os.Getenv("PIPER_productToken"), "Token of the WhiteSource product to be created and used for results aggregation, usually determined automatically. Can optionally be provided as an alternative to `productName`.") 328 cmd.Flags().StringVar(&stepConfig.Version, "version", os.Getenv("PIPER_version"), "Version of the WhiteSource product to be created and used for results aggregation.") 329 cmd.Flags().StringVar(&stepConfig.ProjectName, "projectName", os.Getenv("PIPER_projectName"), "The project name used for reporting results in WhiteSource. When provided, all source modules will be scanned into one aggregated WhiteSource project. For scan types `maven`, `mta`, `npm`, the default is to generate one WhiteSource project per module, whereas the project name is derived from the module's build descriptor. For NPM modules, project aggregation is not supported, the last scanned NPM module will override all previously aggregated scan results!") 330 cmd.Flags().StringVar(&stepConfig.ProjectToken, "projectToken", os.Getenv("PIPER_projectToken"), "Project token to execute scan on. Ignored for scan types `maven`, `mta` and `npm`. Used for project aggregation when scanning with the Unified Agent and can be provided as an alternative to `projectName`.") 331 cmd.Flags().BoolVar(&stepConfig.Reporting, "reporting", true, "Whether assessment is being done at all, defaults to `true`") 332 cmd.Flags().StringVar(&stepConfig.ScanImage, "scanImage", os.Getenv("PIPER_scanImage"), "For `buildTool: docker`: Defines the docker image which should be scanned.") 333 cmd.Flags().StringVar(&stepConfig.ScanImageRegistryURL, "scanImageRegistryUrl", os.Getenv("PIPER_scanImageRegistryUrl"), "For `buildTool: docker`: Defines the registry where the scanImage is located.") 334 cmd.Flags().BoolVar(&stepConfig.SecurityVulnerabilities, "securityVulnerabilities", true, "Whether security compliance is considered and reported as part of the assessment.") 335 cmd.Flags().StringVar(&stepConfig.ServiceURL, "serviceUrl", `https://saas.whitesourcesoftware.com/api`, "URL to the WhiteSource API endpoint.") 336 cmd.Flags().IntVar(&stepConfig.Timeout, "timeout", 900, "Timeout in seconds until an HTTP call is forcefully terminated.") 337 cmd.Flags().StringVar(&stepConfig.UserToken, "userToken", os.Getenv("PIPER_userToken"), "User token to access WhiteSource. In Jenkins use case this is automatically filled through the credentials.") 338 cmd.Flags().StringVar(&stepConfig.VersioningModel, "versioningModel", `major`, "The default project versioning model used in case `projectVersion` parameter is empty for creating the version based on the build descriptor version to report results in Whitesource, can be one of `'major'`, `'major-minor'`, `'semantic'`, `'full'`") 339 cmd.Flags().StringVar(&stepConfig.VulnerabilityReportFormat, "vulnerabilityReportFormat", `xlsx`, "Format of the file the vulnerability report is written to.") 340 cmd.Flags().StringVar(&stepConfig.VulnerabilityReportTitle, "vulnerabilityReportTitle", `WhiteSource Security Vulnerability Report`, "Title of vulnerability report written during the assessment phase.") 341 cmd.Flags().StringVar(&stepConfig.ProjectSettingsFile, "projectSettingsFile", os.Getenv("PIPER_projectSettingsFile"), "Path to the mvn settings file that should be used as project settings file.") 342 cmd.Flags().StringVar(&stepConfig.GlobalSettingsFile, "globalSettingsFile", os.Getenv("PIPER_globalSettingsFile"), "Path to the mvn settings file that should be used as global settings file.") 343 cmd.Flags().StringVar(&stepConfig.M2Path, "m2Path", os.Getenv("PIPER_m2Path"), "Path to the location of the local repository that should be used.") 344 cmd.Flags().BoolVar(&stepConfig.InstallArtifacts, "installArtifacts", false, "If enabled, it will install all artifacts to the local maven repository to make them available before running whitesource. This is required if any maven module has dependencies to other modules in the repository and they were not installed before.") 345 cmd.Flags().StringVar(&stepConfig.DefaultNpmRegistry, "defaultNpmRegistry", os.Getenv("PIPER_defaultNpmRegistry"), "URL of the npm registry to use. Defaults to https://registry.npmjs.org/") 346 cmd.Flags().StringVar(&stepConfig.GithubToken, "githubToken", os.Getenv("PIPER_githubToken"), "GitHub personal access token as per https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line") 347 cmd.Flags().BoolVar(&stepConfig.CreateResultIssue, "createResultIssue", false, "Activate creation of a result issue in GitHub.") 348 cmd.Flags().StringVar(&stepConfig.GithubAPIURL, "githubApiUrl", `https://api.github.com`, "Set the GitHub API URL.") 349 cmd.Flags().StringVar(&stepConfig.Owner, "owner", os.Getenv("PIPER_owner"), "Set the GitHub organization.") 350 cmd.Flags().StringVar(&stepConfig.Repository, "repository", os.Getenv("PIPER_repository"), "Set the GitHub repository.") 351 cmd.Flags().StringSliceVar(&stepConfig.Assignees, "assignees", []string{``}, "Defines the assignees for the Github Issue created/updated with the results of the scan as a list of login names.") 352 cmd.Flags().StringSliceVar(&stepConfig.CustomTLSCertificateLinks, "customTlsCertificateLinks", []string{}, "List of download links to custom TLS certificates. This is required to ensure trusted connections to instances with repositories (like nexus) when publish flag is set to true.") 353 354 cmd.MarkFlagRequired("buildTool") 355 cmd.MarkFlagRequired("orgToken") 356 cmd.MarkFlagRequired("userToken") 357 } 358 359 // retrieve step metadata 360 func whitesourceExecuteScanMetadata() config.StepData { 361 var theMetaData = config.StepData{ 362 Metadata: config.StepMetadata{ 363 Name: "whitesourceExecuteScan", 364 Aliases: []config.Alias{}, 365 Description: "Execute a WhiteSource scan", 366 }, 367 Spec: config.StepSpec{ 368 Inputs: config.StepInputs{ 369 Secrets: []config.StepSecrets{ 370 {Name: "userTokenCredentialsId", Description: "Jenkins 'Secret text' credentials ID containing Whitesource user token.", Type: "jenkins", Aliases: []config.Alias{{Name: "whitesourceUserTokenCredentialsId", Deprecated: false}, {Name: "whitesource/userTokenCredentialsId", Deprecated: true}}}, 371 {Name: "orgAdminUserTokenCredentialsId", Description: "Jenkins 'Secret text' credentials ID containing Whitesource org admin token.", Type: "jenkins", Aliases: []config.Alias{{Name: "whitesourceOrgAdminUserTokenCredentialsId", Deprecated: false}, {Name: "whitesource/orgAdminUserTokenCredentialsId", Deprecated: true}}}, 372 {Name: "dockerConfigJsonCredentialsId", Description: "Jenkins 'Secret file' credentials ID containing Docker config.json (with registry credential(s)). You can find more details about the Docker credentials in the [Docker documentation](https://docs.docker.com/engine/reference/commandline/login/).", Type: "jenkins", Aliases: []config.Alias{{Name: "dockerCredentialsId", Deprecated: true}}}, 373 {Name: "githubTokenCredentialsId", Description: "Jenkins 'Secret text' credentials ID containing token to authenticate to GitHub.", Type: "jenkins"}, 374 }, 375 Resources: []config.StepResources{ 376 {Name: "buildDescriptor", Type: "stash"}, 377 {Name: "opensourceConfiguration", Type: "stash"}, 378 {Name: "checkmarx", Type: "stash"}, 379 }, 380 Parameters: []config.StepParameters{ 381 { 382 Name: "agentDownloadUrl", 383 ResourceRef: []config.ResourceReference{}, 384 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 385 Type: "string", 386 Mandatory: false, 387 Aliases: []config.Alias{}, 388 Default: `https://github.com/whitesource/unified-agent-distribution/releases/latest/download/wss-unified-agent.jar`, 389 }, 390 { 391 Name: "agentFileName", 392 ResourceRef: []config.ResourceReference{}, 393 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 394 Type: "string", 395 Mandatory: false, 396 Aliases: []config.Alias{}, 397 Default: `wss-unified-agent.jar`, 398 }, 399 { 400 Name: "agentParameters", 401 ResourceRef: []config.ResourceReference{}, 402 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 403 Type: "[]string", 404 Mandatory: false, 405 Aliases: []config.Alias{}, 406 Default: []string{}, 407 }, 408 { 409 Name: "agentUrl", 410 ResourceRef: []config.ResourceReference{}, 411 Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, 412 Type: "string", 413 Mandatory: false, 414 Aliases: []config.Alias{{Name: "whitesourceAgentUrl"}}, 415 Default: `https://saas.whitesourcesoftware.com/agent`, 416 }, 417 { 418 Name: "aggregateVersionWideReport", 419 ResourceRef: []config.ResourceReference{}, 420 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 421 Type: "bool", 422 Mandatory: false, 423 Aliases: []config.Alias{}, 424 Default: false, 425 }, 426 { 427 Name: "buildDescriptorExcludeList", 428 ResourceRef: []config.ResourceReference{}, 429 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 430 Type: "[]string", 431 Mandatory: false, 432 Aliases: []config.Alias{}, 433 Default: []string{`unit-tests/pom.xml`, `integration-tests/pom.xml`}, 434 }, 435 { 436 Name: "buildDescriptorFile", 437 ResourceRef: []config.ResourceReference{}, 438 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 439 Type: "string", 440 Mandatory: false, 441 Aliases: []config.Alias{}, 442 Default: os.Getenv("PIPER_buildDescriptorFile"), 443 }, 444 { 445 Name: "buildTool", 446 ResourceRef: []config.ResourceReference{ 447 { 448 Name: "commonPipelineEnvironment", 449 Param: "buildTool", 450 }, 451 }, 452 Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, 453 Type: "string", 454 Mandatory: true, 455 Aliases: []config.Alias{}, 456 Default: os.Getenv("PIPER_buildTool"), 457 }, 458 { 459 Name: "configFilePath", 460 ResourceRef: []config.ResourceReference{}, 461 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 462 Type: "string", 463 Mandatory: false, 464 Aliases: []config.Alias{}, 465 Default: `./wss-unified-agent.config`, 466 }, 467 { 468 Name: "containerRegistryPassword", 469 ResourceRef: []config.ResourceReference{ 470 { 471 Name: "commonPipelineEnvironment", 472 Param: "container/repositoryPassword", 473 }, 474 475 { 476 Name: "commonPipelineEnvironment", 477 Param: "custom/repositoryPassword", 478 }, 479 }, 480 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 481 Type: "string", 482 Mandatory: false, 483 Aliases: []config.Alias{}, 484 Default: os.Getenv("PIPER_containerRegistryPassword"), 485 }, 486 { 487 Name: "containerRegistryUser", 488 ResourceRef: []config.ResourceReference{ 489 { 490 Name: "commonPipelineEnvironment", 491 Param: "container/repositoryUsername", 492 }, 493 494 { 495 Name: "commonPipelineEnvironment", 496 Param: "custom/repositoryUsername", 497 }, 498 }, 499 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 500 Type: "string", 501 Mandatory: false, 502 Aliases: []config.Alias{}, 503 Default: os.Getenv("PIPER_containerRegistryUser"), 504 }, 505 { 506 Name: "createProductFromPipeline", 507 ResourceRef: []config.ResourceReference{}, 508 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 509 Type: "bool", 510 Mandatory: false, 511 Aliases: []config.Alias{}, 512 Default: true, 513 }, 514 { 515 Name: "customScanVersion", 516 ResourceRef: []config.ResourceReference{}, 517 Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, 518 Type: "string", 519 Mandatory: false, 520 Aliases: []config.Alias{}, 521 Default: os.Getenv("PIPER_customScanVersion"), 522 }, 523 { 524 Name: "cvssSeverityLimit", 525 ResourceRef: []config.ResourceReference{}, 526 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 527 Type: "string", 528 Mandatory: false, 529 Aliases: []config.Alias{}, 530 Default: `-1`, 531 }, 532 { 533 Name: "scanPath", 534 ResourceRef: []config.ResourceReference{}, 535 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 536 Type: "string", 537 Mandatory: false, 538 Aliases: []config.Alias{}, 539 Default: `.`, 540 }, 541 { 542 Name: "dockerConfigJSON", 543 ResourceRef: []config.ResourceReference{ 544 { 545 Name: "commonPipelineEnvironment", 546 Param: "custom/dockerConfigJSON", 547 }, 548 549 { 550 Name: "dockerConfigJsonCredentialsId", 551 Type: "secret", 552 }, 553 554 { 555 Name: "dockerConfigFileVaultSecretName", 556 Type: "vaultSecretFile", 557 Default: "docker-config", 558 }, 559 }, 560 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 561 Type: "string", 562 Mandatory: false, 563 Aliases: []config.Alias{}, 564 Default: os.Getenv("PIPER_dockerConfigJSON"), 565 }, 566 { 567 Name: "emailAddressesOfInitialProductAdmins", 568 ResourceRef: []config.ResourceReference{}, 569 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 570 Type: "[]string", 571 Mandatory: false, 572 Aliases: []config.Alias{}, 573 Default: []string{}, 574 }, 575 { 576 Name: "excludes", 577 ResourceRef: []config.ResourceReference{}, 578 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 579 Type: "[]string", 580 Mandatory: false, 581 Aliases: []config.Alias{}, 582 Default: []string{}, 583 }, 584 { 585 Name: "includes", 586 ResourceRef: []config.ResourceReference{}, 587 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 588 Type: "[]string", 589 Mandatory: false, 590 Aliases: []config.Alias{}, 591 Default: []string{}, 592 }, 593 { 594 Name: "installCommand", 595 ResourceRef: []config.ResourceReference{}, 596 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 597 Type: "string", 598 Mandatory: false, 599 Aliases: []config.Alias{}, 600 Default: os.Getenv("PIPER_installCommand"), 601 }, 602 { 603 Name: "jreDownloadUrl", 604 ResourceRef: []config.ResourceReference{}, 605 Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, 606 Type: "string", 607 Mandatory: false, 608 Aliases: []config.Alias{{Name: "whitesource/jreDownloadUrl", Deprecated: true}}, 609 Default: `https://github.com/SAP/SapMachine/releases/download/sapmachine-11.0.2/sapmachine-jre-11.0.2_linux-x64_bin.tar.gz`, 610 }, 611 { 612 Name: "licensingVulnerabilities", 613 ResourceRef: []config.ResourceReference{}, 614 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 615 Type: "bool", 616 Mandatory: false, 617 Aliases: []config.Alias{}, 618 Default: true, 619 }, 620 { 621 Name: "orgToken", 622 ResourceRef: []config.ResourceReference{ 623 { 624 Name: "orgAdminUserTokenCredentialsId", 625 Type: "secret", 626 }, 627 628 { 629 Name: "whitesourceVaultSecret", 630 Type: "vaultSecret", 631 Default: "whitesource", 632 }, 633 }, 634 Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, 635 Type: "string", 636 Mandatory: true, 637 Aliases: []config.Alias{{Name: "whitesourceOrgToken"}, {Name: "whitesource/orgToken", Deprecated: true}}, 638 Default: os.Getenv("PIPER_orgToken"), 639 }, 640 { 641 Name: "productName", 642 ResourceRef: []config.ResourceReference{}, 643 Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, 644 Type: "string", 645 Mandatory: false, 646 Aliases: []config.Alias{{Name: "whitesourceProductName"}, {Name: "whitesource/productName", Deprecated: true}}, 647 Default: os.Getenv("PIPER_productName"), 648 }, 649 { 650 Name: "productToken", 651 ResourceRef: []config.ResourceReference{}, 652 Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, 653 Type: "string", 654 Mandatory: false, 655 Aliases: []config.Alias{{Name: "whitesourceProductToken"}, {Name: "whitesource/productToken", Deprecated: true}}, 656 Default: os.Getenv("PIPER_productToken"), 657 }, 658 { 659 Name: "version", 660 ResourceRef: []config.ResourceReference{ 661 { 662 Name: "commonPipelineEnvironment", 663 Param: "artifactVersion", 664 }, 665 }, 666 Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, 667 Type: "string", 668 Mandatory: false, 669 Aliases: []config.Alias{{Name: "productVersion"}, {Name: "whitesourceProductVersion"}, {Name: "whitesource/productVersion", Deprecated: true}}, 670 Default: os.Getenv("PIPER_version"), 671 }, 672 { 673 Name: "projectName", 674 ResourceRef: []config.ResourceReference{}, 675 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 676 Type: "string", 677 Mandatory: false, 678 Aliases: []config.Alias{{Name: "whitesourceProjectName"}}, 679 Default: os.Getenv("PIPER_projectName"), 680 }, 681 { 682 Name: "projectToken", 683 ResourceRef: []config.ResourceReference{}, 684 Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, 685 Type: "string", 686 Mandatory: false, 687 Aliases: []config.Alias{}, 688 Default: os.Getenv("PIPER_projectToken"), 689 }, 690 { 691 Name: "reporting", 692 ResourceRef: []config.ResourceReference{}, 693 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 694 Type: "bool", 695 Mandatory: false, 696 Aliases: []config.Alias{}, 697 Default: true, 698 }, 699 { 700 Name: "scanImage", 701 ResourceRef: []config.ResourceReference{ 702 { 703 Name: "commonPipelineEnvironment", 704 Param: "container/imageNameTag", 705 }, 706 }, 707 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 708 Type: "string", 709 Mandatory: false, 710 Aliases: []config.Alias{}, 711 Default: os.Getenv("PIPER_scanImage"), 712 }, 713 { 714 Name: "scanImageRegistryUrl", 715 ResourceRef: []config.ResourceReference{ 716 { 717 Name: "commonPipelineEnvironment", 718 Param: "container/registryUrl", 719 }, 720 }, 721 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 722 Type: "string", 723 Mandatory: false, 724 Aliases: []config.Alias{}, 725 Default: os.Getenv("PIPER_scanImageRegistryUrl"), 726 }, 727 { 728 Name: "securityVulnerabilities", 729 ResourceRef: []config.ResourceReference{}, 730 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 731 Type: "bool", 732 Mandatory: false, 733 Aliases: []config.Alias{}, 734 Default: true, 735 }, 736 { 737 Name: "serviceUrl", 738 ResourceRef: []config.ResourceReference{}, 739 Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, 740 Type: "string", 741 Mandatory: false, 742 Aliases: []config.Alias{{Name: "whitesourceServiceUrl"}, {Name: "whitesource/serviceUrl", Deprecated: true}}, 743 Default: `https://saas.whitesourcesoftware.com/api`, 744 }, 745 { 746 Name: "timeout", 747 ResourceRef: []config.ResourceReference{}, 748 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 749 Type: "int", 750 Mandatory: false, 751 Aliases: []config.Alias{}, 752 Default: 900, 753 }, 754 { 755 Name: "userToken", 756 ResourceRef: []config.ResourceReference{ 757 { 758 Name: "userTokenCredentialsId", 759 Type: "secret", 760 }, 761 762 { 763 Name: "whitesourceVaultSecret", 764 Type: "vaultSecret", 765 Default: "whitesource", 766 }, 767 }, 768 Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, 769 Type: "string", 770 Mandatory: true, 771 Aliases: []config.Alias{}, 772 Default: os.Getenv("PIPER_userToken"), 773 }, 774 { 775 Name: "versioningModel", 776 ResourceRef: []config.ResourceReference{}, 777 Scope: []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"}, 778 Type: "string", 779 Mandatory: false, 780 Aliases: []config.Alias{{Name: "defaultVersioningModel"}}, 781 Default: `major`, 782 }, 783 { 784 Name: "vulnerabilityReportFormat", 785 ResourceRef: []config.ResourceReference{}, 786 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 787 Type: "string", 788 Mandatory: false, 789 Aliases: []config.Alias{}, 790 Default: `xlsx`, 791 }, 792 { 793 Name: "vulnerabilityReportTitle", 794 ResourceRef: []config.ResourceReference{}, 795 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 796 Type: "string", 797 Mandatory: false, 798 Aliases: []config.Alias{}, 799 Default: `WhiteSource Security Vulnerability Report`, 800 }, 801 { 802 Name: "projectSettingsFile", 803 ResourceRef: []config.ResourceReference{}, 804 Scope: []string{"GENERAL", "STEPS", "STAGES", "PARAMETERS"}, 805 Type: "string", 806 Mandatory: false, 807 Aliases: []config.Alias{{Name: "maven/projectSettingsFile"}}, 808 Default: os.Getenv("PIPER_projectSettingsFile"), 809 }, 810 { 811 Name: "globalSettingsFile", 812 ResourceRef: []config.ResourceReference{}, 813 Scope: []string{"GENERAL", "STEPS", "STAGES", "PARAMETERS"}, 814 Type: "string", 815 Mandatory: false, 816 Aliases: []config.Alias{{Name: "maven/globalSettingsFile"}}, 817 Default: os.Getenv("PIPER_globalSettingsFile"), 818 }, 819 { 820 Name: "m2Path", 821 ResourceRef: []config.ResourceReference{}, 822 Scope: []string{"GENERAL", "STEPS", "STAGES", "PARAMETERS"}, 823 Type: "string", 824 Mandatory: false, 825 Aliases: []config.Alias{{Name: "maven/m2Path"}}, 826 Default: os.Getenv("PIPER_m2Path"), 827 }, 828 { 829 Name: "installArtifacts", 830 ResourceRef: []config.ResourceReference{}, 831 Scope: []string{"GENERAL", "STEPS", "STAGES", "PARAMETERS"}, 832 Type: "bool", 833 Mandatory: false, 834 Aliases: []config.Alias{}, 835 Default: false, 836 }, 837 { 838 Name: "defaultNpmRegistry", 839 ResourceRef: []config.ResourceReference{}, 840 Scope: []string{"PARAMETERS", "GENERAL", "STAGES", "STEPS"}, 841 Type: "string", 842 Mandatory: false, 843 Aliases: []config.Alias{{Name: "npm/defaultNpmRegistry"}}, 844 Default: os.Getenv("PIPER_defaultNpmRegistry"), 845 }, 846 { 847 Name: "githubToken", 848 ResourceRef: []config.ResourceReference{ 849 { 850 Name: "githubTokenCredentialsId", 851 Type: "secret", 852 }, 853 854 { 855 Name: "githubVaultSecretName", 856 Type: "vaultSecret", 857 Default: "github", 858 }, 859 }, 860 Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, 861 Type: "string", 862 Mandatory: false, 863 Aliases: []config.Alias{{Name: "access_token"}}, 864 Default: os.Getenv("PIPER_githubToken"), 865 }, 866 { 867 Name: "createResultIssue", 868 ResourceRef: []config.ResourceReference{ 869 { 870 Name: "commonPipelineEnvironment", 871 Param: "custom/isOptimizedAndScheduled", 872 }, 873 }, 874 Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, 875 Type: "bool", 876 Mandatory: false, 877 Aliases: []config.Alias{}, 878 Default: false, 879 }, 880 { 881 Name: "githubApiUrl", 882 ResourceRef: []config.ResourceReference{}, 883 Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, 884 Type: "string", 885 Mandatory: false, 886 Aliases: []config.Alias{}, 887 Default: `https://api.github.com`, 888 }, 889 { 890 Name: "owner", 891 ResourceRef: []config.ResourceReference{ 892 { 893 Name: "commonPipelineEnvironment", 894 Param: "github/owner", 895 }, 896 }, 897 Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, 898 Type: "string", 899 Mandatory: false, 900 Aliases: []config.Alias{{Name: "githubOrg"}}, 901 Default: os.Getenv("PIPER_owner"), 902 }, 903 { 904 Name: "repository", 905 ResourceRef: []config.ResourceReference{ 906 { 907 Name: "commonPipelineEnvironment", 908 Param: "github/repository", 909 }, 910 }, 911 Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, 912 Type: "string", 913 Mandatory: false, 914 Aliases: []config.Alias{{Name: "githubRepo"}}, 915 Default: os.Getenv("PIPER_repository"), 916 }, 917 { 918 Name: "assignees", 919 ResourceRef: []config.ResourceReference{}, 920 Scope: []string{"PARAMETERS", "STAGES", "STEPS"}, 921 Type: "[]string", 922 Mandatory: false, 923 Aliases: []config.Alias{}, 924 Default: []string{``}, 925 }, 926 { 927 Name: "customTlsCertificateLinks", 928 ResourceRef: []config.ResourceReference{}, 929 Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, 930 Type: "[]string", 931 Mandatory: false, 932 Aliases: []config.Alias{}, 933 Default: []string{}, 934 }, 935 }, 936 }, 937 Containers: []config.Container{ 938 {Image: "buildpack-deps:stretch-curl", WorkingDir: "/tmp", Conditions: []config.Condition{{ConditionRef: "strings-equal", Params: []config.Param{{Name: "buildTool", Value: "dub"}, {Name: "buildTool", Value: "docker"}}}}}, 939 {Image: "devxci/mbtci-java11-node14", WorkingDir: "/home/mta", Conditions: []config.Condition{{ConditionRef: "strings-equal", Params: []config.Param{{Name: "buildTool", Value: "mta"}}}}}, 940 {Image: "golang:1", WorkingDir: "/go", Options: []config.Option{{Name: "-u", Value: "0"}}, Conditions: []config.Condition{{ConditionRef: "strings-equal", Params: []config.Param{{Name: "buildTool", Value: "golang"}}}}}, 941 {Image: "gradle", WorkingDir: "/home/gradle", Conditions: []config.Condition{{ConditionRef: "strings-equal", Params: []config.Param{{Name: "buildTool", Value: "gradle"}}}}}, 942 {Image: "hseeberger/scala-sbt:8u181_2.12.8_1.2.8", WorkingDir: "/tmp", Conditions: []config.Condition{{ConditionRef: "strings-equal", Params: []config.Param{{Name: "buildTool", Value: "sbt"}}}}}, 943 {Image: "maven:3.5-jdk-8", WorkingDir: "/tmp", Conditions: []config.Condition{{ConditionRef: "strings-equal", Params: []config.Param{{Name: "buildTool", Value: "maven"}}}}}, 944 {Image: "node:lts-stretch", WorkingDir: "/home/node", Conditions: []config.Condition{{ConditionRef: "strings-equal", Params: []config.Param{{Name: "buildTool", Value: "npm"}}}}}, 945 {Image: "python:3.6-stretch", WorkingDir: "/tmp", Conditions: []config.Condition{{ConditionRef: "strings-equal", Params: []config.Param{{Name: "buildTool", Value: "pip"}}}}}, 946 {Image: "node:lts-stretch", WorkingDir: "/home/node", Conditions: []config.Condition{{ConditionRef: "strings-equal", Params: []config.Param{{Name: "buildTool", Value: "yarn"}}}}}, 947 }, 948 Outputs: config.StepOutputs{ 949 Resources: []config.StepResources{ 950 { 951 Name: "commonPipelineEnvironment", 952 Type: "piperEnvironment", 953 Parameters: []map[string]interface{}{ 954 {"name": "custom/whitesourceProjectNames", "type": "[]string"}, 955 }, 956 }, 957 { 958 Name: "influx", 959 Type: "influx", 960 Parameters: []map[string]interface{}{ 961 {"name": "step_data", "fields": []map[string]string{{"name": "whitesource"}}}, 962 {"name": "whitesource_data", "fields": []map[string]string{{"name": "vulnerabilities"}, {"name": "major_vulnerabilities"}, {"name": "minor_vulnerabilities"}, {"name": "policy_violations"}}}, 963 }, 964 }, 965 { 966 Name: "reports", 967 Type: "reports", 968 Parameters: []map[string]interface{}{ 969 {"filePattern": "**/whitesource-ip.json", "type": "whitesource-ip"}, 970 {"filePattern": "whitesource-riskReport.pdf", "type": "whitesource-ip"}, 971 {"filePattern": "**/toolrun_whitesource_*.json", "type": "whitesource-ip"}, 972 {"filePattern": "**/piper_whitesource_vulnerability_report.html", "type": "whitesource-security"}, 973 {"filePattern": "whitesource-riskReport.pdf", "type": "whitesource-security"}, 974 {"filePattern": "**/toolrun_whitesource_*.json", "type": "whitesource-security"}, 975 }, 976 }, 977 }, 978 }, 979 }, 980 } 981 return theMetaData 982 }