Skip to content

Commit 4ec7b88

Browse files
authored
Merge pull request #1426 from jfrog/release-2.59.4
Release 2.59.4
2 parents 9cf424e + 567c2c6 commit 4ec7b88

File tree

30 files changed

+77
-67
lines changed

30 files changed

+77
-67
lines changed

artifactory/commands/transfer/settings.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func (tst *TransferSettingsCommand) Run() error {
3535
ioutils.ScanFromConsole("Set the maximum number of working threads", &threadsNumberInput, currThreadsNumber)
3636
threadsNumber, err := strconv.Atoi(threadsNumberInput)
3737
if err != nil || threadsNumber < 1 || threadsNumber > MaxThreadsLimit {
38-
return errorutils.CheckErrorf("the value must be a number between 1 and " + strconv.Itoa(MaxThreadsLimit))
38+
return errorutils.CheckErrorf("the value must be a number between 1 and %s", strconv.Itoa(MaxThreadsLimit))
3939
}
4040
conf := &utils.TransferSettings{ThreadsNumber: threadsNumber}
4141
err = utils.SaveTransferSettings(conf)

artifactory/commands/transferconfig/transferconfig.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ func (tcc *TransferConfigCommand) verifyConfigImportPlugin() error {
291291

292292
// Unexpected status received: 403 if the user is not admin, 500+ if there is a server error
293293
messageFormat := fmt.Sprintf("Target server response: %s.\n%s", resp.Status, body)
294-
return errorutils.CheckErrorf(messageFormat)
294+
return errors.New(messageFormat)
295295
}
296296

297297
// Creates the Pre-checks runner for the config import command

artifactory/commands/transferfiles/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ func uploadChunkWhenPossibleHandler(pcWrapper *producerConsumerWrapper, phaseBas
417417
shouldStop := uploadChunkWhenPossible(pcWrapper, phaseBase, chunk, uploadTokensChan, errorsChannelMng)
418418
if shouldStop {
419419
// The specific error that triggered the stop is already in the errors channel
420-
return errorutils.CheckErrorf(logMsgPrefix + "stopped")
420+
return errorutils.CheckErrorf("%sstopped", logMsgPrefix)
421421
}
422422
return nil
423423
}

artifactory/commands/utils/templateutils.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ func ConvertTemplateToMaps(templateUserCommand TemplateUserCommand) (interface{}
7070

7171
func ValidateMapEntry(key string, value interface{}, writersMap map[string]ioutils.AnswerWriter) error {
7272
if _, ok := writersMap[key]; !ok {
73-
return errorutils.CheckErrorf("template syntax error: unknown key: \"" + key + "\".")
73+
return errorutils.CheckErrorf("template syntax error: unknown key: \"%s\".", key)
7474
}
7575
if _, ok := value.(string); !ok {
76-
return errorutils.CheckErrorf("template syntax error: the value for the key: \"" + key + "\" is not a string type.")
76+
return errorutils.CheckErrorf("template syntax error: the value for the key: \"%s\" is not a string type.", key)
7777
}
7878
return nil
7979
}

artifactory/commands/utils/transfer.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@ package utils
22

33
import (
44
"encoding/json"
5+
"errors"
56
"fmt"
7+
"net/http"
8+
"time"
9+
610
"github.com/gocarina/gocsv"
711
ioutils "github.com/jfrog/gofrog/io"
812
logutils "github.com/jfrog/jfrog-cli-core/v2/utils/log"
913
"github.com/jfrog/jfrog-client-go/http/jfroghttpclient"
1014
"github.com/jfrog/jfrog-client-go/utils/errorutils"
1115
"github.com/jfrog/jfrog-client-go/utils/io/httputils"
12-
"net/http"
13-
"time"
1416
)
1517

1618
type ServerType string
@@ -40,7 +42,7 @@ func GetTransferPluginVersion(client *jfroghttpclient.JfrogHttpClient, url, plug
4042
return "", errorutils.CheckErrorf("%sIt looks like the %s plugin is not installed on the %s server.", messageFormat, pluginName, serverType)
4143
} else {
4244
// 403 if the user is not admin, 500+ if there is a server error
43-
return "", errorutils.CheckErrorf(messageFormat)
45+
return "", errors.New(messageFormat)
4446
}
4547
}
4648

artifactory/utils/container/buildinfo.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func newBuildInfoBuilder(image *Image, repository, buildName, buildNumber, proje
7171
repoDetails := &services.RepositoryDetails{}
7272
err = serviceManager.GetRepository(repository, &repoDetails)
7373
if err != nil {
74-
return nil, errorutils.CheckErrorf("failed to get details for repository '" + repository + "'. Error:\n" + err.Error())
74+
return nil, errorutils.CheckErrorf("failed to get details for repository '%s'. Error:\n%s", repository, err.Error())
7575
}
7676

7777
builder.repositoryDetails.isRemote = repoDetails.GetRepoType() == "remote"
@@ -324,11 +324,11 @@ func GetImageTagWithDigest(filePath string) (*Image, string, error) {
324324
// Try read Kaniko/oc file.
325325
splittedData := strings.Split(string(data), `@`)
326326
if len(splittedData) != 2 {
327-
return nil, "", errorutils.CheckErrorf(`unexpected file format "` + filePath + `". The file should include one line in the following format: image-tag@sha256`)
327+
return nil, "", errorutils.CheckErrorf(`unexpected file format "%s". The file should include one line in the following format: image-tag@sha256`, filePath)
328328
}
329329
tag, sha256 := splittedData[0], strings.Trim(splittedData[1], "\n")
330330
if tag == "" || sha256 == "" {
331-
err = errorutils.CheckErrorf(`missing image-tag/sha256 in file: "` + filePath + `"`)
331+
err = errorutils.CheckErrorf(`missing image-tag/sha256 in file: "%s"`, filePath)
332332
if err != nil {
333333
return nil, "", err
334334
}
@@ -609,7 +609,7 @@ func getDependenciesFromManifestConfig(candidateLayers map[string]*utils.ResultI
609609
dependencies = append(dependencies, getManifestDependency(manifestSearchResults))
610610
imageDetails, found := candidateLayers[digestToLayer(imageSha2)]
611611
if !found {
612-
return nil, errorutils.CheckErrorf("failed to collect build-info. Image '" + imageSha2 + "' was not found in Artifactory")
612+
return nil, errorutils.CheckErrorf("failed to collect build-info. Image '%s' was not found in Artifactory", imageSha2)
613613
}
614614

615615
return append(dependencies, imageDetails.ToDependency()), nil

artifactory/utils/container/containermanager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func (containerManager *containerManager) OsCompatibility(image *Image) (string,
8484
content = strings.Trim(content, "\n")
8585
firstSeparator := strings.Index(content, ",")
8686
if firstSeparator == -1 {
87-
return "", "", errorutils.CheckErrorf("couldn't find OS and architecture of image:" + image.name)
87+
return "", "", errorutils.CheckErrorf("couldn't find OS and architecture of image: %s", image.name)
8888
}
8989
return content[:firstSeparator], content[firstSeparator+1:], err
9090
}

artifactory/utils/container/image.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package container
22

33
import (
4+
"errors"
45
"net/http"
56
"path"
67
"strconv"
@@ -154,15 +155,15 @@ func (image *Image) GetRemoteRepo(serviceManager artifactory.ArtifactoryServices
154155
return "", err
155156
}
156157
if resp.StatusCode == http.StatusForbidden {
157-
return "", errorutils.CheckErrorf(getStatusForbiddenErrorMessage())
158+
return "", errors.New(getStatusForbiddenErrorMessage())
158159
}
159160
if resp.StatusCode != http.StatusOK {
160-
return "", errorutils.CheckErrorf("error while getting docker repository name. Artifactory response: " + resp.Status)
161+
return "", errorutils.CheckErrorf("error while getting docker repository name. Artifactory response: %s", resp.Status)
161162
}
162163
if dockerRepo := resp.Header["X-Artifactory-Docker-Registry"]; len(dockerRepo) != 0 {
163164
return dockerRepo[0], nil
164165
}
165-
return "", errorutils.CheckErrorf("couldn't find 'X-Artifactory-Docker-Registry' header docker repository in artifactory")
166+
return "", errors.New("couldn't find 'X-Artifactory-Docker-Registry' header docker repository in artifactory")
166167
}
167168

168169
// Returns the name of the repository containing the image in Artifactory.

artifactory/utils/container/localagent.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,5 +192,5 @@ func handleForeignLayer(layerMediaType, layerFileName string) error {
192192
log.Info(fmt.Sprintf("Foreign layer: %s is missing in Artifactory and therefore will not be added to the build-info.", layerFileName))
193193
return nil
194194
}
195-
return errorutils.CheckErrorf("Could not find layer: " + layerFileName + " in Artifactory")
195+
return errorutils.CheckErrorf("Could not find layer: %s in Artifactory", layerFileName)
196196
}

artifactory/utils/container/remoteagent.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func (rabib *RemoteAgentBuildInfoBuilder) handleManifest(resultMap map[string]*u
6565
log.Debug("Found manifest.json. Proceeding to create build-info.")
6666
return resultMap, manifest, nil
6767
}
68-
return nil, nil, errorutils.CheckErrorf(`couldn't find image "` + rabib.buildInfoBuilder.image.name + `" manifest in Artifactory`)
68+
return nil, nil, errorutils.CheckErrorf(`couldn't find image "%s" manifest in Artifactory`, rabib.buildInfoBuilder.image.name)
6969
}
7070

7171
func (rabib *RemoteAgentBuildInfoBuilder) handleFatManifestImage(results map[string]*utils.ResultItem) (map[string][]*utils.ResultItem, *utils.ResultItem, *FatManifest, error) {
@@ -79,7 +79,7 @@ func (rabib *RemoteAgentBuildInfoBuilder) handleFatManifestImage(results map[str
7979
multiPlatformImages, err := performMultiPlatformImageSearch(fatManifestRootPath, rabib.buildInfoBuilder.serviceManager)
8080
return multiPlatformImages, fatManifestResult, fatManifest, err
8181
}
82-
return nil, nil, nil, errorutils.CheckErrorf(`couldn't find image "` + rabib.buildInfoBuilder.image.name + `" fat manifest in Artifactory`)
82+
return nil, nil, nil, errorutils.CheckErrorf(`couldn't find image "%s" fat manifest in Artifactory`, rabib.buildInfoBuilder.image.name)
8383
}
8484

8585
// Search image manifest or fat-manifest of and image.

0 commit comments

Comments
 (0)