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

Revert "simplify parameters"

This reverts commit 0bfc582808.
This commit is contained in:
Fabian Reh 2021-04-07 10:59:27 +02:00
parent 0bfc582808
commit 102633cf2d
No known key found for this signature in database
GPG Key ID: 242831AEEE9DA2DD

View File

@ -35,8 +35,11 @@ type checkmarxExecuteScanUtils interface {
PathMatch(pattern, name string) (bool, error) PathMatch(pattern, name string) (bool, error)
} }
type checkmarxExecuteScanUtilsBundle struct { type checkmarxExecuteScanUtilsBundle struct{}
workspace string
func newCheckmarxExecuteScanUtils() checkmarxExecuteScanUtils {
utils := checkmarxExecuteScanUtilsBundle{}
return &utils
} }
func (checkmarxExecuteScanUtilsBundle) PathMatch(pattern, name string) (bool, error) { func (checkmarxExecuteScanUtilsBundle) PathMatch(pattern, name string) (bool, error) {
@ -76,14 +79,13 @@ func checkmarxExecuteScan(config checkmarxExecuteScanOptions, _ *telemetry.Custo
log.Entry().WithError(err).Fatalf("Failed to create Checkmarx client talking to URL %v", config.ServerURL) log.Entry().WithError(err).Fatalf("Failed to create Checkmarx client talking to URL %v", config.ServerURL)
} }
influx.step_data.fields.checkmarx = false influx.step_data.fields.checkmarx = false
utils := checkmarxExecuteScanUtilsBundle{workspace: "./"} if err := runScan(config, sys, "./", influx, newCheckmarxExecuteScanUtils()); err != nil {
if err := runScan(config, sys, influx, utils); err != nil {
log.Entry().WithError(err).Fatal("Failed to execute Checkmarx scan.") log.Entry().WithError(err).Fatal("Failed to execute Checkmarx scan.")
} }
influx.step_data.fields.checkmarx = true influx.step_data.fields.checkmarx = true
} }
func runScan(config checkmarxExecuteScanOptions, sys checkmarx.System, influx *checkmarxExecuteScanInflux, utils checkmarxExecuteScanUtilsBundle) error { func runScan(config checkmarxExecuteScanOptions, sys checkmarx.System, workspace string, influx *checkmarxExecuteScanInflux, utils checkmarxExecuteScanUtils) error {
teamID := config.TeamID teamID := config.TeamID
if len(teamID) == 0 { if len(teamID) == 0 {
team, err := loadTeam(sys, config.TeamName) team, err := loadTeam(sys, config.TeamName)
@ -129,7 +131,7 @@ func runScan(config checkmarxExecuteScanOptions, sys checkmarx.System, influx *c
} }
} }
err = uploadAndScan(config, sys, project, utils.workspace, influx, utils) err = uploadAndScan(config, sys, project, workspace, influx, utils)
if err != nil { if err != nil {
return errors.Wrap(err, "failed to run scan and upload result") return errors.Wrap(err, "failed to run scan and upload result")
} }