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

Use shared values of latest version of plugins #769

Merged
merged 1 commit into from
May 13, 2024

Conversation

marckhouzam
Copy link
Contributor

What this PR does / why we need it

If we want to modify the description of a plugin, we can publish a new version with the new description. The problem is that the plugin search command shows the description of the oldest plugin version.

This commit makes sure the shared values of a plugin are taken from the most recent version.

This allows to change the description, the vendor and/or the publisher by publishing a new version of the plugin.

Which issue(s) this PR fixes

Fixes # N/A

Describe testing done for PR

Add unit tests.

We had the problem with the appsv2 plugin where we tried to change its description but plugin search still showed the old description. What we did was to deactivate the old appsv2 version v0.2.0 to only have the new description. I wanted to confirm this PR fixed the issue so I did:

  1. locally reactivate appsv2:v0.2.0 in my own DB cache
  2. run a plugin search with CLI v1.3.0 to see the old description
  3. run a plugin search with this PR to see the new description
# Broken CLI
$ /opt/homebrew/bin/tanzu version
version: v1.3.0
buildDate: 2024-05-09
sha: d59f47c8
arch: arm64

# Fixed CLI
$ tz version
version: v1.3.0-dev
buildDate: 2024-05-13
sha: c95c9ca4a
arch: arm64

# Check that only v0.2.1 is visible to start and check the description
$ /opt/homebrew/bin/tanzu plugin search --name appsv2 -t global --show-details
name: appsv2
description: Applications on Tanzu Platform
target: global
latest: v0.2.1
versions:
    - v0.2.1

# Re-activate appsv2:v0.2.0 locally
$ echo "UPDATE PluginBinaries SET hidden='false' where PluginName ='appsv2' and Version='v0.2.0'" |sqlite3 ~/.cache/tanzu/plugin_inventory/default/plugin_inventory.db

# Check that the description is now the old one with the broken CLI
$ /opt/homebrew/bin/tanzu plugin search --name appsv2 -t global --show-details
name: appsv2
description: Applications on Kubernetes for TAP (SaaS distribution)
target: global
latest: v0.2.1
versions:
    - v0.2.0
    - v0.2.1

$ /opt/homebrew/bin/tanzu plugin search --name appsv2 -t global
  NAME    DESCRIPTION                                             TARGET  LATEST
  appsv2  Applications on Kubernetes for TAP (SaaS distribution)  global  v0.2.1

# Check with the PR
$ tz plugin search --name appsv2 -t global
  NAME    DESCRIPTION                     TARGET  LATEST
  appsv2  Applications on Tanzu Platform  global  v0.2.1
$ tz plugin search --name appsv2 -t global --show-details
name: appsv2
description: Applications on Tanzu Platform
target: global
latest: v0.2.1
versions:
    - v0.2.0
    - v0.2.1

Release note

Show the description of the latest (instead of oldest) version of a plugin in the `tanzu plugin search` output.

Additional information

Special notes for your reviewer

If we want to modify the description of a plugin, we can publish a new
version with the new description.  The problem is that the
"plugin search" command shows the description of the *oldest* plugin
version.

This commit makes sure the shared values of a plugin are taken from the
most recent version.

Signed-off-by: Marc Khouzam <[email protected]>
@marckhouzam marckhouzam requested a review from a team as a code owner May 13, 2024 14:46
@marckhouzam marckhouzam changed the title Keep shared values of latest version of plugins Use shared values of latest version of plugins May 13, 2024
@marckhouzam marckhouzam added this to the v1.4.0 milestone May 13, 2024
Copy link
Contributor

@anujc25 anujc25 left a comment

Choose a reason for hiding this comment

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

Nice 👏
Thanks for the quick fix. LGTM.

@marckhouzam marckhouzam merged commit 078dcde into vmware-tanzu:main May 13, 2024
8 checks passed
@marckhouzam marckhouzam deleted the fix/pluginSearch branch May 13, 2024 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants