From 6716fef426fa3af354812b4388d470422879c4c8 Mon Sep 17 00:00:00 2001 From: eyalbe4 Date: Wed, 19 Jul 2023 18:16:07 +0300 Subject: [PATCH] Gradle args with spaces fail the command execution --- buildtools/cli.go | 2 +- go.mod | 6 +++--- go.sum | 8 ++++---- gradle_test.go | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/buildtools/cli.go b/buildtools/cli.go index 508edb996..5daf84020 100644 --- a/buildtools/cli.go +++ b/buildtools/cli.go @@ -473,7 +473,7 @@ func GradleCmd(c *cli.Context) (err error) { return err } printDeploymentView := log.IsStdErrTerminal() - gradleCmd := gradle.NewGradleCommand().SetConfiguration(buildConfiguration).SetTasks(strings.Join(filteredGradleArgs, " ")).SetConfigPath(configFilePath).SetThreads(threads).SetDetailedSummary(detailedSummary || printDeploymentView).SetXrayScan(xrayScan).SetScanOutputFormat(scanOutputFormat) + gradleCmd := gradle.NewGradleCommand().SetConfiguration(buildConfiguration).SetTasks(filteredGradleArgs).SetConfigPath(configFilePath).SetThreads(threads).SetDetailedSummary(detailedSummary || printDeploymentView).SetXrayScan(xrayScan).SetScanOutputFormat(scanOutputFormat) err = commands.Exec(gradleCmd) result := gradleCmd.Result() defer cliutils.CleanupResult(result, &err) diff --git a/go.mod b/go.mod index a31b5d245..4524e9431 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/jfrog/build-info-go v1.9.6 github.com/jfrog/gofrog v1.3.0 github.com/jfrog/jfrog-cli-core/v2 v2.38.0 - github.com/jfrog/jfrog-client-go v1.31.1 + github.com/jfrog/jfrog-client-go v1.31.2 github.com/jszwec/csvutil v1.8.0 github.com/mholt/archiver/v3 v3.5.1 github.com/pkg/errors v0.9.1 @@ -123,8 +123,8 @@ require ( // replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go -replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230717092920-cd976eb1e5c3 +replace github.com/jfrog/jfrog-cli-core/v2 => github.com/keeganjm-bsc/jfrog-cli-core/v2 v2.31.1-0.20230719144244-81f6faf13616 // 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.20230717090738-b2e0c7bcc026 +replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20230718091417-c761a2d17c6c diff --git a/go.sum b/go.sum index a9953b121..c1a74e297 100644 --- a/go.sum +++ b/go.sum @@ -238,14 +238,14 @@ github.com/jfrog/build-info-go v1.9.6 h1:lCJ2j5uXAlJsSwDe5J8WD7Co1f/hUlZvMfwfb5A github.com/jfrog/build-info-go v1.9.6/go.mod h1:GbuFS+viHCKZYx9nWHYu7ab1DgQkFdtVN3BJPUNb2D4= 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.20230717092920-cd976eb1e5c3 h1:ED7QzMz/KA/7ps2bNvRiWbqBP/BbExWlUrJWcAoGiHM= -github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230717092920-cd976eb1e5c3/go.mod h1:QjTOL5xFgplonx47OnXXXurRtpQGDquGmrTbpe011EY= -github.com/jfrog/jfrog-client-go v1.28.1-0.20230717090738-b2e0c7bcc026 h1:Xam/SD9ZqanqexbX2iW2H1fH5MLB9qx6vN8SK8wBMhA= -github.com/jfrog/jfrog-client-go v1.28.1-0.20230717090738-b2e0c7bcc026/go.mod h1:qEJxoe68sUtqHJ1YhXv/7pKYP/9p1D5tJrruzJKYeoI= +github.com/jfrog/jfrog-client-go v1.28.1-0.20230718091417-c761a2d17c6c h1:2dBAFi8WjRH5YagArNfUdVB7WQoaoNufmRhrhDuq3Qs= +github.com/jfrog/jfrog-client-go v1.28.1-0.20230718091417-c761a2d17c6c/go.mod h1:qEJxoe68sUtqHJ1YhXv/7pKYP/9p1D5tJrruzJKYeoI= 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= github.com/jszwec/csvutil v1.8.0/go.mod h1:/E4ONrmGkwmWsk9ae9jpXnv9QT8pLHEPcCirMFhxG9I= +github.com/keeganjm-bsc/jfrog-cli-core/v2 v2.31.1-0.20230719144244-81f6faf13616 h1:xTqug+xTOSaEUq/m+PedbMpuwd3cVBYQ56BuxGCnUhA= +github.com/keeganjm-bsc/jfrog-cli-core/v2 v2.31.1-0.20230719144244-81f6faf13616/go.mod h1:/HJ9mO3AZsACtQWxkwMj7REWPdXT3yHKjJXjPHlmB34= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= diff --git a/gradle_test.go b/gradle_test.go index 773521091..7cbb5f6f3 100644 --- a/gradle_test.go +++ b/gradle_test.go @@ -112,7 +112,7 @@ func TestGradleBuildWithServerIDAndDetailedSummary(t *testing.T) { // Test gradle with detailed summary without buildinfo props. filteredGradleArgs := []string{"clean artifactoryPublish", "-b" + buildGradlePath} - gradleCmd := gradle.NewGradleCommand().SetConfiguration(new(utils.BuildConfiguration)).SetTasks(strings.Join(filteredGradleArgs, " ")).SetConfigPath(filepath.Join(destPath, "gradle.yaml")).SetDetailedSummary(true) + gradleCmd := gradle.NewGradleCommand().SetConfiguration(new(utils.BuildConfiguration)).SetTasks(filteredGradleArgs).SetConfigPath(filepath.Join(destPath, "gradle.yaml")).SetDetailedSummary(true) assert.NoError(t, commands.Exec(gradleCmd)) // Validate sha256 assert.NotNil(t, gradleCmd.Result()) @@ -121,7 +121,7 @@ func TestGradleBuildWithServerIDAndDetailedSummary(t *testing.T) { } // Test gradle with detailed summary + buildinfo. - gradleCmd = gradle.NewGradleCommand().SetConfiguration(utils.NewBuildConfiguration(tests.GradleBuildName, buildNumber, "", "")).SetTasks(strings.Join(filteredGradleArgs, " ")).SetConfigPath(filepath.Join(destPath, "gradle.yaml")).SetDetailedSummary(true) + gradleCmd = gradle.NewGradleCommand().SetConfiguration(utils.NewBuildConfiguration(tests.GradleBuildName, buildNumber, "", "")).SetTasks(filteredGradleArgs).SetConfigPath(filepath.Join(destPath, "gradle.yaml")).SetDetailedSummary(true) assert.NoError(t, commands.Exec(gradleCmd)) // Validate sha256 tests.VerifySha256DetailedSummaryFromResult(t, gradleCmd.Result())