README
¶
Tanzu Plugin Runtime
Overview
The Tanzu CLI is based on a plugin architecture. This architecture enables teams to build, own, and release their own piece of functionality as well as enable external partners to integrate with the system.
The Tanzu Plugin Runtime is a library that provides functionality and helper methods to develop Tanzu CLI plugins.
Developers begin plugin development by using the builder
plugin to bootstrap
a new plugin project. The code generated in the project relies on the runtime
to provide some functionality common to all plugins. For more information about
the development process, see the Tanzu CLI Plugin Development guide
The library
This Tanzu Plugin Runtime broadly consists of:
- CLI UX Component library
- Configuration library
- Plugin integration
- Command helpers
- Test helpers
CLI UX Component Library
This package implements reusable CLI user interface components, including:
- output writers (table, listtable, json, yaml, spinner)
- prompt
- selector
- question
For more details go to Component Library
Configuration Library
This package implements helper functions to read, write and update various Tanzu CLI configuration objects like Contexts, DiscoverySources, CLI Features and environment settings.
For more details about the design and APIs go to Configuration Library
Plugin integration
This package implements helper functions for new plugin creation. This is one of the main packages that each and every plugin will need to import to integrate with the Tanzu CLI. For more information about the development process, see the Tanzu CLI Plugin Development guide
To Manage plugin owned settings
Use
// Plugin owned APIs
// GetTanzuPluginConfigDir Retrieve the tanzu configuration directory that can be used by the plugins to
// create a plugin specific directory to manage plugin owned configurations.
func GetTanzuPluginConfigDir() (string, error)
Example: For handling settings specific to the management-cluster
plugin:
Utilize GetTanzuPluginConfigDir()
to retrieve the plugin configuration directory,
which is .config/tanzu/plugins
. Subsequently, establish a management-cluster
directory within the plugin configuration directory to oversee the relevant settings.
Command Helpers
This package implements command specific helper functions like command deprecation, etc.
Test Helpers
This package implements helper functions to develop test plugins and Cross-version Configuration Library APIs compatibility testing
Besides unit and integration tests, the runtime APIs are also being tested in the presence of other versions runtime client code as part of cross-version API compatibility testing. These tests are important in ensuring interoperability among runtime clients (and hence different generations of CLI plugins)
Cross Version API Compatibility Testing
Cross Version API Compatibility testing ensures that Configuration Library APIs of different Tanzu Plugin Runtime versions work as expected as long as those Tanzu Plugin Runtime versions are supported.
Cross Version API Compatibility testing simulates the interaction of Configuration library APIs provided by different versions of plugin runtimes to ensure that they can interoperate with one another.
For more details go to Cross-version API Compatibility
Contributing
Thanks for taking the time to join our community and start contributing! We welcome pull requests. Feel free to dig through the issues and jump in.
Before you begin
- Check out the contribution guidelines to learn more about how to contribute.
- Check out the document here about the project's support process.
Directories
¶
Path | Synopsis |
---|---|
client
|
|
hub
Package hub provides functions to create Tanzu Hub client for specific context
|
Package hub provides functions to create Tanzu Hub client for specific context |
hub/testing
Package testing exports a GraphQL Mock Server that facilitates the testing of client.
|
Package testing exports a GraphQL Mock Server that facilitates the testing of client. |
Package command provides functions to manipulate tanzu cli commands
|
Package command provides functions to manipulate tanzu cli commands |
Package component defines components that can be made use of in plugins.
|
Package component defines components that can be made use of in plugins. |
Package config Provide API methods to Read/Write specific stanza of config file
|
Package config Provide API methods to Read/Write specific stanza of config file |
collectionutils
Package collectionutils provide helper functions to operate on collections like array, map
|
Package collectionutils provide helper functions to operate on collections like array, map |
nodeutils
Package nodeutils provides utility methods to perform operations on yaml node
|
Package nodeutils provides utility methods to perform operations on yaml node |
types
Package types specifies the types for clientconfig
|
Package types specifies the types for clientconfig |
Package docs contains docs
|
Package docs contains docs |
hack
|
|
hub/pkg
Package hub used to generate graphQL client code for the graphQL APIs
|
Package hub used to generate graphQL client code for the graphQL APIs |
internal
|
|
Package log provides logging functionalities
|
Package log provides logging functionalities |
Package plugin provides functions to create new CLI plugins.
|
Package plugin provides functions to create new CLI plugins. |
buildinfo
Package buildinfo holds global variables set at build time to provide information about the plugin build.
|
Package buildinfo holds global variables set at build time to provide information about the plugin build. |
lint
Package lint provides linters to run against CLI plugins.
|
Package lint provides linters to run against CLI plugins. |
test
|
|
exec
Package exec implements command execution functionality.
|
Package exec implements command execution functionality. |
framework
Package framework provides a tanzu cli test framework
|
Package framework provides a tanzu cli test framework |
compatibility/core
Module
|
|
compatibility/framework
Module
|
|
plugins/helloworld
Module
|