Skip to content
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

Merged
merged 1 commit into from
Oct 23, 2023

Conversation

nitishfy
Copy link
Member

@nitishfy nitishfy commented Oct 7, 2023

Reference: kubernetes/sig-release#2295

Implement CRUD operations for OBS packages and Interfaces

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 7, 2023
@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 7, 2023
@k8s-ci-robot k8s-ci-robot added sig/release Categorizes an issue or PR as relevant to SIG Release. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 7, 2023
@nitishfy nitishfy force-pushed the Nitish/obs-testing branch 2 times, most recently from a077847 to cf2a6e4 Compare October 12, 2023 18:14
@nitishfy nitishfy changed the title obs: implement testing for the library functions obs: implement interfaces for the library functions Oct 12, 2023
Copy link
Member

@xmudrii xmudrii left a 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 Show resolved Hide resolved
obs/project.go Outdated Show resolved Hide resolved
obs/project.go Outdated

type obsClient struct {
*http.Client
*Options
Copy link
Member

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

Copy link
Member Author

@nitishfy nitishfy Oct 16, 2023

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.

Copy link
Member

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)

Copy link
Member

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?

obs/project.go Outdated Show resolved Hide resolved
obs/project.go Outdated Show resolved Hide resolved
obs/project.go Outdated Show resolved Hide resolved
obs/project.go Outdated Show resolved Hide resolved
obs/project.go Outdated Show resolved Hide resolved
obs/project.go Outdated Show resolved Hide resolved
obs/project.go Outdated Show resolved Hide resolved
obs/project.go Outdated Show resolved Hide resolved
obs/project.go Outdated Show resolved Hide resolved
obs/project.go Outdated Show resolved Hide resolved
obs/project.go Outdated Show resolved Hide resolved
obs/project.go Outdated Show resolved Hide resolved
obs/packages.go Outdated Show resolved Hide resolved
obs/packages.go Outdated Show resolved Hide resolved
obs/packages.go Outdated Show resolved Hide resolved
obs/packages.go Outdated Show resolved Hide resolved
obs/project.go Outdated Show resolved Hide resolved
obs/project.go Outdated Show resolved Hide resolved
obs/project.go Outdated Show resolved Hide resolved
obs/project.go Outdated Show resolved Hide resolved
obs/packages.go Outdated Show resolved Hide resolved
obs/packages.go Outdated Show resolved Hide resolved
@nitishfy nitishfy changed the title obs: implement interfaces for the library functions obs: implement interfaces & CRUD operations for packages Oct 16, 2023
@nitishfy nitishfy marked this pull request as ready for review October 16, 2023 19:29
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 16, 2023
obs/packages.go Outdated
Comment on lines 117 to 120
pkg := &Package{}
if err := xml.NewDecoder(resp.Body).Decode(&pkg); err != nil {
return nil, fmt.Errorf("listing obs packages: decoding packages: %w", err)
}
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about now?

obs/packages.go Outdated Show resolved Hide resolved
obs/project.go Outdated Show resolved Hide resolved
obs/packages.go Outdated Show resolved Hide resolved
obs/project.go Outdated Show resolved Hide resolved
obs/project.go Outdated Show resolved Hide resolved
obs/project.go Outdated Show resolved Hide resolved
obs/project.go Outdated Show resolved Hide resolved
obs/packages.go Outdated
}

// ListPackages lists packages in a given OBS project
func (o *OBS) ListPackages(ctx context.Context, projectName string) ([]string, error) {
Copy link
Member

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.

Copy link
Member Author

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

Copy link
Member

@xmudrii xmudrii left a 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 Show resolved Hide resolved
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"`
Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nitishfy nitishfy requested a review from xmudrii October 20, 2023 14:41
Copy link
Member

@xmudrii xmudrii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 23, 2023
@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 23, 2023
@k8s-ci-robot k8s-ci-robot merged commit bc78723 into kubernetes-sigs:main Oct 23, 2023
@nitishfy nitishfy deleted the Nitish/obs-testing branch October 23, 2023 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. sig/release Categorizes an issue or PR as relevant to SIG Release. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants