Managing Tools with Kubiya CLI¶
This guide explains how to manage tools with the Kubiya CLI. After your tools have been built using the Kubiya SDK, you can use the CLI to discover, inspect, and test them.
Prerequisites¶
Before you begin, make sure you have:
- Installed the Kubiya CLI
- Set up authentication with your Kubiya environment
- Added at least one source containing tools (see Managing Sources)
Listing Tools¶
To view all tools available across all sources:
To list tools from a specific source:
For more detailed information:
To output in JSON format (useful for scripting):
Searching for Tools¶
To search for tools by keyword:
To search within a specific source:
Inspecting Tool Details¶
To get detailed information about a specific tool:
To specify the source containing the tool (if multiple sources have tools with the same ID):
To output in JSON format:
Testing Tools¶
One of the key benefits of the Kubiya CLI is the ability to test tools locally before using them in production:
For interactive testing with prompts for each parameter:
To test a tool from a specific source:
Working with Environment Variables¶
Many tools require environment variables. To set them for a test session:
You can also provide environment variables during scanning:
Runtime Tool Configuration¶
The CLI allows you to configure tools at runtime, producing variations of the same tool logic for different environments:
Creating Configuration Files¶
Create a configuration file in JSON format:
{
"tools": {
"deploy-app": {
"environment": "development",
"registry": "dev-registry.example.com",
"timeout": 300
},
"backup-database": {
"retention_days": 7,
"storage_path": "/tmp/backups"
}
}
}
Applying Configuration¶
Apply configuration when adding a source:
Or update an existing source with new configuration:
Environment-Specific Configurations¶
You can maintain different configuration files for different environments:
# Development environment
kubiya source add . --config dev-config.json --name "Dev Tools"
# Production environment
kubiya source add . --config prod-config.json --name "Prod Tools"
Tool Versioning¶
The CLI provides ways to work with different versions of tools:
# Add a source with a specific branch/version
kubiya source add https://github.com/org/repo --branch v1.2.3
# Sync a source to a specific version
kubiya source sync SOURCE_ID --branch main
Docker Container Management¶
While the CLI abstracts away much of the Docker complexity, you can interact with the underlying containers:
# View running tool containers
kubiya container list
# Get logs from a tool container
kubiya container logs CONTAINER_ID
# Restart a tool container
kubiya container restart CONTAINER_ID
Advanced Tool Commands¶
Exporting Tool Definitions¶
Export tool definitions to a file:
Importing Tool Definitions¶
Import previously exported tool definitions:
Generating Tool Documentation¶
Generate documentation for a tool:
Best Practices¶
-
Test tools locally first: Always test tools with the CLI before deploying them to production.
-
Use version control: Keep tool configurations in version control along with the tools themselves.
-
Environment-specific configs: Maintain separate configuration files for different environments.
-
Consistent naming: Use consistent naming conventions for tools across environments.
-
Regular updates: Regularly sync your sources to ensure you have the latest tool versions.
Troubleshooting¶
Tool Not Found¶
If you encounter a "Tool not found" error:
- Verify the tool ID is correct
- Check if the tool exists with
kubiya tool list - Ensure your source is properly synced
Tool Execution Failures¶
If a tool fails during execution:
- Check the parameters you provided
- Verify that required environment variables are set
- Look for errors in the tool's output
- Use
kubiya container logsto view detailed logs
Configuration Issues¶
If tool configuration isn't being applied correctly:
- Verify your JSON configuration format
- Check that the tool ID in the configuration matches the actual tool ID
- Ensure the configuration file is being properly loaded
Next Steps¶
Now that you know how to manage tools, learn how to: