diff --git a/artifactory/commands/buildinfo/publish.go b/artifactory/commands/buildinfo/publish.go index 6848bf6a2..1efdaf777 100644 --- a/artifactory/commands/buildinfo/publish.go +++ b/artifactory/commands/buildinfo/publish.go @@ -146,7 +146,7 @@ func (bpc *BuildPublishCommand) Run() error { return err } - if err = recordCommandSummary(buildInfo, buildLink, bpc.serverDetails.Url, bpc.buildConfiguration.GetProject(), majorVersion); err != nil { + if err = recordCommandSummary(buildInfo, buildLink, bpc.serverDetails.Url, majorVersion); err != nil { return err } @@ -232,12 +232,12 @@ func (bpc *BuildPublishCommand) getNextBuildNumber(buildName string, servicesMan return strconv.Itoa(latestBuildNumber), nil } -func recordCommandSummary(buildInfo *buildinfo.BuildInfo, buildLink, serverUrl, projectKey string, majorVersion int) (err error) { +func recordCommandSummary(buildInfo *buildinfo.BuildInfo, buildLink, serverUrl string, majorVersion int) (err error) { if !commandsummary.ShouldRecordSummary() { return } buildInfo.BuildUrl = buildLink - buildInfoSummary, err := commandsummary.New(commandssummaries.NewBuildInfo(serverUrl, projectKey, majorVersion), "build-info") + buildInfoSummary, err := commandsummary.New(commandssummaries.NewBuildInfo(serverUrl, majorVersion), "build-info") if err != nil { return } diff --git a/artifactory/commands/commandssummaries/buildinfosummary.go b/artifactory/commands/commandssummaries/buildinfosummary.go index b89e50796..a870bae04 100644 --- a/artifactory/commands/commandssummaries/buildinfosummary.go +++ b/artifactory/commands/commandssummaries/buildinfosummary.go @@ -16,14 +16,12 @@ const ( type BuildInfoSummary struct { platformUrl string - projectKey string majorVersion int } -func NewBuildInfo(platformUrl, projectKey string, majorVersion int) *BuildInfoSummary { +func NewBuildInfo(platformUrl string, majorVersion int) *BuildInfoSummary { return &BuildInfoSummary{ platformUrl: platformUrl, - projectKey: projectKey, majorVersion: majorVersion, } } @@ -62,17 +60,28 @@ func (bis *BuildInfoSummary) buildInfoTable(builds []*buildInfo.BuildInfo) strin func (bis *BuildInfoSummary) buildInfoModules(builds []*buildInfo.BuildInfo) string { var markdownBuilder strings.Builder markdownBuilder.WriteString("\n\n ### Modules Published As Part of This Build \n\n") + var shouldGenerate bool for _, build := range builds { for _, module := range build.Modules { + if len(module.Artifacts) == 0 { + continue + } + switch module.Type { case buildInfo.Docker, buildInfo.Maven, buildInfo.Npm, buildInfo.Go, buildInfo.Generic, buildInfo.Terraform: markdownBuilder.WriteString(bis.generateModuleMarkdown(module)) + shouldGenerate = true default: // Skip unsupported module types. continue } } } + + // If no supported module with artifacts was found, avoid generating the markdown. + if !shouldGenerate { + return "" + } return markdownBuilder.String() } @@ -107,5 +116,5 @@ func (bis *BuildInfoSummary) generateArtifactUrl(artifact buildInfo.Artifact) st if strings.TrimSpace(artifact.OriginalDeploymentRepo) == "" { return "" } - return generateArtifactUrl(bis.platformUrl, path.Join(artifact.OriginalDeploymentRepo, artifact.Path), bis.projectKey, bis.majorVersion) + return generateArtifactUrl(bis.platformUrl, path.Join(artifact.OriginalDeploymentRepo, artifact.Path), bis.majorVersion) } diff --git a/artifactory/commands/commandssummaries/buildinfosummary_test.go b/artifactory/commands/commandssummaries/buildinfosummary_test.go index 86804454f..73a613861 100644 --- a/artifactory/commands/commandssummaries/buildinfosummary_test.go +++ b/artifactory/commands/commandssummaries/buildinfosummary_test.go @@ -24,7 +24,7 @@ func TestBuildInfoTable(t *testing.T) { } func TestBuildInfoModules(t *testing.T) { - gh := &BuildInfoSummary{} + gh := &BuildInfoSummary{platformUrl: platformUrl, majorVersion: 7} var builds = []*buildinfo.BuildInfo{ { Name: "buildName", @@ -71,6 +71,41 @@ func TestBuildInfoModules(t *testing.T) { assert.Equal(t, getTestDataFile(t, "modules.md"), gh.buildInfoModules(builds)) } +// Validate that if no supported module with artifacts was found, we avoid generating the markdown. +func TestBuildInfoModulesEmpty(t *testing.T) { + gh := &BuildInfoSummary{} + var builds = []*buildinfo.BuildInfo{ + { + Name: "buildName", + Number: "123", + Started: "2024-05-05T12:47:20.803+0300", + BuildUrl: "http://myJFrogPlatform/builds/buildName/123", + Modules: []buildinfo.Module{ + { + Type: buildinfo.Maven, + Artifacts: []buildinfo.Artifact{}, + Dependencies: []buildinfo.Dependency{{ + Id: "dep1", + }, + }, + }, + { + Type: buildinfo.Gradle, + Artifacts: []buildinfo.Artifact{ + { + Name: "gradleArtifact", + Path: "dir/gradleArtifact", + OriginalDeploymentRepo: "gradle-local", + }, + }, + }, + }, + }, + } + + assert.Empty(t, gh.buildInfoModules(builds)) +} + func getTestDataFile(t *testing.T, fileName string) string { modulesPath := filepath.Join(".", "testdata", fileName) content, err := os.ReadFile(modulesPath) diff --git a/artifactory/commands/commandssummaries/testdata/modules.md b/artifactory/commands/commandssummaries/testdata/modules.md index 568a89f75..b87fb4653 100644 --- a/artifactory/commands/commandssummaries/testdata/modules.md +++ b/artifactory/commands/commandssummaries/testdata/modules.md @@ -9,7 +9,7 @@
📦 libs-release
 └── 📁 path
     └── 📁 to
-        └── artifact1
+        └── artifact1
 
 
#### @@ -18,6 +18,6 @@
📦 generic-local
 └── 📁 path
     └── 📁 to
-        └── artifact2
+        └── artifact2
 
 
\ No newline at end of file diff --git a/artifactory/commands/commandssummaries/uploadsummary.go b/artifactory/commands/commandssummaries/uploadsummary.go index 0b3ac1cf2..d7b44b374 100644 --- a/artifactory/commands/commandssummaries/uploadsummary.go +++ b/artifactory/commands/commandssummaries/uploadsummary.go @@ -10,7 +10,6 @@ type UploadSummary struct { uploadTree *utils.FileTree uploadedArtifacts ResultsWrapper platformUrl string - projectKey string majorVersion int } @@ -24,10 +23,9 @@ type ResultsWrapper struct { Results []UploadResult `json:"results"` } -func NewUploadSummary(platformUrl, projectKey string, majorVersion int) *UploadSummary { +func NewUploadSummary(platformUrl string, majorVersion int) *UploadSummary { return &UploadSummary{ platformUrl: platformUrl, - projectKey: projectKey, majorVersion: majorVersion, } } @@ -63,5 +61,5 @@ func (us *UploadSummary) generateFileTreeMarkdown() string { } func (us *UploadSummary) buildUiUrl(targetPath string) string { - return generateArtifactUrl(us.platformUrl, targetPath, us.projectKey, us.majorVersion) + return generateArtifactUrl(us.platformUrl, targetPath, us.majorVersion) } diff --git a/artifactory/commands/commandssummaries/utils.go b/artifactory/commands/commandssummaries/utils.go index 72790dfab..75417663c 100644 --- a/artifactory/commands/commandssummaries/utils.go +++ b/artifactory/commands/commandssummaries/utils.go @@ -6,18 +6,14 @@ import ( ) const ( - artifactory7UiFormat = "%sui/repos/tree/General/%s" + artifactory7UiFormat = "%sui/repos/tree/General/%s?clearFilter=true" artifactory6UiFormat = "%sartifactory/webapp/#/artifacts/browse/tree/General/%s" ) -func generateArtifactUrl(rtUrl, pathInRt, project string, majorVersion int) string { +func generateArtifactUrl(rtUrl, pathInRt string, majorVersion int) string { rtUrl = clientUtils.AddTrailingSlashIfNeeded(rtUrl) if majorVersion == 6 { return fmt.Sprintf(artifactory6UiFormat, rtUrl, pathInRt) } - uri := fmt.Sprintf(artifactory7UiFormat, rtUrl, pathInRt) - if project != "" { - uri += "?projectKey=" + project - } - return uri + return fmt.Sprintf(artifactory7UiFormat, rtUrl, pathInRt) } diff --git a/artifactory/commands/commandssummaries/utils_test.go b/artifactory/commands/commandssummaries/utils_test.go index 713fc652f..d47f300e0 100644 --- a/artifactory/commands/commandssummaries/utils_test.go +++ b/artifactory/commands/commandssummaries/utils_test.go @@ -17,14 +17,14 @@ func TestGenerateArtifactUrl(t *testing.T) { majorVersion int expected string }{ - {"artifactory 7 without project", "", 7, "https://myplatform.com/ui/repos/tree/General/repo/path/file"}, - {"artifactory 7 with project", "proj", 7, "https://myplatform.com/ui/repos/tree/General/repo/path/file?projectKey=proj"}, + {"artifactory 7 without project", "", 7, "https://myplatform.com/ui/repos/tree/General/repo/path/file?clearFilter=true"}, + {"artifactory 7 with project", "proj", 7, "https://myplatform.com/ui/repos/tree/General/repo/path/file?clearFilter=true"}, {"artifactory 6 without project", "", 6, "https://myplatform.com/artifactory/webapp/#/artifacts/browse/tree/General/repo/path/file"}, } for _, testCase := range cases { t.Run(testCase.testName, func(t *testing.T) { - artifactUrl := generateArtifactUrl(platformUrl, fullPath, testCase.projectKey, testCase.majorVersion) + artifactUrl := generateArtifactUrl(platformUrl, fullPath, testCase.majorVersion) assert.Equal(t, testCase.expected, artifactUrl) }) } diff --git a/artifactory/commands/generic/props.go b/artifactory/commands/generic/props.go index 9aee1c8ff..34f9b7f21 100644 --- a/artifactory/commands/generic/props.go +++ b/artifactory/commands/generic/props.go @@ -1,6 +1,7 @@ package generic import ( + "errors" "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils" "github.com/jfrog/jfrog-cli-core/v2/common/spec" "github.com/jfrog/jfrog-cli-core/v2/utils/config" @@ -69,11 +70,7 @@ func searchItems(spec *spec.SpecFiles, servicesManager artifactory.ArtifactorySe temp := []*content.ContentReader{} defer func() { for _, reader := range temp { - e := reader.Close() - if err == nil { - err = e - } - + err = errors.Join(err, reader.Close()) } }() for i := 0; i < len(spec.Files); i++ { diff --git a/artifactory/commands/generic/setprops.go b/artifactory/commands/generic/setprops.go index 8c2813cfc..b3bb5a09d 100644 --- a/artifactory/commands/generic/setprops.go +++ b/artifactory/commands/generic/setprops.go @@ -1,6 +1,7 @@ package generic import ( + "errors" "github.com/jfrog/jfrog-client-go/utils/errorutils" ) @@ -21,7 +22,7 @@ func (setProps *SetPropsCommand) CommandName() string { return "rt_set_properties" } -func (setProps *SetPropsCommand) Run() error { +func (setProps *SetPropsCommand) Run() (err error) { serverDetails, err := setProps.ServerDetails() if errorutils.CheckError(err) != nil { return err @@ -35,7 +36,9 @@ func (setProps *SetPropsCommand) Run() error { if err != nil { return err } - defer reader.Close() + defer func() { + err = errors.Join(err, reader.Close()) + }() propsParams := GetPropsParams(reader, setProps.props) success, err := servicesManager.SetProps(propsParams) diff --git a/artifactory/commands/generic/upload.go b/artifactory/commands/generic/upload.go index b1faa9f3e..11c8b14ce 100644 --- a/artifactory/commands/generic/upload.go +++ b/artifactory/commands/generic/upload.go @@ -159,7 +159,7 @@ func (uc *UploadCommand) upload() (err error) { successCount = summary.TotalSucceeded failCount = summary.TotalFailed - if err = recordCommandSummary(servicesManager, summary, serverDetails.Url, uc.buildConfiguration); err != nil { + if err = recordCommandSummary(servicesManager, summary, serverDetails.Url); err != nil { return } } @@ -282,7 +282,7 @@ func createDeleteSpecForSync(deletePattern string, syncDeletesProp string) *spec BuildSpec() } -func recordCommandSummary(servicesManager artifactory.ArtifactoryServicesManager, summary *rtServicesUtils.OperationSummary, platformUrl string, buildConfig *build.BuildConfiguration) (err error) { +func recordCommandSummary(servicesManager artifactory.ArtifactoryServicesManager, summary *rtServicesUtils.OperationSummary, platformUrl string) (err error) { if !commandsummary.ShouldRecordSummary() { return } @@ -292,12 +292,7 @@ func recordCommandSummary(servicesManager artifactory.ArtifactoryServicesManager return err } - // Get project key if exists - var projectKey string - if buildConfig != nil { - projectKey = buildConfig.GetProject() - } - uploadSummary, err := commandsummary.New(commandssummaries.NewUploadSummary(platformUrl, projectKey, majorVersion), "upload") + uploadSummary, err := commandsummary.New(commandssummaries.NewUploadSummary(platformUrl, majorVersion), "upload") if err != nil { return } diff --git a/artifactory/commands/golang/archive_test.go b/artifactory/commands/golang/archive_test.go index 784aef05f..a455104d2 100644 --- a/artifactory/commands/golang/archive_test.go +++ b/artifactory/commands/golang/archive_test.go @@ -2,14 +2,13 @@ package golang import ( "bytes" + "github.com/jfrog/gofrog/crypto" "github.com/stretchr/testify/assert" "os" "path/filepath" "reflect" "testing" - "github.com/jfrog/build-info-go/utils" - "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils" "github.com/jfrog/jfrog-cli-core/v2/utils/log" "github.com/jfrog/jfrog-cli-core/v2/utils/tests" @@ -33,21 +32,21 @@ func TestArchiveProject(t *testing.T) { mod string version string excludedPatterns []string - expected map[utils.Algorithm]string + expected map[crypto.Algorithm]string }{ - {buff, filepath.Join(pwd, "testdata"), "myproject.com/module/name", "v1.0.0", nil, map[utils.Algorithm]string{utils.MD5: "5b3603a7bf637622516673b845249205", utils.SHA1: "7386685c432c39428c9cb8584a2b970139c5e626", utils.SHA256: "eefd8aa3f9ac89876c8442d5feebbc837666bf40114d201219e3e6d51c208949"}}, - {buff, filepath.Join(pwd, "testdata"), "myproject.com/module/name", "v1.0.0", []string{"./testdata/dir1/*"}, map[utils.Algorithm]string{utils.MD5: "c2eeb4ef958edee91570690bf4111fc7", utils.SHA1: "d77e10eaa9bd863a9ff3775d3e452041e6f5aa40", utils.SHA256: "ecf66c1256263b2b4386efc299fa0c389263608efda9d1d91af8a746e6c5709a"}}, - {buff, filepath.Join(pwd, "testdata"), "myproject.com/module/name", "v1.0.0", []string{"./testdata/dir2/*"}, map[utils.Algorithm]string{utils.MD5: "bbe78a98ba10c1428f3a364570015e11", utils.SHA1: "99fd22ea2fe9c2c48124e741881fc3a555458a7e", utils.SHA256: "e2299f3c4e1f22d36befba191a347783dc2047e8e38cf6b9b96c273090f6e25b"}}, - {buff, filepath.Join(pwd, "testdata"), "myproject.com/module/name", "v1.0.0", []string{"./testdata/dir2/*", "testdata/dir3/*"}, map[utils.Algorithm]string{utils.MD5: "28617d6e74fce3dd2bab21b1bd65009b", utils.SHA1: "410814fbf21afdfb9c5b550151a51c2e986447fa", utils.SHA256: "e877c07315d6d3ad69139035defc08c04b400b36cd069b35ea3c2960424f2dc6"}}, - {buff, filepath.Join(pwd, "testdata"), "myproject.com/module/name", "v1.0.0", []string{"./testdata/dir2/*", "./testdata/dir3/dir4/*"}, map[utils.Algorithm]string{utils.MD5: "46a3ded48ed7998b1b35c80fbe0ffab5", utils.SHA1: "a26e73e7d29e49dd5d9c87da8f7c93cf929750df", utils.SHA256: "cf224b12eca12de4a052ef0f444519d64b6cecaf7b06050a02998be190e88847"}}, - {buff, filepath.Join(pwd, "testdata"), "myproject.com/module/name", "v1.0.0", []string{"./testdata/dir3/*"}, map[utils.Algorithm]string{utils.MD5: "c2a2dd6a7af84c2d88a48caf0c3aec34", utils.SHA1: "193d761317a602d18566561678b7bddc4773385c", utils.SHA256: "3efcd8b0d88081ec64333ff98b43616d283c4d52ed26cd7c8df646d9ea452c31"}}, - {buff, filepath.Join(pwd, "testdata"), "myproject.com/module/name", "v1.0.0", []string{"*.txt"}, map[utils.Algorithm]string{utils.MD5: "e93953b4be84d7753e0f33589b7dc4ba", utils.SHA1: "280c7492f57262b6e0af56b06c9db6a128e32ab9", utils.SHA256: "e7357986c59bf670af1e2f4868edb1406a87d328b7681b15cf038491cdc7e88c"}}, - {buff, filepath.Join(pwd, "testdata"), "myproject.com/module/name", "v1.0.0", []string{"./*/dir4/*.txt"}, map[utils.Algorithm]string{utils.MD5: "785f0c0c7b20dfd716178856edb79834", utils.SHA1: "d07204277ece1d7bef6a9f289a56afb91d66125f", utils.SHA256: "6afa0dd70bfa7c6d3aca1a3dfcd6465c542d64136c6391fa611795e6fa5800ce"}}, + {buff, filepath.Join(pwd, "testdata"), "myproject.com/module/name", "v1.0.0", nil, map[crypto.Algorithm]string{crypto.MD5: "5b3603a7bf637622516673b845249205", crypto.SHA1: "7386685c432c39428c9cb8584a2b970139c5e626", crypto.SHA256: "eefd8aa3f9ac89876c8442d5feebbc837666bf40114d201219e3e6d51c208949"}}, + {buff, filepath.Join(pwd, "testdata"), "myproject.com/module/name", "v1.0.0", []string{"./testdata/dir1/*"}, map[crypto.Algorithm]string{crypto.MD5: "c2eeb4ef958edee91570690bf4111fc7", crypto.SHA1: "d77e10eaa9bd863a9ff3775d3e452041e6f5aa40", crypto.SHA256: "ecf66c1256263b2b4386efc299fa0c389263608efda9d1d91af8a746e6c5709a"}}, + {buff, filepath.Join(pwd, "testdata"), "myproject.com/module/name", "v1.0.0", []string{"./testdata/dir2/*"}, map[crypto.Algorithm]string{crypto.MD5: "bbe78a98ba10c1428f3a364570015e11", crypto.SHA1: "99fd22ea2fe9c2c48124e741881fc3a555458a7e", crypto.SHA256: "e2299f3c4e1f22d36befba191a347783dc2047e8e38cf6b9b96c273090f6e25b"}}, + {buff, filepath.Join(pwd, "testdata"), "myproject.com/module/name", "v1.0.0", []string{"./testdata/dir2/*", "testdata/dir3/*"}, map[crypto.Algorithm]string{crypto.MD5: "28617d6e74fce3dd2bab21b1bd65009b", crypto.SHA1: "410814fbf21afdfb9c5b550151a51c2e986447fa", crypto.SHA256: "e877c07315d6d3ad69139035defc08c04b400b36cd069b35ea3c2960424f2dc6"}}, + {buff, filepath.Join(pwd, "testdata"), "myproject.com/module/name", "v1.0.0", []string{"./testdata/dir2/*", "./testdata/dir3/dir4/*"}, map[crypto.Algorithm]string{crypto.MD5: "46a3ded48ed7998b1b35c80fbe0ffab5", crypto.SHA1: "a26e73e7d29e49dd5d9c87da8f7c93cf929750df", crypto.SHA256: "cf224b12eca12de4a052ef0f444519d64b6cecaf7b06050a02998be190e88847"}}, + {buff, filepath.Join(pwd, "testdata"), "myproject.com/module/name", "v1.0.0", []string{"./testdata/dir3/*"}, map[crypto.Algorithm]string{crypto.MD5: "c2a2dd6a7af84c2d88a48caf0c3aec34", crypto.SHA1: "193d761317a602d18566561678b7bddc4773385c", crypto.SHA256: "3efcd8b0d88081ec64333ff98b43616d283c4d52ed26cd7c8df646d9ea452c31"}}, + {buff, filepath.Join(pwd, "testdata"), "myproject.com/module/name", "v1.0.0", []string{"*.txt"}, map[crypto.Algorithm]string{crypto.MD5: "e93953b4be84d7753e0f33589b7dc4ba", crypto.SHA1: "280c7492f57262b6e0af56b06c9db6a128e32ab9", crypto.SHA256: "e7357986c59bf670af1e2f4868edb1406a87d328b7681b15cf038491cdc7e88c"}}, + {buff, filepath.Join(pwd, "testdata"), "myproject.com/module/name", "v1.0.0", []string{"./*/dir4/*.txt"}, map[crypto.Algorithm]string{crypto.MD5: "785f0c0c7b20dfd716178856edb79834", crypto.SHA1: "d07204277ece1d7bef6a9f289a56afb91d66125f", crypto.SHA256: "6afa0dd70bfa7c6d3aca1a3dfcd6465c542d64136c6391fa611795e6fa5800ce"}}, } for _, testData := range archiveWithExclusion { err = archiveProject(testData.buff, testData.filePath, testData.mod, testData.version, testData.excludedPatterns) assert.NoError(t, err) - actual, err := utils.CalcChecksums(buff) + actual, err := crypto.CalcChecksums(buff) assert.NoError(t, err) if !reflect.DeepEqual(testData.expected, actual) { diff --git a/artifactory/commands/golang/publish.go b/artifactory/commands/golang/publish.go index 910fdce74..3de043a1d 100644 --- a/artifactory/commands/golang/publish.go +++ b/artifactory/commands/golang/publish.go @@ -7,7 +7,7 @@ import ( "errors" "fmt" buildinfo "github.com/jfrog/build-info-go/entities" - biutils "github.com/jfrog/build-info-go/utils" + "github.com/jfrog/gofrog/crypto" "github.com/jfrog/gofrog/version" "io" "os" @@ -161,14 +161,14 @@ func readModFile(version, projectPath, deploymentRepo, relPathInRepo string, cre return content, nil, nil } - checksums, err := biutils.CalcChecksums(bytes.NewBuffer(content)) + checksums, err := crypto.CalcChecksums(bytes.NewBuffer(content)) if err != nil { return nil, nil, errorutils.CheckError(err) } // Add mod file as artifact artifact := &buildinfo.Artifact{Name: version + ".mod", Type: "mod", OriginalDeploymentRepo: deploymentRepo, Path: relPathInRepo} - artifact.Checksum = buildinfo.Checksum{Sha1: checksums[biutils.SHA1], Md5: checksums[biutils.MD5]} + artifact.Checksum = buildinfo.Checksum{Sha1: checksums[crypto.SHA1], Md5: checksums[crypto.MD5]} return content, artifact, nil } diff --git a/artifactory/commands/transferfiles/state/utils.go b/artifactory/commands/transferfiles/state/utils.go index e1bbdcfeb..2cb401536 100644 --- a/artifactory/commands/transferfiles/state/utils.go +++ b/artifactory/commands/transferfiles/state/utils.go @@ -2,13 +2,13 @@ package state import ( "fmt" + "github.com/jfrog/gofrog/crypto" "path/filepath" "strconv" "strings" "sync/atomic" "time" - "github.com/jfrog/build-info-go/utils" "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils" "github.com/jfrog/jfrog-client-go/utils/errorutils" "github.com/jfrog/jfrog-client-go/utils/io/fileutils" @@ -100,11 +100,11 @@ func GetRepositoryTransferDir(repoKey string) (string, error) { } func getRepositoryHash(repoKey string) (string, error) { - checksums, err := utils.CalcChecksums(strings.NewReader(repoKey), utils.SHA1) + checksums, err := crypto.CalcChecksums(strings.NewReader(repoKey), crypto.SHA1) if err = errorutils.CheckError(err); err != nil { return "", err } - return checksums[utils.SHA1], nil + return checksums[crypto.SHA1], nil } func GetJfrogTransferRepoSubDir(repoKey, subDirName string) (string, error) { diff --git a/artifactory/utils/search.go b/artifactory/utils/search.go index c72d68d76..2bd7f67b7 100644 --- a/artifactory/utils/search.go +++ b/artifactory/utils/search.go @@ -156,7 +156,7 @@ func SearchResultNoDate(reader *content.ContentReader) (contentReader *content.C delete(resultItem.Props, "vcs.revision") writer.Write(*resultItem) } - if err := reader.GetError(); err != nil { + if err = reader.GetError(); err != nil { return nil, err } reader.Reset() diff --git a/go.mod b/go.mod index 2525aebe9..5d13d2e03 100644 --- a/go.mod +++ b/go.mod @@ -12,9 +12,9 @@ require ( github.com/google/uuid v1.6.0 github.com/gookit/color v1.5.4 github.com/jedib0t/go-pretty/v6 v6.5.9 - github.com/jfrog/build-info-go v1.9.31 + github.com/jfrog/build-info-go v1.9.32 github.com/jfrog/gofrog v1.7.5 - github.com/jfrog/jfrog-client-go v1.43.1 + github.com/jfrog/jfrog-client-go v1.43.2 github.com/magiconair/properties v1.8.7 github.com/manifoldco/promptui v0.9.0 github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c @@ -96,8 +96,8 @@ require ( gopkg.in/warnings.v0 v0.1.2 // indirect ) -// replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20240730070406-235dd0e8c95b +// replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20240804093619-f1e3266838bc -// replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20240729133409-38a2c49a0d75 +// replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20240804091815-7407ceb49077 // replace github.com/jfrog/gofrog => github.com/jfrog/gofrog v1.3.3-0.20231223133729-ef57bd08cedc diff --git a/go.sum b/go.sum index 065460790..a816dcf06 100644 --- a/go.sum +++ b/go.sum @@ -92,12 +92,12 @@ github.com/jedib0t/go-pretty/v6 v6.5.9 h1:ACteMBRrrmm1gMsXe9PSTOClQ63IXDUt03H5U+ github.com/jedib0t/go-pretty/v6 v6.5.9/go.mod h1:zbn98qrYlh95FIhwwsbIip0LYpwSG8SUOScs+v9/t0E= github.com/jfrog/archiver/v3 v3.6.1 h1:LOxnkw9pOn45DzCbZNFV6K0+6dCsQ0L8mR3ZcujO5eI= github.com/jfrog/archiver/v3 v3.6.1/go.mod h1:VgR+3WZS4N+i9FaDwLZbq+jeU4B4zctXL+gL4EMzfLw= -github.com/jfrog/build-info-go v1.9.31 h1:1pLC19hc9AEdWA87D+EcvMTLsDeMa390Z8TrNpCO4K8= -github.com/jfrog/build-info-go v1.9.31/go.mod h1:DZCElS/UhaSJHn0K1YzRUOJqiqVS4bjAEnGQSFncwNw= +github.com/jfrog/build-info-go v1.9.32 h1:PKXAMe84sMdob6eBtwwGz47Fz2cmjMwMPoHW8xuk08Q= +github.com/jfrog/build-info-go v1.9.32/go.mod h1:JTGnENexG1jRhKWCkQtZuDb0PerlzlSzF5OmMLG9kfc= github.com/jfrog/gofrog v1.7.5 h1:dFgtEDefJdlq9cqTRoe09RLxS5Bxbe1Ev5+E6SmZHcg= github.com/jfrog/gofrog v1.7.5/go.mod h1:jyGiCgiqSSR7k86hcUSu67XVvmvkkgWTmPsH25wI298= -github.com/jfrog/jfrog-client-go v1.43.1 h1:KIauYofb7R02mGDc8XADEvu245BJjUryjtq+YQQIbY8= -github.com/jfrog/jfrog-client-go v1.43.1/go.mod h1:J/Ketm4TkBudXG8gAGY74jtNUbKhXn1+XaRfJcJVkvA= +github.com/jfrog/jfrog-client-go v1.43.2 h1:NLSTTSFUkrNiSYs8rpRW7/sd6gDTPOi/eMVkGEarXq0= +github.com/jfrog/jfrog-client-go v1.43.2/go.mod h1:JUevXnjHbGL0MIIPs48L/axJMW/q4ioWMR1e1NuVn8w= 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/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=