From d510b02f476a50e9b1c80cd393ca999470ea9067 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 28 Aug 2023 18:25:31 +0000 Subject: [PATCH] Bump github.com/jfrog/jfrog-client-go from 1.31.5 to 1.31.6 Bumps [github.com/jfrog/jfrog-client-go](https://github.com/jfrog/jfrog-client-go) from 1.31.5 to 1.31.6. - [Release notes](https://github.com/jfrog/jfrog-client-go/releases) - [Commits](https://github.com/jfrog/jfrog-client-go/compare/v1.31.5...v1.31.6) --- updated-dependencies: - dependency-name: github.com/jfrog/jfrog-client-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 +- .../jfrog-client-go/access/services/login.go | 16 ++++---- .../artifactory/services/delete.go | 3 +- .../artifactory/services/discardBuilds.go | 10 +++-- .../artifactory/services/distribute.go | 7 ++-- .../artifactory/services/dockerpromote.go | 7 ++-- .../artifactory/services/download.go | 2 +- .../artifactory/services/go/publish.go | 11 ++--- .../artifactory/services/movecopy.go | 4 +- .../artifactory/services/ping.go | 4 +- .../artifactory/services/promote.go | 3 +- .../artifactory/services/props.go | 4 +- .../artifactory/services/readfile.go | 4 +- .../artifactory/services/security.go | 7 ++-- .../artifactory/services/storage.go | 12 +++--- .../artifactory/services/upload.go | 23 ++++++----- .../services/utils/artifactoryutils.go | 23 +---------- .../artifactory/services/xrayscan.go | 2 +- .../lifecycle/services/delete.go | 4 +- .../lifecycle/services/operation.go | 3 +- .../lifecycle/services/status.go | 4 +- .../jfrog/jfrog-client-go/utils/utils.go | 41 ++++++++++++++++++- vendor/modules.txt | 2 +- 24 files changed, 116 insertions(+), 86 deletions(-) diff --git a/go.mod b/go.mod index 6c30fc00..dff78f28 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( github.com/Masterminds/semver v1.5.0 github.com/jfrog/jfrog-cli-core/v2 v2.41.2 - github.com/jfrog/jfrog-client-go v1.31.5 + github.com/jfrog/jfrog-client-go v1.31.6 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/go.sum b/go.sum index 20f33a42..e584e385 100644 --- a/go.sum +++ b/go.sum @@ -204,8 +204,8 @@ 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.41.2 h1:Gnp93JcDAnHHCN3SHqam2K/S9yJcytS4q+MQd6vv9Ck= github.com/jfrog/jfrog-cli-core/v2 v2.41.2/go.mod h1:YqB9rEJF1P7uGLIPUvF5qdDDf1zM5f4DneIQNkqyAfs= -github.com/jfrog/jfrog-client-go v1.31.5 h1:dYVgIJzMwX+EU9GEELKPSHFLyfW6UrrjZWMEZtAyx6A= -github.com/jfrog/jfrog-client-go v1.31.5/go.mod h1:icb00ZJN/mMMNkQduHDkzpqsXH9Flwi3f3COYexq3Nc= +github.com/jfrog/jfrog-client-go v1.31.6 h1:uWuyT4BDm9s5ES6oDTBny9Gl6yf8iKFjcbmHSHQZrDc= +github.com/jfrog/jfrog-client-go v1.31.6/go.mod h1:icb00ZJN/mMMNkQduHDkzpqsXH9Flwi3f3COYexq3Nc= 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/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= diff --git a/vendor/github.com/jfrog/jfrog-client-go/access/services/login.go b/vendor/github.com/jfrog/jfrog-client-go/access/services/login.go index 7a6ce32b..5dd9fdbf 100644 --- a/vendor/github.com/jfrog/jfrog-client-go/access/services/login.go +++ b/vendor/github.com/jfrog/jfrog-client-go/access/services/login.go @@ -2,14 +2,16 @@ package services import ( "encoding/json" - "github.com/jfrog/jfrog-client-go/artifactory/services/utils" + "net/http" + "path" + "time" + + artifactoryutils "github.com/jfrog/jfrog-client-go/artifactory/services/utils" "github.com/jfrog/jfrog-client-go/auth" "github.com/jfrog/jfrog-client-go/http/jfroghttpclient" + "github.com/jfrog/jfrog-client-go/utils" "github.com/jfrog/jfrog-client-go/utils/errorutils" "github.com/jfrog/jfrog-client-go/utils/io/httputils" - "net/http" - "path" - "time" ) const ( @@ -37,7 +39,7 @@ func NewLoginService(client *jfroghttpclient.JfrogHttpClient) *LoginService { func (ls *LoginService) SendLoginAuthenticationRequest(uuid string) error { restAPI := path.Join(baseClientLoginApi, requestApi) - fullUrl, err := utils.BuildArtifactoryUrl(ls.ServiceDetails.GetUrl(), restAPI, make(map[string]string)) + fullUrl, err := utils.BuildUrl(ls.ServiceDetails.GetUrl(), restAPI, make(map[string]string)) if err != nil { return err } @@ -49,7 +51,7 @@ func (ls *LoginService) SendLoginAuthenticationRequest(uuid string) error { return errorutils.CheckError(err) } httpClientsDetails := ls.ServiceDetails.CreateHttpClientDetails() - utils.SetContentType("application/json", &httpClientsDetails.Headers) + artifactoryutils.SetContentType("application/json", &httpClientsDetails.Headers) resp, body, err := ls.client.SendPost(fullUrl, requestContent, &httpClientsDetails) if err != nil { return err @@ -89,7 +91,7 @@ func (ls *LoginService) GetLoginAuthenticationToken(uuid string) (token auth.Com func (ls *LoginService) getLoginAuthenticationToken(uuid string) (resp *http.Response, body []byte, err error) { restAPI := path.Join(baseClientLoginApi, tokenApi, uuid) - fullUrl, err := utils.BuildArtifactoryUrl(ls.ServiceDetails.GetUrl(), restAPI, make(map[string]string)) + fullUrl, err := utils.BuildUrl(ls.ServiceDetails.GetUrl(), restAPI, make(map[string]string)) if err != nil { return } diff --git a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/delete.go b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/delete.go index 58c1ec3b..887eb264 100644 --- a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/delete.go +++ b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/delete.go @@ -10,6 +10,7 @@ import ( "github.com/jfrog/jfrog-client-go/auth" "github.com/jfrog/jfrog-client-go/http/jfroghttpclient" clientutils "github.com/jfrog/jfrog-client-go/utils" + urlutil "github.com/jfrog/jfrog-client-go/utils" "github.com/jfrog/jfrog-client-go/utils/errorutils" "github.com/jfrog/jfrog-client-go/utils/io/content" "github.com/jfrog/jfrog-client-go/utils/log" @@ -98,7 +99,7 @@ func (ds *DeleteService) createFileHandlerFunc(result *utils.Result) fileDeleteH return func(threadId int) error { result.TotalCount[threadId]++ logMsgPrefix := clientutils.GetLogMsgPrefix(threadId, ds.DryRun) - deletePath, e := utils.BuildArtifactoryUrl(ds.GetArtifactoryDetails().GetUrl(), resultItem.GetItemRelativePath(), make(map[string]string)) + deletePath, e := urlutil.BuildUrl(ds.GetArtifactoryDetails().GetUrl(), resultItem.GetItemRelativePath(), make(map[string]string)) if e != nil { return e } diff --git a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/discardBuilds.go b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/discardBuilds.go index 6316fba1..7a4085d3 100644 --- a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/discardBuilds.go +++ b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/discardBuilds.go @@ -2,16 +2,18 @@ package services import ( "encoding/json" - buildinfo "github.com/jfrog/build-info-go/entities" "net/http" "path" "strconv" "strings" "time" - "github.com/jfrog/jfrog-client-go/artifactory/services/utils" + buildinfo "github.com/jfrog/build-info-go/entities" + + artifactoryutils "github.com/jfrog/jfrog-client-go/artifactory/services/utils" "github.com/jfrog/jfrog-client-go/auth" "github.com/jfrog/jfrog-client-go/http/jfroghttpclient" + "github.com/jfrog/jfrog-client-go/utils" "github.com/jfrog/jfrog-client-go/utils/errorutils" "github.com/jfrog/jfrog-client-go/utils/log" ) @@ -30,7 +32,7 @@ func (ds *DiscardBuildsService) DiscardBuilds(params DiscardBuildsParams) error discardUrl := ds.ArtDetails.GetUrl() restApi := path.Join("api/build/retention/", params.GetBuildName()) - requestFullUrl, err := utils.BuildArtifactoryUrl(discardUrl, restApi, make(map[string]string)) + requestFullUrl, err := utils.BuildUrl(discardUrl, restApi, make(map[string]string)) if err != nil { return err } @@ -63,7 +65,7 @@ func (ds *DiscardBuildsService) DiscardBuilds(params DiscardBuildsParams) error } httpClientsDetails := ds.getArtifactoryDetails().CreateHttpClientDetails() - utils.SetContentType("application/json", &httpClientsDetails.Headers) + artifactoryutils.SetContentType("application/json", &httpClientsDetails.Headers) resp, body, err := ds.client.SendPost(requestFullUrl, requestContent, &httpClientsDetails) if err != nil { diff --git a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/distribute.go b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/distribute.go index 83e2c89e..e0dd48d6 100644 --- a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/distribute.go +++ b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/distribute.go @@ -6,9 +6,10 @@ import ( "path" "strings" - "github.com/jfrog/jfrog-client-go/artifactory/services/utils" + artifactoryutils "github.com/jfrog/jfrog-client-go/artifactory/services/utils" "github.com/jfrog/jfrog-client-go/auth" "github.com/jfrog/jfrog-client-go/http/jfroghttpclient" + "github.com/jfrog/jfrog-client-go/utils" "github.com/jfrog/jfrog-client-go/utils/errorutils" "github.com/jfrog/jfrog-client-go/utils/log" ) @@ -41,7 +42,7 @@ func (ds *DistributeService) BuildDistribute(params BuildDistributionParams) err distributeUrl := ds.ArtDetails.GetUrl() restApi := path.Join("api/build/distribute/", params.GetBuildName(), params.GetBuildNumber()) - requestFullUrl, err := utils.BuildArtifactoryUrl(distributeUrl, restApi, make(map[string]string)) + requestFullUrl, err := utils.BuildUrl(distributeUrl, restApi, make(map[string]string)) if err != nil { return err } @@ -70,7 +71,7 @@ func (ds *DistributeService) BuildDistribute(params BuildDistributionParams) err } httpClientsDetails := ds.getArtifactoryDetails().CreateHttpClientDetails() - utils.SetContentType("application/json", &httpClientsDetails.Headers) + artifactoryutils.SetContentType("application/json", &httpClientsDetails.Headers) resp, body, err := ds.client.SendPost(requestFullUrl, requestContent, &httpClientsDetails) if err != nil { diff --git a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/dockerpromote.go b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/dockerpromote.go index e1f7d359..e51a573b 100644 --- a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/dockerpromote.go +++ b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/dockerpromote.go @@ -5,9 +5,10 @@ import ( "net/http" "path" - "github.com/jfrog/jfrog-client-go/artifactory/services/utils" + artifactoryutils "github.com/jfrog/jfrog-client-go/artifactory/services/utils" "github.com/jfrog/jfrog-client-go/auth" "github.com/jfrog/jfrog-client-go/http/jfroghttpclient" + "github.com/jfrog/jfrog-client-go/utils" "github.com/jfrog/jfrog-client-go/utils/errorutils" "github.com/jfrog/jfrog-client-go/utils/log" ) @@ -36,7 +37,7 @@ func (ps *DockerPromoteService) IsDryRun() bool { func (ps *DockerPromoteService) PromoteDocker(params DockerPromoteParams) error { // Create URL restApi := path.Join("api/docker", params.SourceRepo, "v2", "promote") - url, err := utils.BuildArtifactoryUrl(ps.GetArtifactoryDetails().GetUrl(), restApi, nil) + url, err := utils.BuildUrl(ps.GetArtifactoryDetails().GetUrl(), restApi, nil) if err != nil { return err } @@ -57,7 +58,7 @@ func (ps *DockerPromoteService) PromoteDocker(params DockerPromoteParams) error // Send POST request httpClientsDetails := ps.GetArtifactoryDetails().CreateHttpClientDetails() - utils.SetContentType("application/json", &httpClientsDetails.Headers) + artifactoryutils.SetContentType("application/json", &httpClientsDetails.Headers) resp, body, err := ps.client.SendPost(url, requestContent, &httpClientsDetails) if err != nil { return err diff --git a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/download.go b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/download.go index 941c7234..c7e76df7 100644 --- a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/download.go +++ b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/download.go @@ -502,7 +502,7 @@ func (ds *DownloadService) createFileHandlerFunc(downloadParams DownloadParams, return func(downloadData DownloadData) parallel.TaskFunc { return func(threadId int) error { logMsgPrefix := clientutils.GetLogMsgPrefix(threadId, ds.DryRun) - downloadPath, e := utils.BuildArtifactoryUrl(ds.GetArtifactoryDetails().GetUrl(), downloadData.Dependency.GetItemRelativePath(), make(map[string]string)) + downloadPath, e := clientutils.BuildUrl(ds.GetArtifactoryDetails().GetUrl(), downloadData.Dependency.GetItemRelativePath(), make(map[string]string)) if e != nil { return e } diff --git a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/go/publish.go b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/go/publish.go index 3e89c94c..63426812 100644 --- a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/go/publish.go +++ b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/go/publish.go @@ -8,9 +8,10 @@ import ( "github.com/jfrog/gofrog/version" "github.com/jfrog/jfrog-client-go/utils/log" - "github.com/jfrog/jfrog-client-go/artifactory/services/utils" + artifactoryutils "github.com/jfrog/jfrog-client-go/artifactory/services/utils" "github.com/jfrog/jfrog-client-go/auth" "github.com/jfrog/jfrog-client-go/http/jfroghttpclient" + "github.com/jfrog/jfrog-client-go/utils" clientutils "github.com/jfrog/jfrog-client-go/utils" "github.com/jfrog/jfrog-client-go/utils/errorutils" "github.com/jfrog/jfrog-client-go/utils/io/content" @@ -37,8 +38,8 @@ func (gpc *GoPublishCommand) verifyCompatibleVersion(artifactoryVersion string) return nil } -func (gpc *GoPublishCommand) PublishPackage(params GoParams, client *jfroghttpclient.JfrogHttpClient, artDetails auth.ServiceDetails) (*utils.OperationSummary, error) { - goApiUrl, err := utils.BuildArtifactoryUrl(artDetails.GetUrl(), "api/go/", make(map[string]string)) +func (gpc *GoPublishCommand) PublishPackage(params GoParams, client *jfroghttpclient.JfrogHttpClient, artDetails auth.ServiceDetails) (*artifactoryutils.OperationSummary, error) { + goApiUrl, err := utils.BuildUrl(artDetails.GetUrl(), "api/go/", make(map[string]string)) if err != nil { return nil, err } @@ -72,7 +73,7 @@ func (gpc *GoPublishCommand) PublishPackage(params GoParams, client *jfroghttpcl return nil, err } - return &utils.OperationSummary{TotalSucceeded: totalSucceed, TotalFailed: totalFailed, TransferDetailsReader: content.NewContentReader(fileTransferDetailsTempFile, "files")}, nil + return &artifactoryutils.OperationSummary{TotalSucceeded: totalSucceed, TotalFailed: totalFailed, TransferDetailsReader: content.NewContentReader(fileTransferDetailsTempFile, "files")}, nil } func (gpc *GoPublishCommand) uploadFile(params GoParams, filePath string, moduleId, ext, goApiUrl string, filesDetails *[]clientutils.FileTransferDetails, pwa *GoPublishCommand) (success, failed int, err error) { @@ -108,7 +109,7 @@ func (gpc *GoPublishCommand) upload(localPath, pathInArtifactory, version, props if err != nil { return nil, err } - utils.AddChecksumHeaders(gpc.clientDetails.Headers, details) + artifactoryutils.AddChecksumHeaders(gpc.clientDetails.Headers, details) resp, body, err := gpc.client.UploadFile(localPath, goApiUrl, "", &gpc.clientDetails, nil) if err != nil { return nil, err diff --git a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/movecopy.go b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/movecopy.go index ed7a27bd..1a911256 100644 --- a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/movecopy.go +++ b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/movecopy.go @@ -237,7 +237,7 @@ func (mc *MoveCopyService) moveOrCopyFile(sourcePath, destPath, logMsgPrefix str } else { log.Info(logMsgPrefix + message) } - requestFullUrl, err := utils.BuildArtifactoryUrl(moveUrl, restApi, params) + requestFullUrl, err := clientutils.BuildUrl(moveUrl, restApi, params) if err != nil { return false, err } @@ -268,7 +268,7 @@ func (mc *MoveCopyService) createPathForMoveAction(destPath, logMsgPrefix string func (mc *MoveCopyService) createPathInArtifactory(destPath, logMsgPrefix string) (bool, error) { rtUrl := mc.GetArtifactoryDetails().GetUrl() - requestFullUrl, err := utils.BuildArtifactoryUrl(rtUrl, destPath, map[string]string{}) + requestFullUrl, err := clientutils.BuildUrl(rtUrl, destPath, map[string]string{}) if err != nil { return false, err } diff --git a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/ping.go b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/ping.go index dc2b5e3a..45a798d1 100644 --- a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/ping.go +++ b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/ping.go @@ -3,9 +3,9 @@ package services import ( "net/http" - "github.com/jfrog/jfrog-client-go/artifactory/services/utils" "github.com/jfrog/jfrog-client-go/auth" "github.com/jfrog/jfrog-client-go/http/jfroghttpclient" + "github.com/jfrog/jfrog-client-go/utils" "github.com/jfrog/jfrog-client-go/utils/errorutils" "github.com/jfrog/jfrog-client-go/utils/log" ) @@ -32,7 +32,7 @@ func (ps *PingService) IsDryRun() bool { } func (ps *PingService) Ping() ([]byte, error) { - url, err := utils.BuildArtifactoryUrl(ps.GetArtifactoryDetails().GetUrl(), "api/system/ping", nil) + url, err := utils.BuildUrl(ps.GetArtifactoryDetails().GetUrl(), "api/system/ping", nil) if err != nil { return nil, err } diff --git a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/promote.go b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/promote.go index 794f0d7d..a56c297f 100644 --- a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/promote.go +++ b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/promote.go @@ -8,6 +8,7 @@ import ( "github.com/jfrog/jfrog-client-go/artifactory/services/utils" "github.com/jfrog/jfrog-client-go/auth" "github.com/jfrog/jfrog-client-go/http/jfroghttpclient" + clientutils "github.com/jfrog/jfrog-client-go/utils" "github.com/jfrog/jfrog-client-go/utils/errorutils" "github.com/jfrog/jfrog-client-go/utils/log" ) @@ -41,7 +42,7 @@ func (ps *PromoteService) BuildPromote(promotionParams PromotionParams) error { queryParams["project"] = promotionParams.ProjectKey } - requestFullUrl, err := utils.BuildArtifactoryUrl(promoteUrl, restApi, queryParams) + requestFullUrl, err := clientutils.BuildUrl(promoteUrl, restApi, queryParams) if err != nil { return err } diff --git a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/props.go b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/props.go index c716f865..54c94b19 100644 --- a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/props.go +++ b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/props.go @@ -108,7 +108,7 @@ func (ps *PropsService) performRequest(propsParams PropsParams, isDelete bool) ( logMsgPrefix := clientutils.GetLogMsgPrefix(threadId, ps.IsDryRun()) restAPI := path.Join("api", "storage", relativePath) - setPropertiesURL, err := utils.BuildArtifactoryUrl(ps.GetArtifactoryDetails().GetUrl(), restAPI, make(map[string]string)) + setPropertiesURL, err := clientutils.BuildUrl(ps.GetArtifactoryDetails().GetUrl(), restAPI, make(map[string]string)) if err != nil { return err } @@ -166,7 +166,7 @@ func NewPropsParams() PropsParams { func (ps *PropsService) GetItemProperties(relativePath string) (*utils.ItemProperties, error) { restAPI := path.Join("api", "storage", path.Clean(relativePath)) - propertiesURL, err := utils.BuildArtifactoryUrl(ps.GetArtifactoryDetails().GetUrl(), restAPI, make(map[string]string)) + propertiesURL, err := clientutils.BuildUrl(ps.GetArtifactoryDetails().GetUrl(), restAPI, make(map[string]string)) if err != nil { return nil, err } diff --git a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/readfile.go b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/readfile.go index 413890f6..75015304 100644 --- a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/readfile.go +++ b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/readfile.go @@ -4,9 +4,9 @@ import ( "io" "net/http" - "github.com/jfrog/jfrog-client-go/artifactory/services/utils" "github.com/jfrog/jfrog-client-go/auth" "github.com/jfrog/jfrog-client-go/http/jfroghttpclient" + "github.com/jfrog/jfrog-client-go/utils" "github.com/jfrog/jfrog-client-go/utils/errorutils" ) @@ -39,7 +39,7 @@ func (ds *ReadFileService) SetDryRun(isDryRun bool) { } func (ds *ReadFileService) ReadRemoteFile(downloadPath string) (io.ReadCloser, error) { - readPath, err := utils.BuildArtifactoryUrl(ds.GetArtifactoryDetails().GetUrl(), downloadPath, make(map[string]string)) + readPath, err := utils.BuildUrl(ds.GetArtifactoryDetails().GetUrl(), downloadPath, make(map[string]string)) if err != nil { return nil, err } diff --git a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/security.go b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/security.go index bc837e24..78153ec3 100644 --- a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/security.go +++ b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/security.go @@ -8,7 +8,6 @@ import ( "strconv" "strings" - "github.com/jfrog/jfrog-client-go/artifactory/services/utils" "github.com/jfrog/jfrog-client-go/auth" "github.com/jfrog/jfrog-client-go/http/jfroghttpclient" clientutils "github.com/jfrog/jfrog-client-go/utils" @@ -34,7 +33,7 @@ func (ss *SecurityService) getArtifactoryDetails() auth.ServiceDetails { // Create an API key for the current user. Returns an error if API key already exists - use regenerate API key instead. func (ss *SecurityService) CreateAPIKey() (string, error) { httpClientDetails := ss.ArtDetails.CreateHttpClientDetails() - reqURL, err := utils.BuildArtifactoryUrl(ss.ArtDetails.GetUrl(), APIKeyPath, nil) + reqURL, err := clientutils.BuildUrl(ss.ArtDetails.GetUrl(), APIKeyPath, nil) if err != nil { return "", err } @@ -55,7 +54,7 @@ func (ss *SecurityService) CreateAPIKey() (string, error) { func (ss *SecurityService) RegenerateAPIKey() (string, error) { httpClientDetails := ss.ArtDetails.CreateHttpClientDetails() - reqURL, err := utils.BuildArtifactoryUrl(ss.ArtDetails.GetUrl(), APIKeyPath, nil) + reqURL, err := clientutils.BuildUrl(ss.ArtDetails.GetUrl(), APIKeyPath, nil) if err != nil { return "", err } @@ -75,7 +74,7 @@ func (ss *SecurityService) RegenerateAPIKey() (string, error) { // Returns empty string if API Key wasn't generated. func (ss *SecurityService) GetAPIKey() (string, error) { httpClientDetails := ss.ArtDetails.CreateHttpClientDetails() - reqURL, err := utils.BuildArtifactoryUrl(ss.ArtDetails.GetUrl(), APIKeyPath, nil) + reqURL, err := clientutils.BuildUrl(ss.ArtDetails.GetUrl(), APIKeyPath, nil) if err != nil { return "", err } diff --git a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/storage.go b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/storage.go index 97489e0f..51c4453c 100644 --- a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/storage.go +++ b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/storage.go @@ -2,14 +2,16 @@ package services import ( "encoding/json" + "net/http" + "path" + "strconv" + "github.com/jfrog/jfrog-client-go/artifactory/services/utils" "github.com/jfrog/jfrog-client-go/auth" "github.com/jfrog/jfrog-client-go/http/jfroghttpclient" + clientutils "github.com/jfrog/jfrog-client-go/utils" "github.com/jfrog/jfrog-client-go/utils/errorutils" "github.com/jfrog/jfrog-client-go/utils/log" - "net/http" - "path" - "strconv" ) type StorageService struct { @@ -34,7 +36,7 @@ func (s *StorageService) GetJfrogHttpClient() *jfroghttpclient.JfrogHttpClient { func (s *StorageService) FolderInfo(relativePath string) (*utils.FolderInfo, error) { client := s.GetJfrogHttpClient() restAPI := path.Join(StorageRestApi, path.Clean(relativePath)) - folderUrl, err := utils.BuildArtifactoryUrl(s.GetArtifactoryDetails().GetUrl(), restAPI, make(map[string]string)) + folderUrl, err := clientutils.BuildUrl(s.GetArtifactoryDetails().GetUrl(), restAPI, make(map[string]string)) if err != nil { return nil, err } @@ -69,7 +71,7 @@ func (s *StorageService) FileList(relativePath string, optionalParams utils.File params["depth"] = strconv.Itoa(optionalParams.Depth) } - folderUrl, err := utils.BuildArtifactoryUrl(s.GetArtifactoryDetails().GetUrl(), restAPI, params) + folderUrl, err := clientutils.BuildUrl(s.GetArtifactoryDetails().GetUrl(), restAPI, params) if err != nil { return nil, err } diff --git a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/upload.go b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/upload.go index 11826760..0abf3458 100644 --- a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/upload.go +++ b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/upload.go @@ -4,6 +4,16 @@ import ( "archive/zip" "errors" "fmt" + "io" + "net/http" + "os" + "path/filepath" + "regexp" + "sort" + "strconv" + "strings" + "sync" + "github.com/jfrog/build-info-go/entities" biutils "github.com/jfrog/build-info-go/utils" "github.com/jfrog/gofrog/parallel" @@ -18,15 +28,6 @@ import ( "github.com/jfrog/jfrog-client-go/utils/io/fileutils" "github.com/jfrog/jfrog-client-go/utils/io/httputils" "github.com/jfrog/jfrog-client-go/utils/log" - "io" - "net/http" - "os" - "path/filepath" - "regexp" - "sort" - "strconv" - "strings" - "sync" ) type UploadService struct { @@ -742,7 +743,7 @@ func (us *UploadService) postUpload(uploadResult *utils.Result, threadId int, ar } func (us *UploadService) createFolderInArtifactory(artifact UploadData) error { - url, err := utils.BuildArtifactoryUrl(us.ArtDetails.GetUrl(), artifact.Artifact.TargetPath, make(map[string]string)) + url, err := clientutils.BuildUrl(us.ArtDetails.GetUrl(), artifact.Artifact.TargetPath, make(map[string]string)) url = clientutils.AddTrailingSlashIfNeeded(url) if err != nil { return err @@ -912,7 +913,7 @@ func (us *UploadService) addFileToZip(artifact *clientutils.Artifact, progressPr } func buildUploadUrls(artifactoryUrl, targetPath, buildProps, debianConfig string, targetProps *utils.Properties) (targetUrlWithProps string, err error) { - targetUrl, err := utils.BuildArtifactoryUrl(artifactoryUrl, targetPath, make(map[string]string)) + targetUrl, err := clientutils.BuildUrl(artifactoryUrl, targetPath, make(map[string]string)) if err != nil { return } diff --git a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/utils/artifactoryutils.go b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/utils/artifactoryutils.go index 9c51b818..f89c3805 100644 --- a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/utils/artifactoryutils.go +++ b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/utils/artifactoryutils.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "net/url" "path" "strings" "sync" @@ -97,26 +96,6 @@ func AddHeader(headerName, headerValue string, headers *map[string]string) { (*headers)[headerName] = headerValue } -// Builds a URL for Artifactory requests. -// Pay attention: semicolons are escaped! -func BuildArtifactoryUrl(baseUrl, path string, params map[string]string) (string, error) { - u := url.URL{Path: path} - parsedUrl, err := url.Parse(baseUrl + u.String()) - err = errorutils.CheckError(err) - if err != nil { - return "", err - } - q := parsedUrl.Query() - for k, v := range params { - q.Set(k, v) - } - parsedUrl.RawQuery = q.Encode() - - // Semicolons are reserved as separators in some Artifactory APIs, so they'd better be encoded when used for other purposes - encodedUrl := strings.ReplaceAll(parsedUrl.String(), ";", url.QueryEscape(";")) - return encodedUrl, nil -} - func IsWildcardPattern(pattern string) bool { return strings.Contains(pattern, "*") || strings.HasSuffix(pattern, "/") || !strings.Contains(pattern, "/") } @@ -580,7 +559,7 @@ func GetBuildInfo(buildName, buildNumber, projectKey string, flags CommonConf) ( queryParams["project"] = projectKey } - requestFullUrl, err := BuildArtifactoryUrl(flags.GetArtifactoryDetails().GetUrl(), restApi, queryParams) + requestFullUrl, err := utils.BuildUrl(flags.GetArtifactoryDetails().GetUrl(), restApi, queryParams) if err != nil { return nil, false, err } diff --git a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/xrayscan.go b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/xrayscan.go index b2e6a897..99542adb 100644 --- a/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/xrayscan.go +++ b/vendor/github.com/jfrog/jfrog-client-go/artifactory/services/xrayscan.go @@ -38,7 +38,7 @@ func NewXrayScanService(client *jfroghttpclient.JfrogHttpClient) *XrayScanServic // Deprecated legacy scan build. The new build scan command is in "/xray/commands/scan/buildscan" func (ps *XrayScanService) ScanBuild(scanParams XrayScanParams) ([]byte, error) { url := ps.ArtDetails.GetUrl() - requestFullUrl, err := utils.BuildArtifactoryUrl(url, apiUri, make(map[string]string)) + requestFullUrl, err := clientutils.BuildUrl(url, apiUri, make(map[string]string)) if err != nil { return []byte{}, err } diff --git a/vendor/github.com/jfrog/jfrog-client-go/lifecycle/services/delete.go b/vendor/github.com/jfrog/jfrog-client-go/lifecycle/services/delete.go index 0910712e..1596c949 100644 --- a/vendor/github.com/jfrog/jfrog-client-go/lifecycle/services/delete.go +++ b/vendor/github.com/jfrog/jfrog-client-go/lifecycle/services/delete.go @@ -1,7 +1,7 @@ package services import ( - rtUtils "github.com/jfrog/jfrog-client-go/artifactory/services/utils" + "github.com/jfrog/jfrog-client-go/utils" "github.com/jfrog/jfrog-client-go/utils/errorutils" "net/http" "path" @@ -12,7 +12,7 @@ func (rbs *ReleaseBundlesService) DeleteReleaseBundle(rbDetails ReleaseBundleDet queryParams := getProjectQueryParam(params.ProjectKey) queryParams[async] = strconv.FormatBool(params.Async) restApi := path.Join(releaseBundleBaseApi, records, rbDetails.ReleaseBundleName, rbDetails.ReleaseBundleVersion) - requestFullUrl, err := rtUtils.BuildArtifactoryUrl(rbs.GetLifecycleDetails().GetUrl(), restApi, queryParams) + requestFullUrl, err := utils.BuildUrl(rbs.GetLifecycleDetails().GetUrl(), restApi, queryParams) if err != nil { return err } diff --git a/vendor/github.com/jfrog/jfrog-client-go/lifecycle/services/operation.go b/vendor/github.com/jfrog/jfrog-client-go/lifecycle/services/operation.go index 539c47e3..3d44f6db 100644 --- a/vendor/github.com/jfrog/jfrog-client-go/lifecycle/services/operation.go +++ b/vendor/github.com/jfrog/jfrog-client-go/lifecycle/services/operation.go @@ -5,6 +5,7 @@ import ( rtUtils "github.com/jfrog/jfrog-client-go/artifactory/services/utils" "github.com/jfrog/jfrog-client-go/auth" "github.com/jfrog/jfrog-client-go/http/jfroghttpclient" + "github.com/jfrog/jfrog-client-go/utils" "github.com/jfrog/jfrog-client-go/utils/errorutils" "github.com/jfrog/jfrog-client-go/utils/log" "net/http" @@ -36,7 +37,7 @@ type ReleaseBundleOperation interface { func (rbs *ReleaseBundlesService) doOperation(operation ReleaseBundleOperation) ([]byte, error) { queryParams := getProjectQueryParam(operation.getOperationParams().ProjectKey) queryParams[async] = strconv.FormatBool(operation.getOperationParams().Async) - requestFullUrl, err := rtUtils.BuildArtifactoryUrl(rbs.GetLifecycleDetails().GetUrl(), operation.getOperationRestApi(), queryParams) + requestFullUrl, err := utils.BuildUrl(rbs.GetLifecycleDetails().GetUrl(), operation.getOperationRestApi(), queryParams) if err != nil { return []byte{}, err } diff --git a/vendor/github.com/jfrog/jfrog-client-go/lifecycle/services/status.go b/vendor/github.com/jfrog/jfrog-client-go/lifecycle/services/status.go index ba696f3c..35364a79 100644 --- a/vendor/github.com/jfrog/jfrog-client-go/lifecycle/services/status.go +++ b/vendor/github.com/jfrog/jfrog-client-go/lifecycle/services/status.go @@ -3,7 +3,7 @@ package services import ( "encoding/json" "fmt" - rtUtils "github.com/jfrog/jfrog-client-go/artifactory/services/utils" + "github.com/jfrog/jfrog-client-go/utils" "github.com/jfrog/jfrog-client-go/utils/errorutils" "github.com/jfrog/jfrog-client-go/utils/io/httputils" "net/http" @@ -52,7 +52,7 @@ func (rbs *ReleaseBundlesService) getReleaseBundleOperationStatus(restApi string } func (rbs *ReleaseBundlesService) getReleaseBundleStatus(restApi string, projectKey string) (statusResp ReleaseBundleStatusResponse, body []byte, err error) { - requestFullUrl, err := rtUtils.BuildArtifactoryUrl(rbs.GetLifecycleDetails().GetUrl(), restApi, getProjectQueryParam(projectKey)) + requestFullUrl, err := utils.BuildUrl(rbs.GetLifecycleDetails().GetUrl(), restApi, getProjectQueryParam(projectKey)) if err != nil { return } diff --git a/vendor/github.com/jfrog/jfrog-client-go/utils/utils.go b/vendor/github.com/jfrog/jfrog-client-go/utils/utils.go index af928142..bd6eb06b 100644 --- a/vendor/github.com/jfrog/jfrog-client-go/utils/utils.go +++ b/vendor/github.com/jfrog/jfrog-client-go/utils/utils.go @@ -16,6 +16,7 @@ import ( "github.com/jfrog/build-info-go/entities" "github.com/jfrog/gofrog/stringutils" + "github.com/jfrog/gofrog/version" "github.com/jfrog/jfrog-client-go/utils/io/fileutils" @@ -26,7 +27,19 @@ import ( const ( Development = "development" Agent = "jfrog-client-go" - Version = "1.31.5" + Version = "1.31.6" +) + +type MinVersionProduct string + +const ( + Artifactory MinVersionProduct = "JFrog Artifactory" + Xray MinVersionProduct = "JFrog Xray" + DataTransfer MinVersionProduct = "Data Transfer" + DockerApi MinVersionProduct = "Docker API" + Projects MinVersionProduct = "JFrog Projects" + + MinimumVersionMsg = "You are using %s version %s, while this operation requires version %s or higher." ) // In order to limit the number of items loaded from a reader into the memory, we use a buffers with this size limit. @@ -52,6 +65,13 @@ func getDefaultUserAgent() string { return fmt.Sprintf("%s/%s", Agent, getVersion()) } +func ValidateMinimumVersion(product MinVersionProduct, currentVersion, minimumVersion string) error { + if !version.NewVersion(currentVersion).AtLeast(minimumVersion) { + return errorutils.CheckErrorf(MinimumVersionMsg, product, currentVersion, minimumVersion) + } + return nil +} + // Get the local root path, from which to start collecting artifacts to be used for: // 1. Uploaded to Artifactory, // 2. Adding to the local build-info, to be later published to Artifactory. @@ -210,6 +230,25 @@ func cleanPath(path string) string { return path } +// Builds a URL for Artifactory/Xray requests. +// Pay attention: semicolons are escaped! +func BuildUrl(baseUrl, path string, params map[string]string) (string, error) { + u := url.URL{Path: path} + parsedUrl, err := url.Parse(baseUrl + u.String()) + if err = errorutils.CheckError(err); err != nil { + return "", err + } + q := parsedUrl.Query() + for k, v := range params { + q.Set(k, v) + } + parsedUrl.RawQuery = q.Encode() + + // Semicolons are reserved as separators in some Artifactory APIs, so they'd better be encoded when used for other purposes + encodedUrl := strings.ReplaceAll(parsedUrl.String(), ";", url.QueryEscape(";")) + return encodedUrl, nil +} + // BuildTargetPath Replaces matched regular expression from path to corresponding placeholder {i} at target. // Example 1: // diff --git a/vendor/modules.txt b/vendor/modules.txt index 979b5c01..2fcea824 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -245,7 +245,7 @@ github.com/jfrog/jfrog-cli-core/v2/xray/commands/scan github.com/jfrog/jfrog-cli-core/v2/xray/commands/utils github.com/jfrog/jfrog-cli-core/v2/xray/formats github.com/jfrog/jfrog-cli-core/v2/xray/utils -# github.com/jfrog/jfrog-client-go v1.31.5 +# github.com/jfrog/jfrog-client-go v1.31.6 ## explicit; go 1.20 github.com/jfrog/jfrog-client-go/access github.com/jfrog/jfrog-client-go/access/auth