-
Notifications
You must be signed in to change notification settings - Fork 27
registry library api change for multi-version stack/sample support #108
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
Conversation
… filter Signed-off-by: Stephanie <[email protected]>
Signed-off-by: Stephanie <[email protected]>
Signed-off-by: Stephanie <[email protected]>
registry-library/devfile.yaml
Outdated
@@ -0,0 +1,50 @@ | |||
schemaVersion: 2.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was accidentally added?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, this should be deleted.
registry-library/library/library.go
Outdated
endpoint = endpoint + "minSchemaVersion=" + options.Filter.MinSchemaVersion + "&" | ||
} | ||
if options.Filter.MaxSchemaVersion != "" { | ||
endpoint = endpoint + "maxSchemaVersion=" + options.Filter.MaxSchemaVersion + "&" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the "&" necessary on this line? Since we always just trim it afterwards?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since updated to use query.add()
as suggested, this part has been removed as no need to manually build the query string using &
registry-library/library/library.go
Outdated
@@ -129,6 +145,16 @@ func GetRegistryIndex(registryURL string, options RegistryOptions, devfileTypes | |||
endpoint = strings.TrimSuffix(endpoint, "&") | |||
} | |||
|
|||
if options.NewIndexSchema && (options.Filter.MaxSchemaVersion != "" || options.Filter.MinSchemaVersion != "") { | |||
if options.Filter.MinSchemaVersion != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it would be better to add the query parameters like so:
req, err := http.NewRequest("GET", "<registry-url>", nil)
if err != nil {
...
}
q := req.URL.Query()
if options.Filter.MinSchemaVersion != "" {
q.Add("minSchemaVersion", "options.Filter.MinSchemaVersion")
}
if options.Filter.MaxSchemaVersion != "" {
q.Add("maxSchemaVersion", "options.Filter.MaxSchemaVersion")
}
req.URL.RawQuery = q.Encode()
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
Signed-off-by: Stephanie <[email protected]>
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: johnmcollier, yangcao77 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Please specify the area for this PR
registry library
What does does this PR do / why we need it:
This PR adds registry option
NewIndexSchema
, if specifies to true to get the v2index schema. (default to false)also adds
MaxSchemaVersion
andMinSchemaVersion
to filter the v2index with devfile schema version.Also update the param
stack
inPullStackFromRegistry
, to contains both name and version information for backward compatibility. Use colon to split,name:version
. If no version is provided, pull the default version.version=latest is also supported
update the
root.go
under cmd and tested with this change.Which issue(s) this PR fixes:
Fixes devfile/api#763
PR acceptance criteria:
Test (WIP)
Documentation (WIP)
How to test changes / Special notes to the reviewer: