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 support for individual plugin download with tanzu plugin download-bundle command #725

Merged
merged 4 commits into from
Apr 10, 2024

Conversation

anujc25
Copy link
Contributor

@anujc25 anujc25 commented Apr 5, 2024

What this PR does / why we need it

  • Add support for individual plugin download with tanzu plugin download-bundle command and Add E2E tests

  • This PR adds a new flag --plugin as part of tanzu plugin download-bundle command which takes pluginID as value.

  • Based on the specified pluginID, matching plugins will be downloaded as a bundle that can be transferred and uploaded to the airgapped repository. Please see documentation update on how to use --plugin flag.

Which issue(s) this PR fixes

Fixes #

Describe testing done for PR

~ $ tanzu plugin download-bundle --help
Download a plugin bundle to the local file system to be used when migrating plugins
to an internet-restricted environment. Please also see the "upload-bundle" command.

Usage:
  tanzu plugin download-bundle [flags]

Examples:

    # Download a plugin bundle for a specific group version from the default discovery source
    tanzu plugin download-bundle --group vmware-tkg/default:v1.0.0 --to-tar /tmp/plugin_bundle_vmware_tkg_default_v1.0.0.tar.gz

    # To download plugin bundle with a specific plugin from the default discovery source
    #     --plugin name                 : Downloads the latest available version of the plugin. (Returns an error if the specified plugin name is available across multiple targets)
    #     --plugin name:version         : Downloads the specified version of the plugin. (Returns an error if the specified plugin name is available across multiple targets)
    #     --plugin name@target:version  : Downloads the specified version of the plugin for the specified target.
    #     --plugin name@target          : Downloads the latest available version of the plugin for the specified target.
    tanzu plugin download-bundle --plugin cluster:v1.0.0 --to-tar /tmp/plugin_bundle_cluster.tar.gz

    # Download a plugin bundle with the entire plugin repository from a custom discovery source
    tanzu plugin download-bundle --image custom.registry.vmware.com/tkg/tanzu-plugins/plugin-inventory:latest --to-tar /tmp/plugin_bundle_complete.tar.gz

Flags:
      --group strings    only download the plugins specified in the plugin-group version (can specify multiple)
  -h, --help             help for download-bundle
      --image string     URI of the plugin discovery image providing the plugins (default "projects.registry.vmware.com/tanzu_cli/plugins/plugin-inventory:latest")
      --plugin strings   only download plugins matching specified pluginID. Format: name/name:version/name@target:version (can specify multiple)
      --to-tar string    local tar file path to store the plugin images
  • Added E2E tests

Release note

Add support for individual plugin download with `tanzu plugin download-bundle` command

Additional information

Special notes for your reviewer

@anujc25 anujc25 requested a review from a team as a code owner April 5, 2024 04:53
@anujc25 anujc25 force-pushed the individual-plugin-download branch from 8ae4e6f to b9a1fb4 Compare April 5, 2024 06:17
@anujc25 anujc25 force-pushed the individual-plugin-download branch from b9a1fb4 to cc1c913 Compare April 5, 2024 06:25
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.

Nice work! This is something we really need!
Some minor comments to discuss.

docs/quickstart/install.md Outdated Show resolved Hide resolved
docs/quickstart/install.md Outdated Show resolved Hide resolved
docs/quickstart/install.md Outdated Show resolved Hide resolved
docs/quickstart/install.md Outdated Show resolved Hide resolved
pkg/command/plugin_bundle.go Outdated Show resolved Hide resolved
pkg/airgapped/plugin_bundle_download.go Outdated Show resolved Hide resolved
pkg/airgapped/plugin_bundle_download.go Show resolved Hide resolved
@marckhouzam marckhouzam added this to the v1.3.0 milestone Apr 8, 2024
@marckhouzam
Copy link
Contributor

I just noticed that when the download-bundle command is run, it does not output any information about plugins that are included with the --plugin flag. Notice that we have output for the plugin groups though:

$ tz plugin download-bundle  --image localhost:9876/tanzu-cli/plugins/central:small --plugin cluster --group vmware-tkg/default --to-tar a.tar
[!] Skipping the plugins discovery image signature verification for "localhost:9876/tanzu-cli/plugins/central:small"

[i] Getting selected plugin information...
[i] will be downloading the 7 plugins from group: vmware-tkg/default:v9.9.9
[i] will be downloading the one plugin from group: vmware-tanzucli/essentials:v9.9.9
[i] downloading image "localhost:9876/tanzu-cli/plugins/central:small"
[i] copy | exporting 2 images...
[...]

- Docs update.
- Only download latest version when version is not specified
- Throw an error when no plugins found/incorrect pluginID specified
- Add log message to include the plugins
- Shell completion for `--plugin` flag
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.

Using the short form of the target does not seems to work:

$ tz plugin download-bundle --image localhost:9876/tanzu-cli/plugins/central:small --dry-run --plugin cluster@k8s
[!] Skipping the plugins discovery image signature verification for "localhost:9876/tanzu-cli/plugins/central:small"

[i] Getting selected plugin information...
[i] will be downloading the one plugin from group: vmware-tanzucli/essentials:v9.9.9
[x] : error while getting selected plugin and plugin group information: no plugins found for pluginID "cluster@k8s"

docs/quickstart/install.md Outdated Show resolved Hide resolved
docs/quickstart/install.md Outdated Show resolved Hide resolved
pkg/airgapped/plugin_bundle_download.go Outdated Show resolved Hide resolved
pkg/command/plugin_bundle.go Outdated Show resolved Hide resolved
pkg/command/plugin_bundle.go Outdated Show resolved Hide resolved
docs/quickstart/install.md Outdated Show resolved Hide resolved
docs/quickstart/install.md Outdated Show resolved Hide resolved
docs/quickstart/install.md Outdated Show resolved Hide resolved
docs/quickstart/install.md Outdated Show resolved Hide resolved
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.

Thank you for spending the time to do the shell completion.
It can be pretty complicated but I believe it makes the use of the new flag much easier for users!

I'll be honest that I'm not loving the fact that we always complete the target automatically. I would have liked that we only complete the target if needed, but with fuzzy matching it may not be easy. I'm just mentioning it but I feel it is ok to leave it as you have it for now.

pkg/command/plugin_bundle.go Outdated Show resolved Hide resolved
pkg/command/plugin_bundle.go Outdated Show resolved Hide resolved
pkg/command/plugin_bundle.go Outdated Show resolved Hide resolved
pkg/command/plugin_bundle.go Outdated Show resolved Hide resolved
pkg/command/plugin_bundle.go Outdated Show resolved Hide resolved
pkg/command/plugin_bundle.go Outdated Show resolved Hide resolved
pkg/command/plugin_bundle.go Outdated Show resolved Hide resolved
pkg/command/plugin_bundle.go Outdated Show resolved Hide resolved
pkg/command/plugin_bundle.go Outdated Show resolved Hide resolved
@anujc25 anujc25 force-pushed the individual-plugin-download branch from 301711f to ee17825 Compare April 9, 2024 19:47
@anujc25 anujc25 force-pushed the individual-plugin-download branch from a8eeec3 to a784120 Compare April 9, 2024 22:41
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.

I love it!

@marckhouzam marckhouzam added the kind/feature Categorizes issue or PR as related to a new feature label Apr 10, 2024
@anujc25 anujc25 added the docs-impact issues with documentation impact label Apr 10, 2024
@anujc25 anujc25 merged commit a37c23a into vmware-tanzu:main Apr 10, 2024
7 checks passed
vuil pushed a commit to vuil/tanzu-cli that referenced this pull request Apr 19, 2024
…d-bundle` command (vmware-tanzu#725)

* Add support for individual plugin download with `tanzu plugin download-bundle` command
vuil pushed a commit that referenced this pull request Apr 19, 2024
…d-bundle` command (#725)

* Add support for individual plugin download with `tanzu plugin download-bundle` command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-not-required docs-impact issues with documentation impact kind/feature Categorizes issue or PR as related to a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants