Support installing plugins with local filesystem
Issue: https://github.com/vmware-tanzu/tanzu-framework/issues/1264
Meeting: 02 Dec 2021
Attendees: Navid, Anuj, Rajas
Agenda:
* Plugin artifacts split: core, admin and non admin plugins
* Installation source selection UX
* Flag UX
**Details:**
**Release Artifacts:**
**Darwin-amd64 bundle:**
1. tanzu-cli-darwin-amd64 (only the tanzu cli binary)
1. tanzu-cli-default-standalone-plugins-darwin-amd64.tar.gz (Check below for the sample content of the tarball)
1. tanzu-cli-admin-plugins-darwin-amd64.tar.gz
**Linux-amd64 bundle:**
1. tanzu-cli-linux-amd64 (only the tanzu cli binary)
1. tanzu-cli-default-standalone-plugins-linux-amd64.tar.gz
1. tanzu-cli-admin-plugins-linux-amd64.tar.gz
**Windows-amd64 bundle:**
1. tanzu-cli-windows-amd64.exe (only the tanzu cli binary)
1. tanzu-cli-default-standalone-plugins-linux-amd64.tar.gz
1. tanzu-cli-admin-plugins-linux-amd64.tar.gz
**Generating directory structure and content for darwin-amd64:**
NOTE: We already have a few make targets (`make publish-plugins-local`, `make publish-admin-plugins-local` etc ) to generate this directory structure based on the artifact directory. But we need to make them generic to support our usecases.
As part of PR https://github.com/vmware-tanzu/tanzu-framework/pull/1278,
I am adding the make target `publish-plugins-local-%` which can be used to generate below directory structure. Below are the steps:
1. Generate or download legacy tanzu-cli and plugins tarball [tanzu-framework-darwin-amd64.tar.gz](https://github.com/vmware-tanzu/tanzu-framework/releases/download/v0.12.0/tanzu-framework-darwin-amd64.tar.gz) and extract it to a location. `tar -xvf tanzu-framework-darwin-amd64.tar.gz -C /tmp/darwin-artifacts`
1. Use builder plugin or make target to generate the directory structure for publishing specific plugins.
* For example to generate below directory structure which includes `login`, `management-cluster`, `package`, `pinniped-auth`, `secret` plugins, configure below env variables
* ARTIFACTS_DIR="/tmp/darwin-artifacts"
* PLUGINS="login management-cluster package pinniped-auth secret"
* TANZU_PLUGIN_PUBLISH_PATH="/tmp/default-standalone-plugins/darwin-amd64"
* To generate plugins with discovery name `standalone` and `darwin-amd64` as OS-ARCH run the below make target
* `make publish-plugins-local-darwin-amd64-standalone`
* Same way to publish admin plugins
* `make publish-plugins-local-darwin-amd64-admin ARTIFACTS_DIR=path/to/admin/artifacts-dir PLUGINS="builder codegen test" TANZU_PLUGIN_PUBLISH_PATH=/tmp/admin-plugins/darwin-amd64`
1. Generate `tar.gz` files
* Standalone plugins:
* `tar -czvf standalone-plugins-darwin-amd64.tar.gz -C /tmp/default-standalone-plugins/darwin-amd64 .`
* Admin plugins:
* `tar -czvf admin-plugins-darwin-amd64.tar.gz -C /tmp/admin-plugins/darwin-amd64 .`
```
$ tree /tmp/tanzu-plugins/
/tmp/tanzu-plugins/
├── discovery
│ └── standalone
│ ├── login.yaml
│ ├── management-cluster.yaml
│ ├── package.yaml
│ ├── pinniped-auth.yaml
│ └── secret.yaml
└── distribution
└── darwin
└── amd64
└── cli
├── login
│ └── v0.13.0-dev
│ └── tanzu-login-darwin_amd64
├── management-cluster
│ └── v0.13.0-dev
│ └── tanzu-management-cluster-darwin_amd64
├── package
│ └── v0.13.0-dev
│ └── tanzu-package-darwin_amd64
├── pinniped-auth
│ └── v0.13.0-dev
│ └── tanzu-pinniped-auth-darwin_amd64
└── secret
└── v0.13.0-dev
└── tanzu-secret-darwin_amd64
```