diff --git a/.github/workflows/xrayTests.yml b/.github/workflows/xrayTests.yml index a8f2df07d..e5e79fe08 100644 --- a/.github/workflows/xrayTests.yml +++ b/.github/workflows/xrayTests.yml @@ -19,6 +19,7 @@ jobs: strategy: fail-fast: false matrix: + suite: [ xray, xsc ] os: [ ubuntu, windows, macos ] runs-on: ${{ matrix.os }}-latest env: @@ -65,7 +66,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - name: Run Xray tests (without Docker Scan) - run: go test -v github.com/jfrog/jfrog-cli --timeout 0 --test.xray --jfrog.url=${{ secrets.PLATFORM_URL }} --jfrog.adminToken=${{ secrets.PLATFORM_ADMIN_TOKEN }} --jfrog.user=${{ secrets.PLATFORM_USER }} --test.containerRegistry=${{ secrets.CONTAINER_REGISTRY }} + run: go test -v github.com/jfrog/jfrog-cli --timeout 0 --test.${{matrix.suite}} --jfrog.url=${{ secrets.PLATFORM_URL }} --jfrog.adminToken=${{ secrets.PLATFORM_ADMIN_TOKEN }} --jfrog.user=${{ secrets.PLATFORM_USER }} --test.containerRegistry=${{ secrets.CONTAINER_REGISTRY }} if: ${{ matrix.os != 'ubuntu' }} - name: Run Xray tests (with Docker Scan, only on Ubuntu) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d9bd3949d..56422d4f5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -110,6 +110,7 @@ The available test types are: | `-test.distribution` | Distribution tests | | `-test.transfer` | Transfer tests | | `-test.xray` | Xray tests | +| `-test.xsc` | Xsc tests | When running the tests, builds and repositories with timestamps will be created, for example: `cli-rt1-1592990748` and `cli-rt2-1592990748`. The content of these repositories will be deleted once the tests are completed. diff --git a/go.mod b/go.mod index 7f67c2b4b..19f8d34ca 100644 --- a/go.mod +++ b/go.mod @@ -125,10 +125,10 @@ 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.20230907095444-fd00f19be95d +replace github.com/jfrog/jfrog-cli-core/v2 => github.com/eyaldelarea/jfrog-cli-core/v2 v2.0.0-20230910120756-f1d0181a0403 // 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.20230906115540-2c3c91d271d6 +replace github.com/jfrog/jfrog-client-go => github.com/eyaldelarea/jfrog-client-go v1.28.1-0.20230910120113-823b4c7b06b7 replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20230905120411-62d1bdd4eb38 diff --git a/go.sum b/go.sum index f5dd5a740..51f449dd0 100644 --- a/go.sum +++ b/go.sum @@ -133,6 +133,10 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/eyaldelarea/jfrog-cli-core/v2 v2.0.0-20230910120756-f1d0181a0403 h1:A7QvUrYpcqNmXpqGvZIwCet2u0C4VmMsqOW1aw0/K7g= +github.com/eyaldelarea/jfrog-cli-core/v2 v2.0.0-20230910120756-f1d0181a0403/go.mod h1:D5BnCwgET5TWtmyPYgfoUhShN9egbpfdSSP1cqvS99M= +github.com/eyaldelarea/jfrog-client-go v1.28.1-0.20230910120113-823b4c7b06b7 h1:g97j04e90zFXJMabA8RmccWbEXxDwKpQ+afBeainJmg= +github.com/eyaldelarea/jfrog-client-go v1.28.1-0.20230910120113-823b4c7b06b7/go.mod h1:soD5VL3X+G+0KKUNSlb0CSdF9nwHsQZCr0xqOGedAHM= github.com/forPelevin/gomoji v1.1.8 h1:JElzDdt0TyiUlecy6PfITDL6eGvIaxqYH1V52zrd0qQ= github.com/forPelevin/gomoji v1.1.8/go.mod h1:8+Z3KNGkdslmeGZBC3tCrwMrcPy5GRzAD+gL9NAwMXg= github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= @@ -239,10 +243,6 @@ github.com/jfrog/build-info-go v1.8.9-0.20230905120411-62d1bdd4eb38 h1:XyAcwWP2a github.com/jfrog/build-info-go v1.8.9-0.20230905120411-62d1bdd4eb38/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.20230907095444-fd00f19be95d h1:7Qlsj5PkqSfayuNaM07L8W+H0bBqEGd+iPusoJOU6w8= -github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230907095444-fd00f19be95d/go.mod h1:PCRqGSz6tKQNtiITSk9WZGflJjno/Vg4DvXPLkH6xO8= -github.com/jfrog/jfrog-client-go v1.28.1-0.20230906115540-2c3c91d271d6 h1:9mNCAUu/uHx80s4rMc9PeI1lllrZ1MOPUesIMglFoTY= -github.com/jfrog/jfrog-client-go v1.28.1-0.20230906115540-2c3c91d271d6/go.mod h1:soD5VL3X+G+0KKUNSlb0CSdF9nwHsQZCr0xqOGedAHM= 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/main_test.go b/main_test.go index 96efc1218..017429f95 100644 --- a/main_test.go +++ b/main_test.go @@ -67,7 +67,7 @@ func setupIntegrationTests() { if *tests.TestPlugins { InitPluginsTests() } - if *tests.TestXray { + if *tests.TestXray || *tests.TestXsc { InitXrayTests() } if *tests.TestAccess { diff --git a/utils/tests/utils.go b/utils/tests/utils.go index 19540b144..5d278f6f5 100644 --- a/utils/tests/utils.go +++ b/utils/tests/utils.go @@ -68,6 +68,7 @@ var ( TestPoetry *bool TestPlugins *bool TestXray *bool + TestXsc *bool TestAccess *bool TestTransfer *bool TestLifecycle *bool @@ -104,6 +105,7 @@ func init() { TestPoetry = flag.Bool("test.poetry", false, "Test Poetry") TestPlugins = flag.Bool("test.plugins", false, "Test Plugins") TestXray = flag.Bool("test.xray", false, "Test Xray") + TestXsc = flag.Bool("test.xsc", false, "Test Xsc") TestAccess = flag.Bool("test.access", false, "Test Access") TestTransfer = flag.Bool("test.transfer", false, "Test files transfer") TestLifecycle = flag.Bool("test.lifecycle", false, "Test lifecycle") @@ -403,6 +405,7 @@ func GetNonVirtualRepositories() map[*string]string { TestPoetry: {&PoetryRemoteRepo}, TestPlugins: {&RtRepo1}, TestXray: {}, + TestXsc: {}, TestAccess: {&RtRepo1}, TestTransfer: {&RtRepo1, &RtRepo2, &MvnRepo1, &MvnRemoteRepo, &DockerRemoteRepo}, TestLifecycle: {&RtDevRepo, &RtProdRepo}, @@ -428,6 +431,7 @@ func GetVirtualRepositories() map[*string]string { TestPoetry: {&PoetryVirtualRepo}, TestPlugins: {}, TestXray: {}, + TestXsc: {}, TestAccess: {}, } return getNeededRepositories(virtualReposMap) diff --git a/xray_test.go b/xray_test.go index 6825ec193..963e9b22e 100644 --- a/xray_test.go +++ b/xray_test.go @@ -770,6 +770,11 @@ func TestCurationAudit(t *testing.T) { } } +func TestXscAudit(t *testing.T) { + output := testXrayAuditNpm(t, string(utils.SimpleJson)) + verifySimpleJsonScanResults(t, output, 1, 1) +} + func getCurationExpectedResponse(config *config.ServerDetails) []coreCuration.PackageStatus { expectedResp := []coreCuration.PackageStatus{ {