Skip to content

Improve error message for invalid OCI repository name in rad bicep publish --target argument #10517

@brooke-hamilton

Description

@brooke-hamilton

Overview of feature request

When running the rad bicep publish command, the --target argument must comply with OCI registry naming rules for specifying the registry, repository, and tag. If the argument fails validation, the error message from the oras.land/oras-go/v2/registry.ParseReference(string) command is returned. The problem is that the message is not descriptive enough to inform the user that the name is invalid. For example, the command below attempts to run rad bicep publish with uppercase characters in the --target argument, which is invalid according to OCI naming rules.

$ rad bicep publish --file kubernetes-mysql.bicep --target "br:localhost:5000/myregistry/Data/mySqlDatabases/kubernetes/kubernetesmysql:latest" --plain-http
Building bicep/kubernetes-mysql.bicep...
Error: invalid reference: invalid repository "myregistry/Data/mySqlDatabases/kubernetes/kubernetesmysql"

The desired behavior is that the error message would explain that OCI naming rules are being enforced, and give the user some idea about how to discover what those rules are, or give the user a summary of the rules.

Acceptance criteria

acceptance-criteria:

  • The error message for invalid --target arguments during rad bicep publish must explicitly state that OCI naming rules are being enforced.
  • The error message must indicate which part of the --target argument is invalid (registry, repository, or tag).
  • The error message must include a brief summary of OCI naming rules or provide a link to documentation for those rules.
  • The error message must guide users to correct their argument, such as suggesting lowercase characters for repository names.
  • The error message must help users understand why their input failed validation and how to resolve the issue.
  • Validation logic should be consistent with the rules implemented in reference.go.

Additional context

The library that Radius uses to parse the name is here: https://github.com/oras-project/oras-go/blob/main/registry/reference.go#L119-L120
Link to the Radius code: https://github.com/radius-project/radius/blob/main/pkg/cli/cmd/bicep/publish/publish.go#L298

Would you like to support us?

  • Yes, I would like to support you

AB#17295

Metadata

Metadata

Labels

featureThis issue describes a feature request in Radiusgood first issueGood for newcomerstriagedThis issue has been reviewed and triaged

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions