Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error messages, related to misconfigured JFrog URL #2739

Merged
merged 4 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion distribution/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ func createDistributionDetailsByFlags(c *cli.Context) (*coreConfig.ServerDetails
return nil, err
}
if dsDetails.DistributionUrl == "" {
return nil, errors.New("the --dist-url option is mandatory")
return nil, errors.New("no JFrog Distribution URL specified, either via the --url flag or as part of the server configuration")
}
return dsDetails, nil
}
4 changes: 2 additions & 2 deletions general/summary/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,10 @@ func shouldGenerateUploadSummary() (bool, error) {
func createPlatformDetailsByFlags(c *cli.Context) (*coreConfig.ServerDetails, error) {
platformDetails, err := cliutils.CreateServerDetailsWithConfigOffer(c, true, commonCliUtils.Platform)
if err != nil {
return nil, fmt.Errorf("error creating platform details: %w", err)
return nil, fmt.Errorf("error creating JFrog Platform details: %w", err)
}
if platformDetails.Url == "" {
return nil, errors.New("platform URL is mandatory for access token creation")
return nil, errors.New("no JFrog Platform URL specified, either via the --url flag or as part of the server configuration")
}
return platformDetails, nil
}
Expand Down
2 changes: 1 addition & 1 deletion general/token/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func createPlatformDetailsByFlags(c *cli.Context) (*coreConfig.ServerDetails, er
return nil, err
}
if platformDetails.Url == "" {
return nil, errors.New("JFrog Platform URL is mandatory for access token creation")
return nil, errors.New("no JFrog Platform URL specified, either via the --url flag or as part of the server configuration")
}
return platformDetails, nil
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/jszwec/csvutil v1.10.0
github.com/manifoldco/promptui v0.9.0
github.com/stretchr/testify v1.9.0
github.com/testcontainers/testcontainers-go v0.33.0
github.com/testcontainers/testcontainers-go v0.34.0
github.com/urfave/cli v1.22.16
github.com/xeipuuv/gojsonschema v1.2.0
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c
Expand All @@ -51,7 +51,7 @@ require (
github.com/cloudflare/circl v1.4.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/platforms v0.2.1 // indirect
github.com/cpuguy83/dockercfg v0.3.1 // indirect
github.com/cpuguy83/dockercfg v0.3.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
Expand Down
9 changes: 5 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I=
github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo=
github.com/containerd/platforms v0.2.1 h1:zvwtM3rz2YHPQsF2CHYM8+KtB5dvhISiXh5ZpSBQv6A=
github.com/containerd/platforms v0.2.1/go.mod h1:XHCb+2/hzowdiut9rkudds9bE5yJ7npe7dG/wG+uFPw=
github.com/cpuguy83/dockercfg v0.3.1 h1:/FpZ+JaygUR/lZP2NlFI2DVfrOEMAIKP5wWEJdoYe9E=
github.com/cpuguy83/dockercfg v0.3.1/go.mod h1:sugsbF4//dDlL/i+S+rtpIWp+5h0BHJHfjj5/jFyUJc=
github.com/cpuguy83/dockercfg v0.3.2 h1:DlJTyZGBDlXqUZ2Dk2Q3xHs/FtnooJJVaad2S9GKorA=
github.com/cpuguy83/dockercfg v0.3.2/go.mod h1:sugsbF4//dDlL/i+S+rtpIWp+5h0BHJHfjj5/jFyUJc=
github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc=
github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
Expand Down Expand Up @@ -324,6 +324,7 @@ github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
Expand All @@ -338,8 +339,8 @@ github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
github.com/terminalstatic/go-xsd-validate v0.1.5 h1:RqpJnf6HGE2CB/lZB1A8BYguk8uRtcvYAPLCF15qguo=
github.com/terminalstatic/go-xsd-validate v0.1.5/go.mod h1:18lsvYFofBflqCrvo1umpABZ99+GneNTw2kEEc8UPJw=
github.com/testcontainers/testcontainers-go v0.33.0 h1:zJS9PfXYT5O0ZFXM2xxXfk4J5UMw/kRiISng037Gxdw=
github.com/testcontainers/testcontainers-go v0.33.0/go.mod h1:W80YpTa8D5C3Yy16icheD01UTDu+LmXIA2Keo+jWtT8=
github.com/testcontainers/testcontainers-go v0.34.0 h1:5fbgF0vIN5u+nD3IWabQwRybuB4GY8G2HHgCkbMzMHo=
github.com/testcontainers/testcontainers-go v0.34.0/go.mod h1:6P/kMkQe8yqPHfPWNulFGdFHTD8HB2vLq/231xY2iPQ=
github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU=
github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI=
github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=
Expand Down
2 changes: 1 addition & 1 deletion lifecycle/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ func createLifecycleDetailsByFlags(c *cli.Context) (*coreConfig.ServerDetails, e
return nil, err
}
if lcDetails.Url == "" {
return nil, errors.New("JFrog Platform URL is mandatory for lifecycle commands")
return nil, errors.New("no JFrog Platform URL specified, either via the --url flag or as part of the server configuration")
}
PlatformToLifecycleUrls(lcDetails)
return lcDetails, nil
Expand Down
4 changes: 2 additions & 2 deletions pipelines/cli.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package pipelines

import (
"fmt"
"errors"
"github.com/jfrog/jfrog-cli-core/v2/common/commands"
corecommon "github.com/jfrog/jfrog-cli-core/v2/docs/common"
pipelines "github.com/jfrog/jfrog-cli-core/v2/pipelines/commands"
Expand Down Expand Up @@ -87,7 +87,7 @@ func createPipelinesDetailsByFlags(c *cli.Context) (*coreConfig.ServerDetails, e
return nil, err
}
if plDetails.PipelinesUrl == "" {
return nil, fmt.Errorf("the --pipelines-url option is mandatory")
return nil, errors.New("no JFrog Pipelines URL specified as part of the server configuration")
}
return plDetails, nil
}
Expand Down
6 changes: 3 additions & 3 deletions utils/cliutils/commandsflags.go
Original file line number Diff line number Diff line change
Expand Up @@ -1245,7 +1245,7 @@ var flagsMap = map[string]cli.Flag{
// Distribution's commands Flags
distUrl: cli.StringFlag{
Name: url,
Usage: "[Optional] JFrog Distribution URL.` `",
Usage: "[Optional] JFrog Distribution URL. (example: https://acme.jfrog.io/distribution)` `",
},
rbDryRun: cli.BoolFlag{
Name: dryRun,
Expand Down Expand Up @@ -1320,7 +1320,7 @@ var flagsMap = map[string]cli.Flag{
// Xray's commands Flags
xrUrl: cli.StringFlag{
Name: url,
Usage: "[Optional] JFrog Xray URL.` `",
Usage: "[Optional] JFrog Xray URL. (example: https://acme.jfrog.io/xray)` `",
},
xrayScan: cli.StringFlag{
Name: xrayScan,
Expand Down Expand Up @@ -1483,7 +1483,7 @@ var flagsMap = map[string]cli.Flag{
// Mission Control's commands Flags
mcUrl: cli.StringFlag{
Name: url,
Usage: "[Optional] JFrog Mission Control URL.` `",
Usage: "[Optional] JFrog Mission Control URL. (example: https://acme.jfrog.io/mc)` `",
},
mcAccessToken: cli.StringFlag{
Name: accessToken,
Expand Down
2 changes: 1 addition & 1 deletion utils/cliutils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ func CreateArtifactoryDetailsByFlags(c *cli.Context) (*coreConfig.ServerDetails,
return nil, err
}
if artDetails.ArtifactoryUrl == "" {
return nil, errors.New("the --url option is mandatory")
return nil, errors.New("no JFrog Artifactory URL specified, either via the --url flag or as part of the server configuration")
}
return artDetails, nil
}
Expand Down
Loading