Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Adding 'pluginRuntimeVersion' to tanzu <plugin> info command output #3641

Merged
merged 3 commits into from
Oct 31, 2022

Conversation

anujc25
Copy link
Contributor

@anujc25 anujc25 commented Oct 13, 2022

What this PR does / why we need it

This PR adds "PluginRuntimeVersion" to PluinInfo and it will be returned as part of tanzu <plugin> info command output. This version would be used by tanzu core CLI to add version validations.

Which issue(s) this PR fixes

Fixes #3547

Describe testing done for PR

❯ tanzu management-cluster info
{"name":"management-cluster","description":"Kubernetes management cluster operations","version":"v0.27.0-dev","buildSHA":"74a09a79-dirty","digest":"","group":"Run","docURL":"","completionType":0,"aliases":["mc","management-clusters"],"installationPath":"","discovery":"","scope":"","status":"","discoveredRecommendedVersion":"","pluginRuntimeVersion":"v0.27.0-dev"}

❯ tanzu feature  info
{"name":"feature","description":"Operate on features and featuregates","version":"v0.27.0-dev","buildSHA":"74a09a79-dirty","digest":"","group":"Run","docURL":"","completionType":0,"installationPath":"","discovery":"","scope":"","status":"","discoveredRecommendedVersion":"","pluginRuntimeVersion":"v0.27.0-dev"}

❯ tanzu kr info
{"name":"kubernetes-release","description":"Kubernetes release operations","version":"v0.27.0-dev","buildSHA":"74a09a79-dirty","digest":"","group":"Run","docURL":"","completionType":0,"aliases":["kr","kubernetes-releases"],"installationPath":"","discovery":"","scope":"","status":"","discoveredRecommendedVersion":"","pluginRuntimeVersion":"v0.27.0-dev"}

❯ tanzu login info
{"name":"login","description":"Login to the platform","version":"v0.27.0-dev","buildSHA":"74a09a79-dirty","digest":"","group":"System","docURL":"","completionType":0,"aliases":["lo","logins"],"installationPath":"","discovery":"","scope":"","status":"","discoveredRecommendedVersion":"","pluginRuntimeVersion":"v0.27.0-dev"}

❯ tanzu package info
{"name":"package","description":"Tanzu package management","version":"v0.27.0-dev","buildSHA":"74a09a79-dirty","digest":"","group":"Run","docURL":"","completionType":0,"installationPath":"","discovery":"","scope":"","status":"","discoveredRecommendedVersion":"","pluginRuntimeVersion":"v0.27.0-dev"}

❯ tanzu pinniped-auth info
{"name":"pinniped-auth","description":"Pinniped authentication operations (usually not directly invoked)","version":"v0.27.0-dev","buildSHA":"74a09a79-dirty","digest":"","group":"Run","docURL":"","hidden":true,"completionType":0,"aliases":["pa","pinniped-auths"],"installationPath":"","discovery":"","scope":"","status":"","discoveredRecommendedVersion":"","pluginRuntimeVersion":"v0.27.0-dev"}

❯ tanzu secret info
{"name":"secret","description":"Tanzu secret management","version":"v0.27.0-dev","buildSHA":"74a09a79-dirty","digest":"","group":"Run","docURL":"","completionType":0,"installationPath":"","discovery":"","scope":"","status":"","discoveredRecommendedVersion":"","pluginRuntimeVersion":"v0.27.0-dev"}

 ❯ tanzu telemetry info
{"name":"telemetry","description":"configure cluster-wide settings for vmware tanzu telemetry","version":"v0.27.0-dev","buildSHA":"74a09a79-dirty","digest":"","group":"Run","docURL":"","completionType":0,"installationPath":"","discovery":"","scope":"","status":"","discoveredRecommendedVersion":"","pluginRuntimeVersion":"v0.27.0-dev"}

❯ tanzu builder info
{"name":"builder","description":"Build Tanzu components","version":"v0.27.0-dev","buildSHA":"74a09a79-dirty","digest":"","group":"Admin","docURL":"","completionType":0,"installationPath":"","discovery":"","scope":"","status":"","discoveredRecommendedVersion":"","pluginRuntimeVersion":"v0.27.0-dev"}

❯ tanzu codegen info
{"name":"codegen","description":"Tanzu code generation tool","version":"v0.27.0-dev","buildSHA":"74a09a79-dirty","digest":"","group":"Admin","docURL":"","completionType":0,"installationPath":"","discovery":"","scope":"","status":"","discoveredRecommendedVersion":"","pluginRuntimeVersion":"v0.27.0-dev"}

❯ tanzu test info
{"name":"test","description":"Test the CLI","version":"v0.27.0-dev","buildSHA":"74a09a79-dirty","digest":"","group":"Admin","docURL":"","completionType":0,"installationPath":"","discovery":"","scope":"","status":"","discoveredRecommendedVersion":"","pluginRuntimeVersion":"v0.27.0-dev"}

Release note

Include the plugin runtime library version with `plugin info` to determine plugin runtime version of the plugin

Additional information

Special notes for your reviewer

Signed-off-by: Prem Kumar Kalle <pkalle@vmware.com>
Signed-off-by: Prem Kumar Kalle <pkalle@vmware.com>
@anujc25 anujc25 requested a review from a team as a code owner October 13, 2022 00:12
@anujc25 anujc25 changed the title Add plugin lib version Adding 'pluginRuntimeVersion' to tanzu <plugin> info command output Oct 13, 2022
@codecov
Copy link

codecov bot commented Oct 13, 2022

Codecov Report

Merging #3641 (8f36775) into main (83f9375) will decrease coverage by 0.97%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #3641      +/-   ##
==========================================
- Coverage   46.31%   45.33%   -0.98%     
==========================================
  Files         400      425      +25     
  Lines       39583    41184    +1601     
==========================================
+ Hits        18334    18672     +338     
- Misses      19563    20807    +1244     
- Partials     1686     1705      +19     
Impacted Files Coverage Δ
cli/runtime/plugin/info.go 82.35% <100.00%> (+5.42%) ⬆️
tkg/tkgctl/compatibility.go 0.00% <0.00%> (-70.00%) ⬇️
cli/runtime/config/conversion.go 76.19% <0.00%> (-2.66%) ⬇️
tkg/clusterclient/clusterclient.go 48.31% <0.00%> (-1.06%) ⬇️
addons/controllers/clusterbootstrap_controller.go 63.85% <0.00%> (-1.02%) ⬇️
cli/core/pkg/config/bom.go 86.66% <0.00%> (-0.84%) ⬇️
cli/runtime/component/prompt.go 67.46% <0.00%> (-0.77%) ⬇️
cli/core/pkg/auth/tkg/cluster_pinniped_info.go 71.13% <0.00%> (-0.59%) ⬇️
cli/core/pkg/cluster/client.go 60.81% <0.00%> (-0.27%) ⬇️
tkg/tkgctl/init.go 0.00% <0.00%> (ø)
... and 51 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@vuil
Copy link
Contributor

vuil commented Oct 17, 2022

I'd say the change is acceptable as long as we acknowledge and track (via a gh issue) that the plugin info contract need to be better codified.
As a contract between core CLI and the plugin (through being the key input in NewPlugin()), the PluginDescriptor (and now the PluginInfo) is not clear on what information is expected to be provided by the plugin and what isn't. I think it might be better to express the PluginInfo interface as, well, a golang interface, and only exposes methods to plugin code to set(get?) what is required of it.

And this contract needs to be separated from the other role that PluginDescriptor is playing, which is to encapsulate a bunch of metadata used by the CLI to show plugin state to the user.

Copy link
Contributor

@prkalle prkalle left a comment

Choose a reason for hiding this comment

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

LGTM.

I would wait for @vuil @marckhouzam to review too. Thanks!

Update PluginRuntimeVersion to v0.28.0-dev

Signed-off-by: Anuj Chaudhari <anujc@vmware.com>
@anujc25
Copy link
Contributor Author

anujc25 commented Oct 18, 2022

I'd say the change is acceptable as long as we acknowledge and track (via a gh issue) that the plugin info contract need to be better codified.
As a contract between core CLI and the plugin (through being the key input in NewPlugin()), the PluginDescriptor (and now the PluginInfo) is not clear on what information is expected to be provided by the plugin and what isn't. I think it might be better to express the PluginInfo interface as, well, a golang interface, and only exposes methods to plugin code to set(get?) what is required of it.

@vuil I have filled #3697 to track the issue and work.

Copy link
Contributor

@marckhouzam marckhouzam left a comment

Choose a reason for hiding this comment

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

Thanks for you patience with my comments.
LGTM!

Copy link
Contributor

@vuil vuil left a comment

Choose a reason for hiding this comment

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

lgtm, thanks for the changes.

Question:
What test(s) are we relying on to verify that the plugin's updated info behavior works with the CLI that manages said plugin?

@vuil vuil added area/core-cli ok-to-merge PRs should be labelled with this before merging and removed ok-to-merge PRs should be labelled with this before merging labels Oct 27, 2022
@anujc25
Copy link
Contributor Author

anujc25 commented Oct 27, 2022

Question: What test(s) are we relying on to verify that the plugin's updated info behavior works with the CLI that manages said plugin?

I have updated the unit tests around that area to validate this as part of that PR. Let me know if you are asking this question with some other thing in mind to understand more.

@vuil
Copy link
Contributor

vuil commented Oct 31, 2022

I see we have manually and unit-tested that x plugin info is returning what it is supposed to, but what about the code that is supposed to consume this new information returned? I assume in a future change, the new field will actually get used, and we will have integration tests for the new behavior then. But in the meantime, at minimum we need to make sure that the current core CLI is able to handle the existence of the new field. We may not need to write new tests, as long there is some test in the CI that can point to that being true (I don't think the Main workflow itself is sufficient)

@vuil vuil added the ok-to-merge PRs should be labelled with this before merging label Oct 31, 2022
@anujc25 anujc25 merged commit ada44ab into vmware-tanzu:main Oct 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/core-cli cla-not-required ok-to-merge PRs should be labelled with this before merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Include the plugin library version with plugin descriptor to determine library version of the plugin
5 participants