-
Notifications
You must be signed in to change notification settings - Fork 29
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
obs: implement interfaces & CRUD operations for packages #255
obs: implement interfaces & CRUD operations for packages #255
Conversation
Skipping CI for Draft Pull Request. |
a077847
to
cf2a6e4
Compare
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.
Overall looks good, but some changes are required to get this merged
obs/project.go
Outdated
|
||
type obsClient struct { | ||
*http.Client | ||
*Options |
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.
Options are not needed here
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.
InvokeOBSEndpoint
function has a receiver of type obsClient
and we need to access the username
and password
to set the authentication. Hence this is the reason why Options have been included here.
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.
IMO in that case the InvokeOBSEndpoint function should take username and password as parameters (cc @cpanato)
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.
yeah, i think that should be a parameter as well
also, did you create a small testing cli code to use this and test it manually to check if you were able to do things?
35001cc
to
5d0f837
Compare
obs/packages.go
Outdated
pkg := &Package{} | ||
if err := xml.NewDecoder(resp.Body).Decode(&pkg); err != nil { | ||
return nil, fmt.Errorf("listing obs packages: decoding packages: %w", err) | ||
} |
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.
This is a bit strange. This function is supposed to return a list of packages, but we're decoding the output into a single package. Can you please double check what is returned by the API?
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.
How about now?
bc01d79
to
f61305a
Compare
obs/packages.go
Outdated
} | ||
|
||
// ListPackages lists packages in a given OBS project | ||
func (o *OBS) ListPackages(ctx context.Context, projectName string) ([]string, error) { |
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.
This function is not going to work. We can discuss further about that, but I recommend removing it for now so that we can get this PR merged.
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 finding a way to test this function can help here. However, we can move this to next PR
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.
Some final remarks, but it's important to resolve these remarks before merging the PR. Once resolved, we can merge the PR
obs/packages.go
Outdated
Title string `json:"title,omitempty" xml:"title,omitempty"` | ||
Description string `json:"description,omitempty" xml:"description,omitempty"` | ||
Devel Devel `json:"devel" xml:"devel"` | ||
Entries []Entry `json:"entry" xml:"entry"` |
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 don't see this present in API endpoints for creating/updating and getting packages, I recommend removing it for now or eventually marking it as omitempty
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.
It's part of the meta file for packages - https://api.opensuse.org/apidocs/#/Sources%20-%20Packages/get_source__project_name___package_name___meta
b5caa07
to
90cfb2a
Compare
efd2587
to
f54e086
Compare
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.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nitishfy, xmudrii 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 |
Reference: kubernetes/sig-release#2295
Implement CRUD operations for OBS packages and Interfaces