etcd icon indicating copy to clipboard operation
etcd copied to clipboard

etcdctl: move cobra helper of etcdctl from main pkg to etcdctl pkg

Open ah8ad3 opened this issue 1 year ago • 9 comments

This PR moves cobra helper of etcdctl from main pkg to etcdctl pkg. This will remove cobra dependency from main pkg which wasn't necessary.

This PR was created after suggestion in this comment https://github.com/etcd-io/etcd/pull/18183#discussion_r1687171454 Part of https://github.com/etcd-io/etcd/issues/17777

ah8ad3 avatar Jul 23 '24 08:07 ah8ad3

Hi @ah8ad3. Thanks for your PR.

I'm waiting for a etcd-io 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-sigs/prow repository.

k8s-ci-robot avatar Jul 23 '24 08:07 k8s-ci-robot

/ok-to-test

henrybear327 avatar Aug 01 '24 18:08 henrybear327

Thanks for the pull request, @ah8ad3. IMO, this change makes more sense in its own context than in the other pull request.

Looking at the test failure, it seems like you need to rebase your branch. Can you do it so we can start moving forward? Thanks again.

ivanvc avatar Aug 07 '24 07:08 ivanvc

Codecov Report

Attention: Patch coverage is 42.10526% with 66 lines in your changes missing coverage. Please review.

Project coverage is 68.78%. Comparing base (a423349) to head (d42b043). Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
etcdctl/util/help.go 42.47% 65 Missing :warning:
etcdctl/ctlv3/ctl.go 0.00% 1 Missing :warning:
Additional details and impacted files
Files with missing lines Coverage Δ
pkg/cobrautl/help.go 42.47% <ø> (ø)
etcdctl/ctlv3/ctl.go 0.00% <0.00%> (ø)
etcdctl/util/help.go 42.47% <42.47%> (ø)

... and 26 files with indirect coverage changes

@@            Coverage Diff             @@
##             main   #18356      +/-   ##
==========================================
- Coverage   68.89%   68.78%   -0.12%     
==========================================
  Files         420      421       +1     
  Lines       35788    35901     +113     
==========================================
+ Hits        24656    24693      +37     
- Misses       9709     9777      +68     
- Partials     1423     1431       +8     

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a423349...d42b043. Read the comment docs.

codecov-commenter avatar Aug 09 '24 12:08 codecov-commenter

Ok rebased, make fixed. I think we are good to go.

PTAL @ivanvc

ah8ad3 avatar Aug 09 '24 13:08 ah8ad3

The only concern is that UsageFunc is an exported function, which means it might be used by any application, although it is unlikely in practice.

https://github.com/etcd-io/etcd/blob/ad942b7118b0b2b640ea7bba2f1c45c39211f4c1/pkg/cobrautl/help.go#L154

Please let's

  • either don't change it( close this PR);
  • or add a deprecation note, do not remove it until 3.7.

ahrtr avatar Aug 12 '24 09:08 ahrtr

The only concern is that UsageFunc is an exported function, which means it might be used by any application, although it is unlikely in practice.

That is super unlikely for someone to use this, but you are right to ensure we don't break anybody we should do this. Personally i think removing cobra from there is needed because both the main pkg become lighter and no other module needs it there.

I will try to add deprecation note.

ah8ad3 avatar Aug 15 '24 06:08 ah8ad3

Covered during our triage meeting. @ah8ad3, are you looking into doing Benjamin's suggestion? Or should we close this pull request?

ivanvc avatar Feb 13 '25 19:02 ivanvc

Thanks for looking into this @ivanvc , and sorry for delaying this task. I will take care of the comment and will add the note.

ah8ad3 avatar Feb 14 '25 05:02 ah8ad3

I can not understand what the problem is with verify failing, am i missing some sort of convention in making a function deprecated? Can you please help? @ivanvc

ah8ad3 avatar Feb 27 '25 09:02 ah8ad3

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ah8ad3, ahrtr, ivanvc, jmhbnz

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 avatar Feb 27 '25 12:02 k8s-ci-robot

can you also add a changelog deprecation item for 3.7 (please add a CHANGELOG-3.7.md file), similar to CHANGELOG-3.6.md#deprecations? thx

ahrtr avatar Feb 27 '25 12:02 ahrtr

can you also add a changelog deprecation item for 3.7 (please add a CHANGELOG-3.7.md file), similar to CHANGELOG-3.6.md#deprecations? thx

Of course i will do that as well @ahrtr

ah8ad3 avatar Feb 27 '25 14:02 ah8ad3