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

🌱 Add verify-import-restrictions to enforce import restrictions #2338

Merged
merged 1 commit into from
Sep 12, 2023

Conversation

laozc
Copy link
Member

@laozc laozc commented Sep 8, 2023

What this PR does / why we need it:
This PR introduces a new make target verify-import-restrictions to verify imports in source codes
to prevent regression mentioned in #2159.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #2159

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 8, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @laozc. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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 the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 8, 2023
@codecov-commenter
Copy link

codecov-commenter commented Sep 8, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.12% ⚠️

Comparison is base (df01a95) 50.27% compared to head (34bcb8f) 50.16%.
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2338      +/-   ##
==========================================
- Coverage   50.27%   50.16%   -0.12%     
==========================================
  Files          87       87              
  Lines        8041     8041              
==========================================
- Hits         4043     4034       -9     
- Misses       3673     3680       +7     
- Partials      325      327       +2     

see 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

hack/verify-import-restrictions.sh Outdated Show resolved Hide resolved
apis/v1beta1/.import-restrictions Show resolved Hide resolved
@laozc
Copy link
Member Author

laozc commented Sep 12, 2023

It looks like the behavior is not consistent on different machine.
I will take a look.

Copy link
Member

@sbueringer sbueringer left a comment

Choose a reason for hiding this comment

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

One nit.

Nice catch!!

hack/verify-import-restrictions.sh Outdated Show resolved Hide resolved
@sbueringer sbueringer changed the title Add verify-import-restrictions to enforce import restrictions 🌱 Add verify-import-restrictions to enforce import restrictions Sep 12, 2023
@sbueringer
Copy link
Member

sbueringer commented Sep 12, 2023

@laozc If you want / have time you can open the same PR against core CAPI once we merge this PR in CAPV (we can only add import-restrictions to the packages that are already fixed, but that is fine, xref: kubernetes-sigs/cluster-api#9011 (comment))

(otherwise we can take the core CAPI part)

Copy link
Contributor

@killianmuldoon killianmuldoon left a comment

Choose a reason for hiding this comment

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

/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 Sep 12, 2023
@sbueringer
Copy link
Member

Thank you!!

/lgtm

/assign @killianmuldoon @chrischdi

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

LGTM label has been added.

Git tree hash: 81840bfa1b54a5aadd9b68beef022d5546902fd9

@laozc
Copy link
Member Author

laozc commented Sep 12, 2023

Sure. I will open up a PR against CAPI later.

Copy link
Member

@chrischdi chrischdi left a comment

Choose a reason for hiding this comment

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

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chrischdi

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 Sep 12, 2023
@k8s-ci-robot k8s-ci-robot merged commit c154905 into kubernetes-sigs:main Sep 12, 2023
17 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.9 milestone Sep 12, 2023
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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Importing API types pulls in lots of dependencies
6 participants