feat: add component references to CLI internals#86
Merged
jakobmoellerdev merged 2 commits intoMay 5, 2025
Merged
Conversation
361d53e to
dfec335
Compare
```
// Parse parses an input string into a Ref.
// Accepted inputs are of the forms
//
// - [ctf::][<file path>/[<DefaultPrefix>]/<component id>[:<version>][@<digest>]
// - [oci::][<registry>/<repository>/[<DefaultPrefix>]/<component id>[:<version>][@<digest>]
// - localhost[:<port>]/[<DefaultPrefix>]/<component id>[:<version>] - localhost special cases
//
// Not accepted cases that were valid in old OCM:
//
// - [type::][<repositorySpecJSON>/[<DefaultPrefix>]/<component id>[:<version>] - arbitrary repository definitions
// - <repositoryAlias>//[<DefaultPrefix>]/<component id>[:<version>] - repository aliases for the ocm configuration
//
// All non-supported special cases are currently under review of being accepted forms.
//
// in a much smaller scope and size and will grow over time.
func Parse(input string) (*Ref, error) { ... }
```
This code roughly resembles
https://github.com/open-component-model/ocm/blob/2ea69c7ecca1e8be7e9d9f94dfdcac6090f1c69d/api/oci/ref_test.go
dfec335 to
239cc46
Compare
frewilhelm
previously approved these changes
May 2, 2025
frewilhelm
approved these changes
May 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it
reintroduces the concept of universal component references:
that can be parsed from input strings
This code roughly resembles
https://github.com/open-component-model/ocm/blob/2ea69c7ecca1e8be7e9d9f94dfdcac6090f1c69d/api/oci/ref_test.go
We need this in order to supply the CLI with a possibility for a positional arg that acts like the old OCM reference.
Which issue(s) this PR fixes
fix open-component-model/ocm-project#477
needed in order to prepare for get cv command