Skip to content

Commit

Permalink
JFrog Curation - Support "Implicit curation" - Run curation after "in…
Browse files Browse the repository at this point in the history
…stall" command failure (#2639)
  • Loading branch information
asafambar authored Aug 29, 2024
1 parent 8336d6f commit e6e3c17
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
25 changes: 20 additions & 5 deletions buildtools/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package buildtools
import (
"errors"
"fmt"
"github.com/jfrog/jfrog-cli-security/utils/techutils"
"os"
"strconv"
"strings"
Expand Down Expand Up @@ -91,7 +92,10 @@ func GetCommands() []cli.Command {
SkipFlagParsing: true,
BashComplete: corecommon.CreateBashCompletionFunc(),
Category: buildToolsCategory,
Action: MvnCmd,
Action: func(c *cli.Context) (err error) {
cmdName, _ := getCommandName(c.Args())
return securityCLI.WrapCmdWithCurationPostFailureRun(c, MvnCmd, techutils.Maven, cmdName)
},
},
{
Name: "gradle-config",
Expand Down Expand Up @@ -215,7 +219,10 @@ func GetCommands() []cli.Command {
SkipFlagParsing: true,
BashComplete: corecommon.CreateBashCompletionFunc(),
Category: buildToolsCategory,
Action: GoCmd,
Action: func(c *cli.Context) (err error) {
cmdName, _ := getCommandName(c.Args())
return securityCLI.WrapCmdWithCurationPostFailureRun(c, GoCmd, techutils.Go, cmdName)
},
},
{
Name: "go-publish",
Expand Down Expand Up @@ -252,7 +259,10 @@ func GetCommands() []cli.Command {
SkipFlagParsing: true,
BashComplete: corecommon.CreateBashCompletionFunc(),
Category: buildToolsCategory,
Action: PipCmd,
Action: func(c *cli.Context) (err error) {
cmdName, _ := getCommandName(c.Args())
return securityCLI.WrapCmdWithCurationPostFailureRun(c, PipCmd, techutils.Pip, cmdName)
},
},
{
Name: "pipenv-config",
Expand Down Expand Up @@ -325,9 +335,13 @@ func GetCommands() []cli.Command {
SkipFlagParsing: true,
BashComplete: corecommon.CreateBashCompletionFunc("install", "i", "isntall", "add", "ci", "publish", "p"),
Category: buildToolsCategory,
Action: func(c *cli.Context) error {
Action: func(c *cli.Context) (errFromCmd error) {
cmdName, _ := getCommandName(c.Args())
return npmGenericCmd(c, cmdName, false)
return securityCLI.WrapCmdWithCurationPostFailureRun(c,
func(c *cli.Context) error {
return npmGenericCmd(c, cmdName, false)
},
techutils.Npm, cmdName)
},
},
{
Expand Down Expand Up @@ -831,6 +845,7 @@ func npmGenericCmd(c *cli.Context, cmdName string, collectBuildInfoIfRequested b

// Run generic npm command.
npmCmd := npm.NewNpmCommand(cmdName, collectBuildInfoIfRequested)

configFilePath, args, err := GetNpmConfigAndArgs(c)
if err != nil {
return err
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ require (
github.com/docker/go-units v0.5.0 // indirect
github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/fatih/color v1.17.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/forPelevin/gomoji v1.2.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
Expand Down Expand Up @@ -176,6 +177,6 @@ replace github.com/jfrog/jfrog-cli-security => github.com/attiasas/jfrog-cli-sec

// replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20240806162439-01bb7dcd43fc

// replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20240804091815-7407ceb49077
replace github.com/jfrog/build-info-go => github.com/asafambar/build-info-go v1.8.9-0.20240819133117-c3f52700927d

// replace github.com/jfrog/gofrog => github.com/jfrog/gofrog dev
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,8 @@ github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/asafambar/build-info-go v1.8.9-0.20240819133117-c3f52700927d h1:GS9yDbl7Moer5ODbWu+DPcQtyCYlmRL4TAdt1l+b/Vo=
github.com/asafambar/build-info-go v1.8.9-0.20240819133117-c3f52700927d/go.mod h1:6mdtqjREK76bHNODXakqKR/+ksJ9dvfLS7H57BZtnLY=
github.com/attiasas/jfrog-cli-security v0.0.0-20240828061232-6cb16f5dd7ef h1:TE2MFFvWKw6SblR3yEGDftRJrIfhReix0zYMWexfFls=
github.com/attiasas/jfrog-cli-security v0.0.0-20240828061232-6cb16f5dd7ef/go.mod h1:VRMOAgJzP8JDABOJs5PU2Ph7SiutOK4NffASTdoPcq8=
github.com/beevik/etree v1.4.0 h1:oz1UedHRepuY3p4N5OjE0nK1WLCqtzHf25bxplKOHLs=
Expand Down Expand Up @@ -739,8 +741,8 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7
github.com/envoyproxy/protoc-gen-validate v0.6.7/go.mod h1:dyJXwwfPK2VSqiB9Klm1J6romD608Ba7Hij42vrOBCo=
github.com/envoyproxy/protoc-gen-validate v0.9.1/go.mod h1:OKNgG7TCp5pF4d6XftA0++PMirau2/yoOwVac3AbF2w=
github.com/envoyproxy/protoc-gen-validate v0.10.0/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss=
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
Expand Down Expand Up @@ -933,8 +935,6 @@ github.com/jedib0t/go-pretty/v6 v6.5.9 h1:ACteMBRrrmm1gMsXe9PSTOClQ63IXDUt03H5U+
github.com/jedib0t/go-pretty/v6 v6.5.9/go.mod h1:zbn98qrYlh95FIhwwsbIip0LYpwSG8SUOScs+v9/t0E=
github.com/jfrog/archiver/v3 v3.6.1 h1:LOxnkw9pOn45DzCbZNFV6K0+6dCsQ0L8mR3ZcujO5eI=
github.com/jfrog/archiver/v3 v3.6.1/go.mod h1:VgR+3WZS4N+i9FaDwLZbq+jeU4B4zctXL+gL4EMzfLw=
github.com/jfrog/build-info-go v1.9.35 h1:P53Ckbuin0GYrq0LWMY0GZSptJcQwiUyW6lqTbXKdcc=
github.com/jfrog/build-info-go v1.9.35/go.mod h1:6mdtqjREK76bHNODXakqKR/+ksJ9dvfLS7H57BZtnLY=
github.com/jfrog/froggit-go v1.16.1 h1:FBIM1qevX/ag9unfmpGzfmZ36D8ulOJ+DPTSFUk3l5U=
github.com/jfrog/froggit-go v1.16.1/go.mod h1:TEJSzgiV+3D/GVGE8Y6j46ut1jrBLD1FL6WdMdKwwCE=
github.com/jfrog/gofrog v1.7.5 h1:dFgtEDefJdlq9cqTRoe09RLxS5Bxbe1Ev5+E6SmZHcg=
Expand Down

0 comments on commit e6e3c17

Please sign in to comment.