provisioning/core/nulib/main_provisioning/versions.nu

70 lines
2.1 KiB
Plaintext
Raw Normal View History

# Version Management Commands
# Manages versions with progressive cache hierarchy
use ../lib_provisioning/cache/cache_manager.nu *
use ../lib_provisioning/cache/grace_checker.nu *
use ../lib_provisioning/cache/version_loader.nu *
use ../lib_provisioning/cache/batch_updater.nu *
# Get version for a specific component
export def "version get" [
component: string # Component name (e.g., kubernetes, containerd)
]: nothing -> string {
get-cached-version $component
}
# Show cache status and statistics
export def "version status" []: nothing -> nothing {
show-cache-status
}
# Initialize the cache system
export def "version init" []: nothing -> nothing {
print "πŸš€ Initializing version cache system..."
init-cache-system
print "βœ… Cache system initialized"
}
# Clear all cached versions
export def "version clear" []: nothing -> nothing {
print "🧹 Clearing version cache..."
clear-cache-system
print "βœ… Cache cleared"
}
# Update all cached versions in batches
export def "version update-all" []: nothing -> nothing {
print "πŸ”„ Updating all cached versions..."
batch-update-all
print "βœ… Cache updated"
}
# Invalidate a specific component's cache entry
export def "version invalidate" [
component: string # Component to invalidate
]: nothing -> nothing {
invalidate-cache-entry $component "infra"
invalidate-cache-entry $component "provisioning"
print $"βœ… Invalidated cache for ($component)"
}
# List all available components
export def "version list" []: nothing -> list<string> {
get-all-components
}
# Sync cache from source (force refresh)
export def "version sync" [
component?: string # Optional specific component
]: nothing -> nothing {
if ($component | is-not-empty) {
invalidate-cache-entry $component "infra"
invalidate-cache-entry $component "provisioning"
let version = (get-cached-version $component)
print $"πŸ”„ Synced ($component): ($version)"
} else {
version clear
version update-all
print "πŸ”„ Synced all versions"
}
}