Skip to content

Commit

Permalink
Improve error message about missing registry (#2293)
Browse files Browse the repository at this point in the history
  • Loading branch information
pPrecel authored Dec 20, 2024
1 parent a4d9651 commit 35618b0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
8 changes: 2 additions & 6 deletions internal/cmd/alpha/app/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func runAppPush(cfg *appPushConfig) clierror.Error {
if cfg.dockerfilePath != "" || cfg.packAppPath != "" {
registryConfig, cliErr := registry.GetInternalConfig(cfg.Ctx, client)
if cliErr != nil {
return clierror.WrapE(cliErr, clierror.New("failed to load in-cluster registry configuration"))
return cliErr
}

image, clierr = buildAndImportImage(client, cfg, registryConfig)
Expand Down Expand Up @@ -203,11 +203,7 @@ func buildAndImportImage(client kube.Client, cfg *appPushConfig, registryConfig
},
)
if cliErr != nil {
return "", clierror.WrapE(cliErr, clierror.New(
"failed to import image to in-cluster registry",
"make sure cluster is available and properly configured",
"enable docker registry module by calling `kyma alpha module enable docker-registry -c experimental`",
))
return "", clierror.WrapE(cliErr, clierror.New("failed to import image to in-cluster registry"))
}

return pushedImage, nil
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/alpha/registry/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func runConfig(cfg *cfgConfig) clierror.Error {

registryConfig, err := registry.GetExternalConfig(cfg.Ctx, client)
if err != nil {
return clierror.WrapE(err, clierror.New("failed to load in-cluster registry configuration"))
return err
}

if cfg.externalurl && cfg.output == "" {
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/alpha/registry/imageimport/imageimport.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func runImageImport(config *provisionConfig) clierror.Error {
// TODO: Add "serverless is not installed" error message
registryConfig, err := registry.GetInternalConfig(config.Ctx, client)
if err != nil {
return clierror.WrapE(err, clierror.New("failed to load in-cluster registry configuration"))
return err
}

fmt.Println("Importing", config.image)
Expand Down
4 changes: 2 additions & 2 deletions internal/registry/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func GetExternalConfig(ctx context.Context, client kube.Client) (*ExternalRegist
return nil, clierror.Wrap(err,
clierror.New("failed to get external registry configuration",
"make sure cluster is available and properly configured",
"make sure the Docker Registry is installed and in Ready/Warning state.",
"enable docker registry module by calling `kyma alpha module enable docker-registry -c experimental`",
),
)
}
Expand All @@ -46,7 +46,7 @@ func GetInternalConfig(ctx context.Context, client kube.Client) (*InternalRegist
return nil, clierror.Wrap(err,
clierror.New("failed to load in-cluster registry configuration",
"make sure cluster is available and properly configured",
"make sure the Docker Registry is installed and in Ready/Warning state.",
"enable docker registry module by calling `kyma alpha module enable docker-registry -c experimental`",
),
)
}
Expand Down

0 comments on commit 35618b0

Please sign in to comment.