Skip to content

Commit

Permalink
Update Cli-Core (#2182)
Browse files Browse the repository at this point in the history
  • Loading branch information
sverdlov93 authored Sep 4, 2023
1 parent 70224ad commit f2ef83f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
1 change: 1 addition & 0 deletions .github/workflows/frogbot-scan-repository.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ permissions:
security-events: write
jobs:
scan-repository:
name: Scan Repository (${{ matrix.branch }})
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ require (

// replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20230828134416-f0db33dd9344

replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230904093105-ce71e69b2f07
replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230904170814-03a7938bae94

// replace github.com/jfrog/gofrog => github.com/jfrog/gofrog v1.2.6-0.20230418122323-2bf299dd6d27

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ github.com/jfrog/build-info-go v1.8.9-0.20230831151231-e5e7bd035ddc h1:pqu82clhP
github.com/jfrog/build-info-go v1.8.9-0.20230831151231-e5e7bd035ddc/go.mod h1:QEskae5fQpjeY2PBzsjWtUQVskYSNDF2sSmw/Gx44dQ=
github.com/jfrog/gofrog v1.3.0 h1:o4zgsBZE4QyDbz2M7D4K6fXPTBJht+8lE87mS9bw7Gk=
github.com/jfrog/gofrog v1.3.0/go.mod h1:IFMc+V/yf7rA5WZ74CSbXe+Lgf0iApEQLxRZVzKRUR0=
github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230904093105-ce71e69b2f07 h1:8bqiTnKxyZkqZNXYf+9cFxL7P15qZ5VtP50McAMBKEw=
github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230904093105-ce71e69b2f07/go.mod h1:eQJU+jDTcPVqOeHNheURqkMEMXDVNQFKKjcyVEa0058=
github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230904170814-03a7938bae94 h1:rAV/hUZNruzYOfGUqE5ubPY55NMtS59llfTcWGwofSg=
github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230904170814-03a7938bae94/go.mod h1:eQJU+jDTcPVqOeHNheURqkMEMXDVNQFKKjcyVEa0058=
github.com/jfrog/jfrog-client-go v1.28.1-0.20230904070427-f3f2a103d9e2 h1:uPDFvUv+3kAUyTR6gAhROAgsjnPe2jsxzqJSkjbIHmE=
github.com/jfrog/jfrog-client-go v1.28.1-0.20230904070427-f3f2a103d9e2/go.mod h1:uUnMrqHX7Xi+OCaZEE4b3BtsmGeOSCB7XqaEWVXEH/E=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
Expand Down
3 changes: 1 addition & 2 deletions scan/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package scan

import (
"github.com/jfrog/jfrog-cli-core/v2/xray/commands/curation"
xrCmdUtils "github.com/jfrog/jfrog-cli-core/v2/xray/commands/utils"
xrutils "github.com/jfrog/jfrog-cli-core/v2/xray/utils"
curationdocs "github.com/jfrog/jfrog-cli/docs/scan/curation"
"os"
Expand Down Expand Up @@ -208,7 +207,7 @@ func AuditSpecificCmd(c *cli.Context, technology coreutils.Technology) error {
}

func CurationCmd(c *cli.Context) error {
threads, err := xrCmdUtils.DetectNumOfThreads(c.Int("threads"))
threads, err := curation.DetectNumOfThreads(c.Int("threads"))
if err != nil {
return err
}
Expand Down
36 changes: 18 additions & 18 deletions xray_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"flag"
"fmt"
biutils "github.com/jfrog/build-info-go/utils"
"github.com/jfrog/jfrog-cli-core/v2/xray/scangraph"
"net/http"
"net/http/httptest"
"os"
Expand All @@ -24,13 +25,12 @@ import (
artUtils "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils"
"github.com/jfrog/jfrog-cli-core/v2/artifactory/utils/container"
coreCmd "github.com/jfrog/jfrog-cli-core/v2/common/commands"
tests2 "github.com/jfrog/jfrog-cli-core/v2/common/tests"
commontests "github.com/jfrog/jfrog-cli-core/v2/common/tests"
"github.com/jfrog/jfrog-cli-core/v2/utils/config"
"github.com/jfrog/jfrog-cli-core/v2/utils/coreutils"
coretests "github.com/jfrog/jfrog-cli-core/v2/utils/tests"
coreCuration "github.com/jfrog/jfrog-cli-core/v2/xray/commands/curation"
"github.com/jfrog/jfrog-cli-core/v2/xray/commands/scan"
commands "github.com/jfrog/jfrog-cli-core/v2/xray/commands/utils"
"github.com/jfrog/jfrog-cli-core/v2/xray/formats"
"github.com/jfrog/jfrog-cli-core/v2/xray/utils"
"github.com/jfrog/jfrog-cli/inttestutils"
Expand Down Expand Up @@ -114,13 +114,13 @@ func TestXrayBinaryScanSimpleJsonWithProgress(t *testing.T) {
}

func testXrayBinaryScan(t *testing.T, format string) string {
initXrayTest(t, commands.GraphScanMinXrayVersion)
initXrayTest(t, scangraph.GraphScanMinXrayVersion)
binariesPath := filepath.Join(filepath.FromSlash(tests.GetTestResourcesPath()), "xray", "binaries", "*")
return xrayCli.RunCliCmdWithOutput(t, "scan", binariesPath, "--licenses", "--format="+format)
}

func TestXrayBinaryScanWithBypassArchiveLimits(t *testing.T) {
initXrayTest(t, commands.BypassArchiveLimitsMinXrayVersion)
initXrayTest(t, scan.BypassArchiveLimitsMinXrayVersion)
unsetEnv := clientTestUtils.SetEnvWithCallbackAndAssert(t, "JF_INDEXER_COMPRESS_MAXENTITIES", "10")
defer unsetEnv()
binariesPath := filepath.Join(filepath.FromSlash(tests.GetTestResourcesPath()), "xray", "binaries", "*")
Expand Down Expand Up @@ -148,7 +148,7 @@ func TestXrayAuditNpmSimpleJson(t *testing.T) {
}

func testXrayAuditNpm(t *testing.T, format string) string {
initXrayTest(t, commands.GraphScanMinXrayVersion)
initXrayTest(t, scangraph.GraphScanMinXrayVersion)
tempDirPath, createTempDirCallback := coretests.CreateTempDirWithCallbackAndAssert(t)
defer createTempDirCallback()
npmProjectPath := filepath.Join(filepath.FromSlash(tests.GetTestResourcesPath()), "xray", "npm")
Expand Down Expand Up @@ -191,7 +191,7 @@ func TestXrayAuditYarnV1SimpleJson(t *testing.T) {
}

func testXrayAuditYarn(t *testing.T, projectDirName string, yarnCmd func()) {
initXrayTest(t, commands.GraphScanMinXrayVersion)
initXrayTest(t, scangraph.GraphScanMinXrayVersion)
tempDirPath, createTempDirCallback := coretests.CreateTempDirWithCallbackAndAssert(t)
defer createTempDirCallback()
yarnProjectPath := filepath.Join(filepath.FromSlash(tests.GetTestResourcesPath()), "xray", projectDirName)
Expand Down Expand Up @@ -228,7 +228,7 @@ func TestXrayAuditNugetMultiProject(t *testing.T) {
}

func testXrayAuditNuget(t *testing.T, projectName, format string) string {
initXrayTest(t, commands.GraphScanMinXrayVersion)
initXrayTest(t, scangraph.GraphScanMinXrayVersion)
tempDirPath, createTempDirCallback := coretests.CreateTempDirWithCallbackAndAssert(t)
defer createTempDirCallback()
projectPath := filepath.Join(filepath.FromSlash(tests.GetTestResourcesPath()), "xray", "nuget", projectName)
Expand All @@ -254,7 +254,7 @@ func TestXrayAuditGradleSimpleJson(t *testing.T) {
}

func testXrayAuditGradle(t *testing.T, format string) string {
initXrayTest(t, commands.GraphScanMinXrayVersion)
initXrayTest(t, scangraph.GraphScanMinXrayVersion)
tempDirPath, createTempDirCallback := coretests.CreateTempDirWithCallbackAndAssert(t)
defer createTempDirCallback()
gradleProjectPath := filepath.Join(filepath.FromSlash(tests.GetTestResourcesPath()), "xray", "gradle")
Expand All @@ -278,7 +278,7 @@ func TestXrayAuditMavenSimpleJson(t *testing.T) {
}

func testXrayAuditMaven(t *testing.T, format string) string {
initXrayTest(t, commands.GraphScanMinXrayVersion)
initXrayTest(t, scangraph.GraphScanMinXrayVersion)
tempDirPath, createTempDirCallback := coretests.CreateTempDirWithCallbackAndAssert(t)
defer createTempDirCallback()
mvnProjectPath := filepath.Join(filepath.FromSlash(tests.GetTestResourcesPath()), "xray", "maven")
Expand All @@ -292,7 +292,7 @@ func testXrayAuditMaven(t *testing.T, format string) string {
}

func TestXrayAuditNoTech(t *testing.T) {
initXrayTest(t, commands.GraphScanMinXrayVersion)
initXrayTest(t, scangraph.GraphScanMinXrayVersion)
tempDirPath, createTempDirCallback := coretests.CreateTempDirWithCallbackAndAssert(t)
defer createTempDirCallback()
prevWd := changeWD(t, tempDirPath)
Expand All @@ -303,7 +303,7 @@ func TestXrayAuditNoTech(t *testing.T) {
}

func TestXrayAuditDetectTech(t *testing.T) {
initXrayTest(t, commands.GraphScanMinXrayVersion)
initXrayTest(t, scangraph.GraphScanMinXrayVersion)
tempDirPath, createTempDirCallback := coretests.CreateTempDirWithCallbackAndAssert(t)
defer createTempDirCallback()
mvnProjectPath := filepath.Join(filepath.FromSlash(tests.GetTestResourcesPath()), "xray", "maven")
Expand All @@ -321,7 +321,7 @@ func TestXrayAuditDetectTech(t *testing.T) {
}

func TestXrayAuditMultiProjects(t *testing.T) {
initXrayTest(t, commands.GraphScanMinXrayVersion)
initXrayTest(t, scangraph.GraphScanMinXrayVersion)
tempDirPath, createTempDirCallback := coretests.CreateTempDirWithCallbackAndAssert(t)
defer createTempDirCallback()
multiProject := filepath.Join(filepath.FromSlash(tests.GetTestResourcesPath()), "xray")
Expand Down Expand Up @@ -359,7 +359,7 @@ func TestXrayAuditPipSimpleJsonWithRequirementsFile(t *testing.T) {
}

func testXrayAuditPip(t *testing.T, format, requirementsFile string) string {
initXrayTest(t, commands.GraphScanMinXrayVersion)
initXrayTest(t, scangraph.GraphScanMinXrayVersion)
tempDirPath, createTempDirCallback := coretests.CreateTempDirWithCallbackAndAssert(t)
defer createTempDirCallback()
pipProjectPath := filepath.Join(filepath.FromSlash(tests.GetTestResourcesPath()), "xray", "python", "pip")
Expand Down Expand Up @@ -388,7 +388,7 @@ func TestXrayAuditPipenvSimpleJson(t *testing.T) {
}

func testXrayAuditPipenv(t *testing.T, format string) string {
initXrayTest(t, commands.GraphScanMinXrayVersion)
initXrayTest(t, scangraph.GraphScanMinXrayVersion)
tempDirPath, createTempDirCallback := coretests.CreateTempDirWithCallbackAndAssert(t)
defer createTempDirCallback()
pipenvProjectPath := filepath.Join(filepath.FromSlash(tests.GetTestResourcesPath()), "xray", "python", "pipenv")
Expand Down Expand Up @@ -450,7 +450,7 @@ func TestXrayAuditPoetrySimpleJson(t *testing.T) {
}

func testXrayAuditPoetry(t *testing.T, format string) string {
initXrayTest(t, commands.GraphScanMinXrayVersion)
initXrayTest(t, scangraph.GraphScanMinXrayVersion)
tempDirPath, createTempDirCallback := coretests.CreateTempDirWithCallbackAndAssert(t)
defer createTempDirCallback()
poetryProjectPath := filepath.Join(filepath.FromSlash(tests.GetTestResourcesPath()), "xray", "python", "poetry")
Expand Down Expand Up @@ -615,7 +615,7 @@ func runDockerScan(t *testing.T, imageName, watchName string, minViolations, min

func createTestWatch(t *testing.T) (string, func()) {
trueValue := true
xrayManager, err := commands.CreateXrayServiceManager(xrayDetails)
xrayManager, err := utils.CreateXrayServiceManager(xrayDetails)
assert.NoError(t, err)
// Create new default policy.
policyParams := xrayUtils.PolicyParams{
Expand Down Expand Up @@ -679,7 +679,7 @@ func TestXrayAuditJasNoViolationsSimpleJson(t *testing.T) {
}

func testXrayAuditJas(t *testing.T, format string, project string) string {
initXrayTest(t, commands.GraphScanMinXrayVersion)
initXrayTest(t, scangraph.GraphScanMinXrayVersion)
tempDirPath, createTempDirCallback := coretests.CreateTempDirWithCallbackAndAssert(t)
defer createTempDirCallback()
projectDir := filepath.Join(filepath.FromSlash(tests.GetTestResourcesPath()), filepath.Join("xray", project))
Expand Down Expand Up @@ -803,7 +803,7 @@ func getCurationExpectedResponse(config *config.ServerDetails) []coreCuration.Pa

func curationServer(t *testing.T, expectedRequest map[string]bool, requestToFail map[string]bool) (*httptest.Server, *config.ServerDetails) {
mapLockReadWrite := sync.Mutex{}
serverMock, config, _ := tests2.CreateRtRestsMockServer(t, func(w http.ResponseWriter, r *http.Request) {
serverMock, config, _ := commontests.CreateRtRestsMockServer(t, func(w http.ResponseWriter, r *http.Request) {
if r.Method == http.MethodHead {
mapLockReadWrite.Lock()
if _, exist := expectedRequest[r.RequestURI]; exist {
Expand Down

0 comments on commit f2ef83f

Please sign in to comment.