Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Local License Inspection Command (#4812)
# Add `bacalhau license inspect` Command ## Summary Added a new CLI command `bacalhau license inspect` that allows users to inspect and validate Bacalhau license files. The command supports both offline validation and multiple output formats (table, JSON, YAML). ## Features - New `bacalhau license inspect` command with the following capabilities: - Validates license file authenticity using RSA public key verification - Displays license details including product name, license ID, customer ID, validity period, and capabilities - Supports offline validation using embedded JWKS public keys - Multiple output formats: table (default), JSON, and YAML - Includes metadata field in JSON/YAML output formats ## Implementation Details - Added `inspect.go` implementing the license inspection command - Integrated with existing license validation framework - Added `NewOfflineLicenseValidator` with hardcoded JWKS verification keys for offline validation - Comprehensive test coverage including: - Unit tests for various license scenarios - Integration tests for CLI functionality - Tests for different output formats - Invalid license handling ## Usage Examples ```bash # Basic inspection bacalhau license inspect license.json # JSON output bacalhau license inspect license.json --output=json # YAML output bacalhau license inspect license.json --output=yaml ``` ## Example output ``` Product = Bacalhau License ID = e66d1f3a-a8d8-4d57-8f14-00722844afe2 Customer ID = test-customer-id-123 Valid Until = 2045-07-28 Version = v1 Capabilities = max_nodes=1 Metadata = {} ``` ## Test Coverage - Unit tests covering: - Valid/invalid license validation - Various output formats - Error handling scenarios - Offline validation - Integration tests verifying CLI functionality <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes - **New Features** - Added a new `license` command to the CLI for inspecting and validating local license information. - Introduced functionality to inspect license details with support for JSON and YAML output formats. - Added new test files for various license scenarios, including valid and invalid licenses. - **Testing** - Enhanced test coverage for license validation and inspection, including offline validation scenarios. - Added integration tests for local license validation scenarios. - **Improvements** - Implemented offline license validation. - Refined error messaging for license-related operations. - **Configuration** - Updated configuration files to include new settings for orchestrator and API. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
- Loading branch information