diff --git a/.github/workflows/xrayTests.yml b/.github/workflows/xrayTests.yml index ca2399a8c..e540c76cc 100644 --- a/.github/workflows/xrayTests.yml +++ b/.github/workflows/xrayTests.yml @@ -66,4 +66,4 @@ jobs: if: ${{ matrix.os != 'ubuntu-latest' }} - name: Run Docker scan and Xray tests run: go test -v github.com/jfrog/jfrog-cli --timeout 0 --test.xray --test.dockerScan --jfrog.url=${{ secrets.PLATFORM_URL }} --jfrog.adminToken=${{ secrets.PLATFORM_ADMIN_TOKEN }} --test.containerRegistry=${{ secrets.CONTAINER_REGISTRY }} - if: ${{ matrix.os == 'ubuntu-latest' }} + if: ${{ matrix.os == 'ubuntu-latest' }} \ No newline at end of file diff --git a/go.mod b/go.mod index 8d398fc2f..32065dd84 100644 --- a/go.mod +++ b/go.mod @@ -59,7 +59,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/uuid v1.3.0 // indirect - github.com/gookit/color v1.5.3 // indirect + github.com/gookit/color v1.5.4 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/imdario/mergo v0.3.15 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect @@ -124,10 +124,10 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect ) -replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20230802162944-bbeb4808928e +replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20230803131422-8230595ceb86 -replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230802170928-2fc5fc0a4a20 +replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230803144835-5e55e9527c77 // replace github.com/jfrog/gofrog => github.com/jfrog/gofrog v1.2.6-0.20230418122323-2bf299dd6d27 -// replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20230730114019-1d6985b1f8bd +replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20230803140217-0a5f43783ae8 diff --git a/go.sum b/go.sum index 5f3005806..f0ca331c6 100644 --- a/go.sum +++ b/go.sum @@ -224,8 +224,8 @@ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= -github.com/gookit/color v1.5.3 h1:twfIhZs4QLCtimkP7MOxlF3A0U/5cDPseRT9M/+2SCE= -github.com/gookit/color v1.5.3/go.mod h1:NUzwzeehUfl7GIb36pqId+UGmRfQcU/WiiyTTeNjHtE= +github.com/gookit/color v1.5.4 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0= +github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= @@ -238,14 +238,14 @@ github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOl github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jedib0t/go-pretty/v6 v6.4.6 h1:v6aG9h6Uby3IusSSEjHaZNXpHFhzqMmjXcPq1Rjl9Jw= github.com/jedib0t/go-pretty/v6 v6.4.6/go.mod h1:Ndk3ase2CkQbXLLNf5QDHoYb6J9WtVfmHZu9n8rk2xs= -github.com/jfrog/build-info-go v1.8.9-0.20230802162944-bbeb4808928e h1:pJ9Twk5MbxtSKUx2GYJRyXU2EbWgl1L4K09NSBAkILk= -github.com/jfrog/build-info-go v1.8.9-0.20230802162944-bbeb4808928e/go.mod h1:PkSKcqdz/L4JnNo51rXTeZtCWHVDLu0O0KiQHXagqc4= +github.com/jfrog/build-info-go v1.8.9-0.20230803131422-8230595ceb86 h1:Z6XX3+FxjxrDhAmGNnDbMToj5v+cNLfeR6wBcL8Va2A= +github.com/jfrog/build-info-go v1.8.9-0.20230803131422-8230595ceb86/go.mod h1:PkSKcqdz/L4JnNo51rXTeZtCWHVDLu0O0KiQHXagqc4= 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.20230802170928-2fc5fc0a4a20 h1:roLCXmOnEOvVf3/OyRBhc8GHBSNVRTcFWzZMMo0jY8g= -github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230802170928-2fc5fc0a4a20/go.mod h1:C0JjF3tj9vjLc5yw1g6nqTm477HY4xW/7yojGWc3v3Q= -github.com/jfrog/jfrog-client-go v1.31.3 h1:Q6xyBdyrwusxuPv+cd1hwS0/tjrJrFAGc1JxrDkryF0= -github.com/jfrog/jfrog-client-go v1.31.3/go.mod h1:qEJxoe68sUtqHJ1YhXv/7pKYP/9p1D5tJrruzJKYeoI= +github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230803144835-5e55e9527c77 h1:OfAEz+gTE2MaVla8ZmucrgxtffqTeDODCFWzApn2+00= +github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230803144835-5e55e9527c77/go.mod h1:N5nZzYY8wI4s87rKJ7oCCZQJoEalDBftk2unYxZxSRo= +github.com/jfrog/jfrog-client-go v1.28.1-0.20230803140217-0a5f43783ae8 h1:wxZ0QqpLhzhCCqIIDC1kdgTvTXuu20fEjrTZbadae4E= +github.com/jfrog/jfrog-client-go v1.28.1-0.20230803140217-0a5f43783ae8/go.mod h1:Onjkbp33vF8Nzplr7s+XynqwSqmsuk8X/nODqU2EHJU= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jszwec/csvutil v1.8.0 h1:G7vS2LGdpZZDH1HmHeNbxOaJ/ZnJlpwGFvOkTkJzzNk= diff --git a/testdata/xray/yarn/.yarn/releases/yarn-3.2.1.cjs b/testdata/xray/yarn-v2/.yarn/releases/yarn-3.2.1.cjs similarity index 100% rename from testdata/xray/yarn/.yarn/releases/yarn-3.2.1.cjs rename to testdata/xray/yarn-v2/.yarn/releases/yarn-3.2.1.cjs diff --git a/testdata/xray/yarn/.yarnrc.yml b/testdata/xray/yarn-v2/.yarnrc.yml similarity index 100% rename from testdata/xray/yarn/.yarnrc.yml rename to testdata/xray/yarn-v2/.yarnrc.yml diff --git a/testdata/xray/yarn/package.json b/testdata/xray/yarn-v2/package.json similarity index 100% rename from testdata/xray/yarn/package.json rename to testdata/xray/yarn-v2/package.json diff --git a/testdata/xray/yarn/yarn.lock b/testdata/xray/yarn-v2/yarn.lock similarity index 100% rename from testdata/xray/yarn/yarn.lock rename to testdata/xray/yarn-v2/yarn.lock diff --git a/xray_test.go b/xray_test.go index 89527d1c2..961ede245 100644 --- a/xray_test.go +++ b/xray_test.go @@ -27,7 +27,6 @@ import ( "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" - "github.com/jfrog/jfrog-cli-core/v2/xray/audit/yarn" 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" @@ -163,24 +162,30 @@ func testXrayAuditNpm(t *testing.T, format string) string { return xrayCli.RunCliCmdWithOutput(t, "audit", "--npm", "--licenses", "--format="+format) } -func TestXrayAuditYarnJson(t *testing.T) { - testXrayAuditYarn(t, "yarn", func() { +func TestXrayAuditYarnV2Json(t *testing.T) { + testXrayAuditYarn(t, "yarn-v2", func() { output := runXrayAuditYarnWithOutput(t, string(utils.Json)) verifyJsonScanResults(t, output, 0, 1, 1) }) } -func TestXrayAuditYarnSimpleJson(t *testing.T) { - testXrayAuditYarn(t, "yarn", func() { +func TestXrayAuditYarnV2SimpleJson(t *testing.T) { + testXrayAuditYarn(t, "yarn-v2", func() { output := runXrayAuditYarnWithOutput(t, string(utils.SimpleJson)) verifySimpleJsonScanResults(t, output, 1, 1) }) } -func TestXrayAuditYarnV1(t *testing.T) { +func TestXrayAuditYarnV1Json(t *testing.T) { testXrayAuditYarn(t, "yarn-v1", func() { - err := xrayCli.Exec("audit", "--yarn") - assert.ErrorContains(t, err, yarn.YarnV1ErrorPrefix) + output := runXrayAuditYarnWithOutput(t, string(utils.Json)) + verifyJsonScanResults(t, output, 0, 1, 1) + }) +} +func TestXrayAuditYarnV1SimpleJson(t *testing.T) { + testXrayAuditYarn(t, "yarn-v1", func() { + output := runXrayAuditYarnWithOutput(t, string(utils.SimpleJson)) + verifySimpleJsonScanResults(t, output, 1, 1) }) }