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 the "plugin group get" command #285

Merged
merged 1 commit into from
May 15, 2023

Conversation

marckhouzam
Copy link
Contributor

@marckhouzam marckhouzam commented May 12, 2023

This PR is on top of #270 to first provide plugin group version support. Only the top-most commit is new

What this PR does / why we need it

This PR adds a command to see the list of plugins part of a plugin group version (finally!):

$ tz plugin group get vmware-tkg/default:v2.1.1
Plugins in Group:  vmware-tkg/default:v2.1.1
  NAME                TARGET      LATEST
  cluster             kubernetes  v0.28.1
  feature             kubernetes  v0.28.1
  isolated-cluster    global      v0.28.1
  kubernetes-release  kubernetes  v0.28.1
  management-cluster  kubernetes  v0.28.1
  package             kubernetes  v0.28.1
  pinniped-auth       global      v0.28.1
  secret              kubernetes  v0.28.1
  telemetry           kubernetes  v0.28.1

The user can omit the version to get the content of the latest version of a group: tz plugin group get vmware-tkg/default

Which issue(s) this PR fixes

Fixes # N/A

Describe testing done for PR

# Initialize stuff
$ rm ~/.cache/tanzu/plugin_inventory
$ rm ~/.config/tanzu/config*
$ \rm -rf hack/central-repo/registry-content
$ make start-test-central-repo
[...]
$ tz plugin source update default -u localhost:9876/tanzu-cli/plugins/central:small
[ok] updated discovery source default
$ tz config set env.TANZU_CLI_PLUGIN_DISCOVERY_IMAGE_SIGNATURE_PUBLIC_KEY_PATH $tc/hack/central-repo/cosign-key-pair/cosign.pub

# Look for the plugins we have
$ tz plugin group search --show-details
name: vmware-tkg/default
description: Desc for vmware-tkg/default
latest: v9.9.9
versions:
    - v0.0.1
    - v9.9.9

name: vmware-tmc/tmc-user
description: Desc for vmware-tmc/tmc-user
latest: v9.9.9
versions:
    - v0.0.1
    - v9.9.9

# Now try the new command
# First the help
$ tz plugin group get -h
Get the content of the specified plugin-group.  A plugin-group provides a list of plugin name/version combinations which can be installed in one step.  This command allows to see the list of plugins included in the specified group.

Usage:
tanzu plugin group get <group> [flags]

Flags:
  -h, --help            help for get
  -o, --output string   output format (yaml|json|table)

# Missing group name
$ tz plugin group get
[x] : accepts 1 arg(s), received 0

# Too many args
$ tz plugin group get two args
[x] : accepts 1 arg(s), received 2

# Now get the content of vmware-tkg/default:v0.0.1 
$ tz plugin group get vmware-tkg/default:v0.0.1
Plugins in Group:  vmware-tkg/default:v0.0.1
  NAME                TARGET      LATEST
  cluster             kubernetes  v0.0.1
  feature             kubernetes  v0.0.1
  kubernetes-release  kubernetes  v0.0.1
  management-cluster  kubernetes  v0.0.1
  package             kubernetes  v0.0.1
  secret              kubernetes  v0.0.1
  telemetry           kubernetes  v0.0.1

# Notice that in the list format, I chose to add the "plugin" prefix for "pluginname", "plugintarget" and "pluginversion"
# This is because when I first tried it without a prefix, the "version" field was confusing as it could have applied
# to the group version
$ tz plugin group get vmware-tkg/default:v0.0.1 -o yaml
- group: vmware-tkg/default:v0.0.1
  pluginname: cluster
  plugintarget: kubernetes
  pluginversion: v0.0.1
- group: vmware-tkg/default:v0.0.1
  pluginname: feature
  plugintarget: kubernetes
  pluginversion: v0.0.1
- group: vmware-tkg/default:v0.0.1
  pluginname: kubernetes-release
  plugintarget: kubernetes
  pluginversion: v0.0.1
- group: vmware-tkg/default:v0.0.1
  pluginname: management-cluster
  plugintarget: kubernetes
  pluginversion: v0.0.1
- group: vmware-tkg/default:v0.0.1
  pluginname: package
  plugintarget: kubernetes
  pluginversion: v0.0.1
- group: vmware-tkg/default:v0.0.1
  pluginname: secret
  plugintarget: kubernetes
  pluginversion: v0.0.1
- group: vmware-tkg/default:v0.0.1
  pluginname: telemetry
  plugintarget: kubernetes
  pluginversion: v0.0.1

# No need to specify the version
$ tz plugin group get vmware-tkg/default
Plugins in Group:  vmware-tkg/default:v9.9.9
  NAME                TARGET      LATEST
  cluster             kubernetes  v9.9.9
  feature             kubernetes  v9.9.9
  kubernetes-release  kubernetes  v9.9.9
  management-cluster  kubernetes  v9.9.9
  package             kubernetes  v9.9.9
  secret              kubernetes  v9.9.9
  telemetry           kubernetes  v9.9.9

$ tz plugin group get vmware-tkg/default -o yaml
- group: vmware-tkg/default:v9.9.9
  pluginname: cluster
  plugintarget: kubernetes
  pluginversion: v9.9.9
- group: vmware-tkg/default:v9.9.9
  pluginname: feature
  plugintarget: kubernetes
  pluginversion: v9.9.9
- group: vmware-tkg/default:v9.9.9
  pluginname: kubernetes-release
  plugintarget: kubernetes
  pluginversion: v9.9.9
- group: vmware-tkg/default:v9.9.9
  pluginname: management-cluster
  plugintarget: kubernetes
  pluginversion: v9.9.9
- group: vmware-tkg/default:v9.9.9
  pluginname: package
  plugintarget: kubernetes
  pluginversion: v9.9.9
- group: vmware-tkg/default:v9.9.9
  pluginname: secret
  plugintarget: kubernetes
  pluginversion: v9.9.9
- group: vmware-tkg/default:v9.9.9
  pluginname: telemetry
  plugintarget: kubernetes
  pluginversion: v9.9.9

Release note

The new "tanzu plugin group get <group>" command allows to see what plugin versions are part of the specified group.

Additional information

Special notes for your reviewer

@marckhouzam marckhouzam requested a review from a team as a code owner May 12, 2023 19:53
This command allows to see the list of plugins part of a plugin group.

Signed-off-by: Marc Khouzam <kmarc@vmware.com>
@marckhouzam marckhouzam merged commit 729721f into vmware-tanzu:main May 15, 2023
@marckhouzam marckhouzam deleted the feat/pluginGroupGet branch May 15, 2023 21:39
vuil pushed a commit to vuil/tanzu-cli that referenced this pull request May 16, 2023
This command allows to see the list of plugins part of a plugin group.

Signed-off-by: Marc Khouzam <kmarc@vmware.com>
@marckhouzam marckhouzam added this to the v0.90.0 milestone Oct 20, 2023
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