diff --git a/.github/workflows/pythonTests.yml b/.github/workflows/pythonTests.yml index d9e7dd0a7..fd937028b 100644 --- a/.github/workflows/pythonTests.yml +++ b/.github/workflows/pythonTests.yml @@ -27,10 +27,11 @@ jobs: uses: actions/setup-go@v3 with: go-version: 1.20.x + # Due to a bug in Python 3.12.0 we temporary use version 3.11.5 - name: Setup Python3 uses: actions/setup-python@v4 with: - python-version: "3.x" + python-version: "3.11.5" - name: Setup Pipenv if: ${{ matrix.suite == 'pipenv' }} run: python -m pip install pipenv diff --git a/.github/workflows/scriptTests.yml b/.github/workflows/scriptTests.yml index 5dc361d8e..27ce99e5e 100644 --- a/.github/workflows/scriptTests.yml +++ b/.github/workflows/scriptTests.yml @@ -72,14 +72,26 @@ jobs: ./jf${{ matrix.suite.osSuffix }} --version if: ${{ matrix.suite.os == 'windows' }} + # Prior to the release, we set the new version in the package.json files, introducing the prereleased version. + # This adjustment may result in an attempt to download a version that hasn't been published to releases.jfrog.io yet. + # To handle it, we fetch the most recent JFrog CLI release and store it in the LATEST_RELEASE step output. + - name: "Get latest release" + id: latest-release + run: | + export LATEST_RELEASE=`curl https://api.github.com/repos/jfrog/jfrog-cli/releases/latest -s | jq .name -r | cut -c 2-` + echo "LATEST_RELEASE=$LATEST_RELEASE" >> "$GITHUB_OUTPUT" + shell: bash + - name: Test install npm - v2 working-directory: build/npm/v2 run: | + npm version ${{ steps.latest-release.outputs.LATEST_RELEASE }} --allow-same-version npm install ./bin/jfrog${{ matrix.suite.osSuffix }} --version - name: Test install npm - v2-jf working-directory: build/npm/v2-jf run: | + npm version ${{ steps.latest-release.outputs.LATEST_RELEASE }} --allow-same-version npm install ./bin/jf${{ matrix.suite.osSuffix }} --version diff --git a/README.md b/README.md index b16f33d2a..022e4f894 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Scanned by Frogbot](https://raw.github.com/jfrog/frogbot/master/images/frogbot-badge.svg)](https://github.com/jfrog/frogbot#readme) [![Go Report Card](https://goreportcard.com/badge/github.com/jfrog/jfrog-cli)](https://goreportcard.com/report/github.com/jfrog/jfrog-cli) -[![license](https://img.shields.io/badge/License-Apache_2.0-blue.svg?style=flat)](https://raw.githubusercontent.com/jfrog/jfrog-cli/v2/LICENSE) [![](https://img.shields.io/badge/Docs-%F0%9F%93%96-blue)](https://www.jfrog.com/confluence/display/CLI/JFrog+CLI) +[![license](https://img.shields.io/badge/License-Apache_2.0-blue.svg?style=flat)](https://raw.githubusercontent.com/jfrog/jfrog-cli/v2/LICENSE) [![](https://img.shields.io/badge/Docs-%F0%9F%93%96-blue)](https://docs.jfrog-applications.jfrog.io/jfrog-applications/jfrog-cli) [![Go version](https://img.shields.io/github/go-mod/go-version/jfrog/jfrog-cli)](https://tip.golang.org/doc/go1.20) diff --git a/access_test.go b/access_test.go index b2ca85b91..ba092b1d1 100644 --- a/access_test.go +++ b/access_test.go @@ -175,9 +175,9 @@ const ( ) var atcTestCases = []struct { - name string - args []string - shouldExpire bool + name string + args []string + shouldExpire bool // The expected expiry or -1 if we use the default expiry value expectedExpiry int expectedScope string diff --git a/build/chocolatey/v2-jf/jfrog-cli-v2-jf.nuspec b/build/chocolatey/v2-jf/jfrog-cli-v2-jf.nuspec index 4810c3614..9fc7ad50e 100644 --- a/build/chocolatey/v2-jf/jfrog-cli-v2-jf.nuspec +++ b/build/chocolatey/v2-jf/jfrog-cli-v2-jf.nuspec @@ -8,7 +8,7 @@ JFrog CLI V2-jf JFrog Ltd JFrog Ltd - https://www.jfrog.com/confluence/display/CLI/JFrog+CLI + https://docs.jfrog-applications.jfrog.io/jfrog-applications/jfrog-cli https://github.com/jfrog/jfrog-cli/blob/v2/LICENSE false https://github.com/jfrog/jfrog-cli/issues diff --git a/build/chocolatey/v2/jfrog-cli.nuspec b/build/chocolatey/v2/jfrog-cli.nuspec index 022f60c36..d65e32bb4 100644 --- a/build/chocolatey/v2/jfrog-cli.nuspec +++ b/build/chocolatey/v2/jfrog-cli.nuspec @@ -8,7 +8,7 @@ JFrog CLI V2 JFrog Ltd JFrog Ltd - https://www.jfrog.com/confluence/display/CLI/JFrog+CLI + https://docs.jfrog-applications.jfrog.io/jfrog-applications/jfrog-cli https://github.com/jfrog/jfrog-cli/blob/v2/LICENSE false https://github.com/jfrog/jfrog-cli/issues diff --git a/build/deb_rpm/v2-jf/deb/debian/control b/build/deb_rpm/v2-jf/deb/debian/control index 06b29a49f..8e2d15591 100644 --- a/build/deb_rpm/v2-jf/deb/debian/control +++ b/build/deb_rpm/v2-jf/deb/debian/control @@ -4,7 +4,7 @@ Priority: optional Maintainer: Jfrog Build-Depends: debhelper (>=8~) Standards-Version: 3.9.7 -Homepage: https://www.jfrog.com/confluence/display/CLI/JFrog+CLI +Homepage: https://docs.jfrog-applications.jfrog.io/jfrog-applications/jfrog-cli Package: jfrog-cli-v2-jf Architecture: any diff --git a/build/deb_rpm/v2/deb/debian/control b/build/deb_rpm/v2/deb/debian/control index d93140e44..4c9f43f08 100644 --- a/build/deb_rpm/v2/deb/debian/control +++ b/build/deb_rpm/v2/deb/debian/control @@ -4,7 +4,7 @@ Priority: optional Maintainer: Jfrog Build-Depends: debhelper (>=8~) Standards-Version: 3.9.7 -Homepage: https://www.jfrog.com/confluence/display/CLI/JFrog+CLI +Homepage: https://docs.jfrog-applications.jfrog.io/jfrog-applications/jfrog-cli Package: jfrog-cli-v2 Architecture: any diff --git a/build/npm/v2-jf/README.md b/build/npm/v2-jf/README.md index a53432f1d..4b3ca76d9 100644 --- a/build/npm/v2-jf/README.md +++ b/build/npm/v2-jf/README.md @@ -6,7 +6,7 @@ # JFrog CLI -[Website](http://www.jfrog.com) • [Docs](https://www.jfrog.com/confluence/display/CLI/JFrog+CLI) • [Issues](https://github.com/jfrog/jfrog-cli-go/issues) • [Blog](https://jfrog.com/blog/) • [We're Hiring](https://join.jfrog.com/) • [Artifactory Free Trial](https://jfrog.com/artifactory/free-trial/) +[Website](http://www.jfrog.com) • [Docs](https://docs.jfrog-applications.jfrog.io/jfrog-applications/jfrog-cli) • [Issues](https://github.com/jfrog/jfrog-cli/issues) • [Blog](https://jfrog.com/blog/) • [We're Hiring](https://join.jfrog.com/) • [Artifactory Free Trial](https://jfrog.com/artifactory/free-trial/) ## Overview diff --git a/build/npm/v2-jf/package-lock.json b/build/npm/v2-jf/package-lock.json index cbbd69036..aed689e64 100644 --- a/build/npm/v2-jf/package-lock.json +++ b/build/npm/v2-jf/package-lock.json @@ -1,5 +1,5 @@ { "name": "jfrog-cli-v2-jf", - "version": "2.50.4", + "version": "2.51.0", "lockfileVersion": 1 } diff --git a/build/npm/v2-jf/package.json b/build/npm/v2-jf/package.json index fcb104097..7271c835c 100644 --- a/build/npm/v2-jf/package.json +++ b/build/npm/v2-jf/package.json @@ -1,6 +1,6 @@ { "name": "jfrog-cli-v2-jf", - "version": "2.50.4", + "version": "2.51.0", "description": "🐸 Command-line interface for JFrog Artifactory, Xray, Distribution, Pipelines and Mission Control 🐸", "homepage": "https://github.com/jfrog/jfrog-cli", "preferGlobal": true, diff --git a/build/npm/v2/README.md b/build/npm/v2/README.md index 621441235..ebae7d87d 100644 --- a/build/npm/v2/README.md +++ b/build/npm/v2/README.md @@ -6,7 +6,7 @@ # JFrog CLI -[Website](http://www.jfrog.com) • [Docs](https://www.jfrog.com/confluence/display/CLI/JFrog+CLI) • [Issues](https://github.com/jfrog/jfrog-cli-go/issues) • [Blog](https://jfrog.com/blog/) • [We're Hiring](https://join.jfrog.com/) • [Artifactory Free Trial](https://jfrog.com/artifactory/free-trial/) +[Website](http://www.jfrog.com) • [Docs](https://docs.jfrog-applications.jfrog.io/jfrog-applications/jfrog-cli) • [Issues](https://github.com/jfrog/jfrog-cli/issues) • [Blog](https://jfrog.com/blog/) • [We're Hiring](https://join.jfrog.com/) • [Artifactory Free Trial](https://jfrog.com/artifactory/free-trial/) ## Overview diff --git a/build/npm/v2/package-lock.json b/build/npm/v2/package-lock.json index 83fc68b50..08b44f8c4 100644 --- a/build/npm/v2/package-lock.json +++ b/build/npm/v2/package-lock.json @@ -1,5 +1,5 @@ { "name": "jfrog-cli-v2", - "version": "2.50.4", + "version": "2.51.0", "lockfileVersion": 2 } diff --git a/build/npm/v2/package.json b/build/npm/v2/package.json index 8d8d82559..718bc7c45 100644 --- a/build/npm/v2/package.json +++ b/build/npm/v2/package.json @@ -1,6 +1,6 @@ { "name": "jfrog-cli-v2", - "version": "2.50.4", + "version": "2.51.0", "description": "🐸 Command-line interface for JFrog Artifactory, Xray, Distribution, Pipelines and Mission Control 🐸", "homepage": "https://github.com/jfrog/jfrog-cli", "preferGlobal": true, diff --git a/go.mod b/go.mod index b5b85b3c4..d92f1c651 100644 --- a/go.mod +++ b/go.mod @@ -7,10 +7,10 @@ require ( github.com/buger/jsonparser v1.1.1 github.com/go-git/go-git/v5 v5.9.0 github.com/gocarina/gocsv v0.0.0-20230616125104-99d496ca653d - github.com/jfrog/build-info-go v1.9.14 + github.com/jfrog/build-info-go v1.9.15 github.com/jfrog/gofrog v1.3.1 - github.com/jfrog/jfrog-cli-core/v2 v2.45.4 - github.com/jfrog/jfrog-client-go v1.34.3 + github.com/jfrog/jfrog-cli-core/v2 v2.46.0 + github.com/jfrog/jfrog-client-go v1.34.4 github.com/jszwec/csvutil v1.8.0 github.com/mholt/archiver/v3 v3.5.1 github.com/stretchr/testify v1.8.4 @@ -122,17 +122,17 @@ require ( golang.org/x/text v0.13.0 // indirect golang.org/x/tools v0.14.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect - google.golang.org/grpc v1.58.2 // indirect + google.golang.org/grpc v1.58.3 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect 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.20231019085746-e1b192457664 +// replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20231107094842-97a0ca9da395 -// replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20231019090648-a85aaa5fe352 +// replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20231105094115-13b1588fc537 // 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 dev +// replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20231101142932-422f20520a28 diff --git a/go.sum b/go.sum index f0cfb6506..5375917a4 100644 --- a/go.sum +++ b/go.sum @@ -237,16 +237,16 @@ 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.8 h1:HiNzyMSEpsBaduKhmK+CwcpulEeBrTmxutz4oX/oWkg= github.com/jedib0t/go-pretty/v6 v6.4.8/go.mod h1:Ndk3ase2CkQbXLLNf5QDHoYb6J9WtVfmHZu9n8rk2xs= -github.com/jfrog/build-info-go v1.9.14 h1:xVezJ16Vpm/boRBn3lI1THCQmkylm+6R4zYWxOQ0NSM= -github.com/jfrog/build-info-go v1.9.14/go.mod h1:ujJ8XQZMdT2tMkLSMJNyDd1pCY+duwHdjV+9or9FLIg= +github.com/jfrog/build-info-go v1.9.15 h1:DN7DKZq6H5FlHfL3Lu8fo4t2INgczRgT09dJiZjJ1oo= +github.com/jfrog/build-info-go v1.9.15/go.mod h1:XVFk2rCYhIdc7+hIGE8TC3le5PPM+xYHU22udoE2b7Q= github.com/jfrog/gofrog v1.3.1 h1:QqAwQXCVReT724uga1AYqG/ZyrNQ6f+iTxmzkb+YFQk= github.com/jfrog/gofrog v1.3.1/go.mod h1:IFMc+V/yf7rA5WZ74CSbXe+Lgf0iApEQLxRZVzKRUR0= github.com/jfrog/jfrog-apps-config v1.0.1 h1:mtv6k7g8A8BVhlHGlSveapqf4mJfonwvXYLipdsOFMY= github.com/jfrog/jfrog-apps-config v1.0.1/go.mod h1:8AIIr1oY9JuH5dylz2S6f8Ym2MaadPLR6noCBO4C22w= -github.com/jfrog/jfrog-cli-core/v2 v2.45.4 h1:IHwL2RQ0VwibUCPLFtCm53tMrO1ZOmSkf6Kt2o3iD3U= -github.com/jfrog/jfrog-cli-core/v2 v2.45.4/go.mod h1:5rTYHinkg5k2ALHYROR3AnE2mMQ22SFZF5dwew1sgco= -github.com/jfrog/jfrog-client-go v1.34.3 h1:kDfw3FUQQvOsTKFqonIgLlziez6CSX80xCYZIH9YYcg= -github.com/jfrog/jfrog-client-go v1.34.3/go.mod h1:fuxhYzWEkA16+ZV5cP/BJUGjA3SXVKbBoDmb8ZS6J4g= +github.com/jfrog/jfrog-cli-core/v2 v2.46.0 h1:4wLboOCNDWx5/fQpxd8qIFqGeveOUx5dyrW8sZJXUFw= +github.com/jfrog/jfrog-cli-core/v2 v2.46.0/go.mod h1:9x/Pwyf1RahXDWtfVrmZgsmAzQWHgsV6FDkIqmezrdc= +github.com/jfrog/jfrog-client-go v1.34.4 h1:Qt6Yniv48N9EaE0rrUZznOohuDRvqp9sUUHiHXAo3Xs= +github.com/jfrog/jfrog-client-go v1.34.4/go.mod h1:0PVhP6xGvBBaUzOU9LKf5OYkke/gY2IFILHA++iabFM= 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= @@ -774,8 +774,8 @@ google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I= -google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= +google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/gradle_test.go b/gradle_test.go index 773521091..b629b096b 100644 --- a/gradle_test.go +++ b/gradle_test.go @@ -82,7 +82,7 @@ func TestGradleBuildWithServerID(t *testing.T) { searchSpec, err := tests.CreateSpec(tests.SearchAllGradle) assert.NoError(t, err) inttestutils.VerifyExistInArtifactory(tests.GetGradleDeployedArtifacts(), searchSpec, serverDetails, t) - verifyExistInArtifactoryByProps(tests.GetGradleDeployedArtifacts(), tests.GradleRepo+"/*", "build.name="+tests.GradleBuildName+";build.number="+buildNumber, t) + verifyExistInArtifactoryByProps(tests.GetGradleDeployedArtifacts(), tests.GradleRepo+"/*", "build.name="+tests.GradleBuildName+";build.number="+buildNumber+";build.timestamp="+getBuildTimestamp(tests.GradleBuildName, buildNumber, t), t) assert.NoError(t, artifactoryCli.Exec("bp", tests.GradleBuildName, buildNumber)) publishedBuildInfo, found, err := tests.GetBuildInfo(serverDetails, tests.GradleBuildName, buildNumber) diff --git a/guides/getting-started-with-jfrog-using-the-cli.md b/guides/getting-started-with-jfrog-using-the-cli.md index 301350310..84bfa87d6 100644 --- a/guides/getting-started-with-jfrog-using-the-cli.md +++ b/guides/getting-started-with-jfrog-using-the-cli.md @@ -124,6 +124,6 @@ jf rt bp ### More * Read more - about [JFrog CLI](https://www.jfrog.com/confluence/display/CLI/JFrog+CLI) & [JFrog's IDE Integrations](https://www.jfrog.com/confluence/display/JFROG/IDE+Integration) + about [JFrog CLI](https://docs.jfrog-applications.jfrog.io/jfrog-applications/jfrog-cli) & [JFrog's IDE Integrations](https://docs.jfrog-applications.jfrog.io/jfrog-applications/ide) * **Your feedback is important!** We'd love to get your feedback and answer any questions you may have. Communicate with us through [GitHub](https://github.com/jfrog/jfrog-cli/issues). diff --git a/maven_test.go b/maven_test.go index 16311cb5c..d8c2cb783 100644 --- a/maven_test.go +++ b/maven_test.go @@ -2,6 +2,12 @@ package main import ( "fmt" + "os" + "path/filepath" + "strings" + "testing" + + "github.com/jfrog/build-info-go/build" buildinfo "github.com/jfrog/build-info-go/entities" biutils "github.com/jfrog/build-info-go/utils" "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/mvn" @@ -17,10 +23,6 @@ import ( "github.com/jfrog/jfrog-client-go/utils/log" clientTestUtils "github.com/jfrog/jfrog-client-go/utils/tests" "github.com/stretchr/testify/assert" - "os" - "path/filepath" - "strings" - "testing" ) const mavenTestsProxyPort = "1028" @@ -200,6 +202,16 @@ func createHomeConfigAndLocalRepo(t *testing.T, encryptPassword bool) (err error return err } +// Get the build timestamp from the build info. +func getBuildTimestamp(buildName, buildNumber string, t *testing.T) string { + service := build.NewBuildInfoService() + bld, err := service.GetOrCreateBuild(buildName, buildNumber) + if assert.NoError(t, err) { + return fmt.Sprintf("%d", bld.GetBuildTimestamp().UnixMilli()) + } + return "" +} + func TestMavenBuildIncludePatterns(t *testing.T) { initMavenTest(t, false) buildNumber := "123" @@ -209,7 +221,7 @@ func TestMavenBuildIncludePatterns(t *testing.T) { searchSpec, err := tests.CreateSpec(tests.SearchAllMaven) assert.NoError(t, err) inttestutils.VerifyExistInArtifactory(tests.GetMavenMultiIncludedDeployedArtifacts(), searchSpec, serverDetails, t) - verifyExistInArtifactoryByProps(tests.GetMavenMultiIncludedDeployedArtifacts(), tests.MvnRepo1+"/*", "build.name="+tests.MvnBuildName+";build.number="+buildNumber, t) + verifyExistInArtifactoryByProps(tests.GetMavenMultiIncludedDeployedArtifacts(), tests.MvnRepo1+"/*", "build.name="+tests.MvnBuildName+";build.number="+buildNumber+";build.timestamp="+getBuildTimestamp(tests.MvnBuildName, buildNumber, t), t) // Validate build info. assert.NoError(t, artifactoryCli.Exec("build-publish", tests.MvnBuildName, buildNumber)) diff --git a/scan/cli.go b/scan/cli.go index a53d499f8..371a93af8 100644 --- a/scan/cli.go +++ b/scan/cli.go @@ -259,7 +259,8 @@ func createAuditCmd(c *cli.Context) (*audit.AuditCommand, error) { SetPrintExtendedTable(c.Bool(cliutils.ExtendedTable)). SetMinSeverityFilter(minSeverity). SetFixableOnly(c.Bool(cliutils.FixableOnly)). - SetThirdPartyApplicabilityScan(c.Bool(cliutils.ThirdPartyContextualAnalysis)) + SetThirdPartyApplicabilityScan(c.Bool(cliutils.ThirdPartyContextualAnalysis)). + SetExclusions(cliutils.GetStringsArrFlagValue(c, "exclusions")) if c.String("watches") != "" { auditCmd.SetWatches(splitByCommaAndTrim(c.String("watches"))) diff --git a/testdata/docker/script.sh b/testdata/docker/script.sh index 0360d52ea..a24c156b4 100644 --- a/testdata/docker/script.sh +++ b/testdata/docker/script.sh @@ -1,3 +1,4 @@ #!/bin/bash -./buildx create --name mybuilder --driver-opt "network=host" --config buildkitd.toml --use +# We pin v0.12.2 since buildkit v0.12.3 is getting a 401 unauthorized error when using a private HTTP insecure registry. +./buildx create --name mybuilder --driver-opt "network=host" --driver-opt image=moby/buildkit:v0.12.2 --config buildkitd.toml --use ./buildx inspect --bootstrap \ No newline at end of file diff --git a/transfer_test.go b/transfer_test.go index c748afadf..06fb3ff36 100644 --- a/transfer_test.go +++ b/transfer_test.go @@ -368,7 +368,7 @@ func generateTestRepoSnapshotFile(t *testing.T, repoKey, repoSnapshotFilePath st func addChildWithFiles(t *testing.T, parent *reposnapshot.Node, dirName string, explored, checkCompleted bool, filesCount int) *reposnapshot.Node { childNode := reposnapshot.CreateNewNode(dirName, nil) for i := 0; i < filesCount; i++ { - assert.NoError(t, childNode.IncrementFilesCount()) + assert.NoError(t, childNode.IncrementFilesCount(uint64(i))) } assert.NoError(t, parent.AddChildNode(dirName, []*reposnapshot.Node{childNode})) diff --git a/utils/cliutils/cli_consts.go b/utils/cliutils/cli_consts.go index bb5cac980..e4bb4af7f 100644 --- a/utils/cliutils/cli_consts.go +++ b/utils/cliutils/cli_consts.go @@ -4,7 +4,7 @@ import "time" const ( // General CLI constants - CliVersion = "2.50.4" + CliVersion = "2.51.0" ClientAgent = "jfrog-cli-go" // CLI base commands constants: diff --git a/utils/cliutils/commandsflags.go b/utils/cliutils/commandsflags.go index ef823ad63..3607aafd9 100644 --- a/utils/cliutils/commandsflags.go +++ b/utils/cliutils/commandsflags.go @@ -494,6 +494,7 @@ const ( RequirementsFile = "requirements-file" watches = "watches" workingDirs = "working-dirs" + ExclusionsAudit = auditPrefix + exclusions repoPath = "repo-path" licenses = "licenses" vuln = "vuln" @@ -1380,6 +1381,10 @@ var flagsMap = map[string]cli.Flag{ Name: workingDirs, Usage: "[Optional] A comma-separated list of relative working directories, to determine audit targets locations.` `", }, + ExclusionsAudit: cli.StringFlag{ + Name: exclusions, + Usage: "[Default: *node_modules*;*target*;*venv*;*test*] List of exclusions separated by semicolons, utilized to skip sub-projects from undergoing an audit. These exclusions may incorporate the * and ? wildcards.` `", + }, ExtendedTable: cli.BoolFlag{ Name: ExtendedTable, Usage: "[Default: false] Set to true if you'd like the table to include extended fields such as 'CVSS' & 'Xray Issue Id'. Ignored if provided 'format' is not 'table'.` `", @@ -2016,25 +2021,25 @@ var commandFlags = map[string][]string{ }, Audit: { xrUrl, user, password, accessToken, serverId, InsecureTls, Project, watches, repoPath, licenses, xrOutput, ExcludeTestDeps, - useWrapperAudit, DepType, RequirementsFile, fail, ExtendedTable, workingDirs, Mvn, Gradle, Npm, Yarn, Go, Nuget, Pip, Pipenv, Poetry, MinSeverity, FixableOnly, ThirdPartyContextualAnalysis, + useWrapperAudit, DepType, RequirementsFile, fail, ExtendedTable, workingDirs, ExclusionsAudit, Mvn, Gradle, Npm, Yarn, Go, Nuget, Pip, Pipenv, Poetry, MinSeverity, FixableOnly, ThirdPartyContextualAnalysis, }, AuditMvn: { - xrUrl, user, password, accessToken, serverId, InsecureTls, Project, watches, repoPath, licenses, xrOutput, fail, ExtendedTable, useWrapperAudit, + xrUrl, user, password, accessToken, serverId, InsecureTls, Project, ExclusionsAudit, watches, repoPath, licenses, xrOutput, fail, ExtendedTable, useWrapperAudit, }, AuditGradle: { - xrUrl, user, password, accessToken, serverId, ExcludeTestDeps, useWrapperAudit, Project, watches, repoPath, licenses, xrOutput, fail, ExtendedTable, + xrUrl, user, password, accessToken, serverId, ExcludeTestDeps, ExclusionsAudit, useWrapperAudit, Project, watches, repoPath, licenses, xrOutput, fail, ExtendedTable, }, AuditNpm: { - xrUrl, user, password, accessToken, serverId, DepType, Project, watches, repoPath, licenses, xrOutput, fail, ExtendedTable, + xrUrl, user, password, accessToken, serverId, DepType, Project, ExclusionsAudit, watches, repoPath, licenses, xrOutput, fail, ExtendedTable, }, AuditGo: { - xrUrl, user, password, accessToken, serverId, Project, watches, repoPath, licenses, xrOutput, fail, ExtendedTable, + xrUrl, user, password, accessToken, serverId, Project, ExclusionsAudit, watches, repoPath, licenses, xrOutput, fail, ExtendedTable, }, AuditPip: { - xrUrl, user, password, accessToken, serverId, RequirementsFile, Project, watches, repoPath, licenses, xrOutput, fail, ExtendedTable, + xrUrl, user, password, accessToken, serverId, RequirementsFile, Project, ExclusionsAudit, watches, repoPath, licenses, xrOutput, fail, ExtendedTable, }, AuditPipenv: { - xrUrl, user, password, accessToken, serverId, Project, watches, repoPath, licenses, xrOutput, ExtendedTable, + xrUrl, user, password, accessToken, serverId, Project, ExclusionsAudit, watches, repoPath, licenses, xrOutput, ExtendedTable, }, XrScan: { xrUrl, user, password, accessToken, serverId, specFlag, threads, scanRecursive, scanRegexp, scanAnt, diff --git a/utils/cliutils/utils.go b/utils/cliutils/utils.go index d8f3044fb..e101b863c 100644 --- a/utils/cliutils/utils.go +++ b/utils/cliutils/utils.go @@ -776,12 +776,9 @@ func isEnvFailNoOp() bool { return strings.ToLower(os.Getenv(coreutils.FailNoOp)) == "true" } -func CleanupResult(result *commandUtils.Result, originError *error) { +func CleanupResult(result *commandUtils.Result, err *error) { if result != nil && result.Reader() != nil { - e := result.Reader().Close() - if originError == nil { - *originError = e - } + *err = errors.Join(*err, result.Reader().Close()) } } diff --git a/xray_test.go b/xray_test.go index 00bfe268d..cf70543d8 100644 --- a/xray_test.go +++ b/xray_test.go @@ -914,6 +914,13 @@ func curationServer(t *testing.T, expectedRequest map[string]bool, requestToFail } } if r.Method == http.MethodGet { + if r.RequestURI == "/api/system/version" { + _, err := w.Write([]byte(`{"version": "7.0.0"}`)) + require.NoError(t, err) + w.WriteHeader(http.StatusOK) + return + } + if _, exist := requestToFail[r.RequestURI]; exist { w.WriteHeader(http.StatusForbidden) _, err := w.Write([]byte("{\n \"errors\": [\n {\n \"status\": 403,\n " +