Skip to content

Commit

Permalink
fix latest build
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Sverdlov <[email protected]>
  • Loading branch information
sverdlov93 committed Oct 4, 2023
1 parent ed58d36 commit a495e0b
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions scan/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,11 @@ func CurationCmd(c *cli.Context) error {

func createAuditCmd(c *cli.Context) (*audit.AuditCommand, error) {
auditCmd := audit.NewGenericAuditCommand()
err := validateXrayContext(c)
serverDetails, err := createServerDetailsWithConfigOffer(c)
if err != nil {
return nil, err
}
serverDetails, err := createServerDetailsWithConfigOffer(c)
err = validateXrayContext(c, serverDetails)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -282,11 +282,11 @@ func ScanCmd(c *cli.Context) error {
if c.NArg() == 0 && !c.IsSet("spec") {
return cliutils.PrintHelpAndReturnError("providing either a <source pattern> argument or the 'spec' option is mandatory", c)
}
err := validateXrayContext(c)
serverDetails, err := createServerDetailsWithConfigOffer(c)
if err != nil {
return err
}
serverDetails, err := createServerDetailsWithConfigOffer(c)
err = validateXrayContext(c, serverDetails)
if err != nil {
return err
}
Expand Down Expand Up @@ -344,12 +344,11 @@ func BuildScan(c *cli.Context) error {
if err := buildConfiguration.ValidateBuildParams(); err != nil {
return err
}

serverDetails, err := createServerDetailsWithConfigOffer(c)
if err != nil {
return err
}
err = validateXrayContext(c)
err = validateXrayContext(c, serverDetails)
if err != nil {
return err
}
Expand Down Expand Up @@ -378,11 +377,11 @@ func DockerScan(c *cli.Context, image string) error {
if image == "" {
return cli.ShowCommandHelp(c, "dockerscanhelp")
}
err := validateXrayContext(c)
serverDetails, err := createServerDetailsWithConfigOffer(c)
if err != nil {
return err
}
serverDetails, err := createServerDetailsWithConfigOffer(c)
err = validateXrayContext(c, serverDetails)
if err != nil {
return err
}
Expand Down Expand Up @@ -443,7 +442,10 @@ func shouldIncludeVulnerabilities(c *cli.Context) bool {
return c.String("watches") == "" && !isProjectProvided(c) && c.String("repo-path") == ""
}

func validateXrayContext(c *cli.Context) error {
func validateXrayContext(c *cli.Context, serverDetails *coreconfig.ServerDetails) error {
if serverDetails.XrayUrl == "" {
return errorutils.CheckErrorf("JFrog Xray URL should be provided to run this command")
}
contextFlag := 0
if c.String("watches") != "" {
contextFlag++
Expand Down

0 comments on commit a495e0b

Please sign in to comment.