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

Refactor pkg/announce package into sub-packages and interface pattern #3580

Merged
merged 8 commits into from
Apr 29, 2024

Conversation

embik
Copy link
Member

@embik embik commented Apr 20, 2024

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

This PR is a proposal for #3565, a refactor that came up while #3559 was in review. Essentially, the pkg/announce package doesn't follow the interface pattern established across many SIG Release packages and as such, it is hard to implement tests for it.

While working on this, I realised that pkg/announce is actually three distinct things in a trench coat (generating the announcement text, updating the GitHub release and generating the SBOM), so I've further refactored the package and split the GitHub release and SBOM generation into sub-packages. I kept them in pkg/announce because that's where the code was before, I'm not sure if they strictly need to be there.

For implementations, I tried to move out code that was interfacing with e.g. the filesystem so that tests can simulate interaction with the filesystem without having to write to it. That way, the "business logic" is the focus of future tests. Due to heavy usage of packages from e.g. release-sdk which already have interface implementations, those can easily be mocked in tests.

Since this is already quite a big diff, I'd propose to add tests in a future PR. I can also squash some commits if wanted, I tried to keep a clear history of the refactor going on, but I'm not sure if that is required.

Which issue(s) this PR fixes:

Fixes #3565

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NONE

Signed-off-by: Marvin Beckers <mail@embik.me>
Signed-off-by: Marvin Beckers <mail@embik.me>
Signed-off-by: Marvin Beckers <mail@embik.me>
Signed-off-by: Marvin Beckers <mail@embik.me>
Signed-off-by: Marvin Beckers <mail@embik.me>
Signed-off-by: Marvin Beckers <mail@embik.me>
@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 20, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @embik. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added area/release-eng Issues or PRs related to the Release Engineering subproject sig/release Categorizes an issue or PR as relevant to SIG Release. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Apr 20, 2024
@embik
Copy link
Member Author

embik commented Apr 20, 2024

/cc @xmudrii

@xmudrii
Copy link
Member

xmudrii commented Apr 20, 2024

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 20, 2024
Signed-off-by: Marvin Beckers <mail@embik.me>
Signed-off-by: Marvin Beckers <mail@embik.me>
@xmudrii
Copy link
Member

xmudrii commented Apr 26, 2024

/assign @saschagrunert

Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

Thanks!

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: embik, saschagrunert

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 Apr 29, 2024
@k8s-ci-robot k8s-ci-robot merged commit 0dcc281 into kubernetes:master Apr 29, 2024
11 checks passed
@embik embik deleted the fix-3565 branch April 29, 2024 09:41
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. area/release-eng Issues or PRs related to the Release Engineering subproject cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. sig/release Categorizes an issue or PR as relevant to SIG Release. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor pkg/announce package to adhere to the interfaces pattern
4 participants