Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audit - added support for Yarn V1 #2099

Merged
merged 34 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
602b5e2
added integration tests for yarn v1 (similar to yarn v2) + added test…
eranturgeman Jul 26, 2023
032f4d2
deleted old test for yarn v1 blocking
eranturgeman Jul 26, 2023
75c9b0f
pushed updated go.mod and go.sum for testing
eranturgeman Jul 26, 2023
b5cc921
updating go.mod files to get the latest changes from other modules
eranturgeman Jul 27, 2023
d2dd15d
updating go.mod
eranturgeman Jul 27, 2023
07a3fb8
updating go.mod
eranturgeman Jul 30, 2023
356f1ec
updated go.mod & added new git action to xrayTests.yml
eranturgeman Jul 30, 2023
519e147
updated xrayTests.yml
eranturgeman Jul 31, 2023
5774616
Merge branch 'dev' into yarn1-support-new
eranturgeman Jul 31, 2023
f5aa9bd
updating go.mod
eranturgeman Jul 31, 2023
196d6d2
updating go.mod
eranturgeman Jul 31, 2023
172ec65
Merge remote-tracking branch 'refs/remotes/erant-fork/yarn1-support-n…
eranturgeman Jul 31, 2023
411ab8e
updating xrayTests.yml
eranturgeman Jul 31, 2023
83d6d6e
updating xrayTests.yml
eranturgeman Jul 31, 2023
ac3abe3
updating xrayTests.yml
eranturgeman Jul 31, 2023
9003f45
Merge branch 'dev' of https://github.com/jfrog/jfrog-cli into yarn1-s…
eranturgeman Jul 31, 2023
7d804d6
updated go.mod
eranturgeman Jul 31, 2023
4388f4b
added new commands to git actions for xRay
eranturgeman Jul 31, 2023
3d91291
.
eranturgeman Jul 31, 2023
a4a5824
minor update for the tests to run again after updating secrets
eranturgeman Jul 31, 2023
ff4d76a
updating go.mod
eranturgeman Jul 31, 2023
d64fa2a
updating go.mod and adding git action
eranturgeman Aug 1, 2023
2e7b9ee
moved got action from cli to build-info-go
eranturgeman Aug 1, 2023
0f08f31
updating go.mod
eranturgeman Aug 1, 2023
ba894c2
Merge branch 'dev' into yarn1-support-new
eranturgeman Aug 2, 2023
cf88871
updating go.mod
eranturgeman Aug 2, 2023
f45c4e8
updated go.mod
eranturgeman Aug 3, 2023
5545c9a
Merge branch 'dev' into yarn1-support-new
eranturgeman Aug 3, 2023
ca1c984
updated go.mod
eranturgeman Aug 3, 2023
eb96b33
manually changing back faulty push
eranturgeman Aug 3, 2023
f92d032
go.mod
eranturgeman Aug 3, 2023
4bc451e
Update CLI-for-JFrog-Artifactory.md
eranturgeman Aug 3, 2023
e24ea63
updating file
eranturgeman Aug 3, 2023
46ee162
updating go.mod
eranturgeman Aug 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading