Skip to content

Commit

Permalink
Audit - added support for Yarn V1 (#2099)
Browse files Browse the repository at this point in the history
* added integration tests for yarn v1 (similar to yarn v2) + added test suitcase for the tests

* deleted old test for yarn v1 blocking

* pushed updated go.mod and go.sum for testing

* updating go.mod files to get the latest changes from other modules

* updating go.mod

* updating go.mod

* updated go.mod & added new git action to xrayTests.yml

* updated xrayTests.yml

* updating go.mod

* updating go.mod

* updating xrayTests.yml

* updating xrayTests.yml

* updating xrayTests.yml

* updated go.mod

* added new commands to git actions for xRay

* .

* minor update for the tests to run again after updating secrets

* updating go.mod

* updating go.mod and adding git action

* moved got action from cli to build-info-go

* updating go.mod

* updated go.mod

* updated go.mod

* manually changing back faulty push

* go.mod

* Update CLI-for-JFrog-Artifactory.md

fixing readme file

* updating file

* updating go.mod
  • Loading branch information
eranturgeman authored Aug 3, 2023
1 parent ce58cfb commit 2d33908
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/xrayTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }}
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand All @@ -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=
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
21 changes: 13 additions & 8 deletions xray_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
})
}

Expand Down

0 comments on commit 2d33908

Please sign in to comment.