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 1 commit
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
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("JFrog Pipelines URL specified as part of the server configuration")
sverdlov93 marked this conversation as resolved.
Show resolved Hide resolved
}
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