Tags: MetroStar/quartzctl
Tags
DILT-19: Quartz CLI Maintenance - Cleanup Improvements & Retry Logic (#… …62) * fix: update application lookup configuration in NewInfrastructureEnvironmentConfig * feat: implement AWS resource cleanup functionality and enhance destroy command * fix: update region configuration to use Aws.Region in ForceAWSCleanup * feat: add EC2 instance termination functionality to ForceAWSCleanup * refactor: remove force cleanup flag and streamline AWS resource cleanup process * feat: implement fallback AWS resource cleanup in TfDestroyWithRetry for orphaned resources * feat: add proactive check for blocking AWS resources before Terraform destroy * feat: implement Kubernetes resource cleanup before EC2 termination in ForceAWSCleanup * feat: enhance logging and retry mechanisms for health checks and AWS service roles * feat: add DaemonSet readiness checks and cleanup for stuck terminating pods * feat: add VirtualService listing and print functionality to Kubernetes client * feat: enhance Kubernetes cleanup process to remove all validating and mutating webhooks, and patch stuck namespaces * test: add unit tests for cleanup retry logic Add table-driven tests for isRetryableDestroyError() and isHelmReleaseError() functions that handle terraform destroy retry logic. Tests cover: - All 10 retryable error patterns (DependencyViolation, NetworkInterfaceInUse, etc.) - All 4 Helm-specific error patterns - Negative cases for non-retryable errors * fix: upgrade Go 1.24.11 and mapstructure v2.4.0 to fix vulnerabilities Fixes 15 vulnerabilities identified by govulncheck: - GO-2025-4175: crypto/x509 wildcard DNS name constraint bypass - GO-2025-4155: crypto/x509 excessive resource consumption - GO-2025-4013: crypto/x509 panic with DSA public keys - GO-2025-4012: net/http cookie parsing memory exhaustion - GO-2025-4011: encoding/asn1 DER parsing memory exhaustion - GO-2025-4010: net/url insufficient IPv6 hostname validation - GO-2025-4009: encoding/pem quadratic complexity - GO-2025-4008: crypto/tls ALPN negotiation information leak - GO-2025-4007: crypto/x509 name constraint quadratic complexity - GO-2025-3956: os/exec unexpected LookPath paths - GO-2025-3900, GO-2025-3787: go-viper/mapstructure log leakage - GO-2025-3751: net/http sensitive header cross-origin leak - GO-2025-3750: syscall O_CREATE|O_EXCL handling (Windows) - GO-2025-3749: crypto/x509 ExtKeyUsageAny policy validation * fix: resolve golangci-lint issues in aws_cleanup.go and stages.go - Add awsNoneValue constant for AWS CLI 'None' return values (goconst) - Add #nosec G204 comments for intentional exec usage with validated config values (gosec) - Use _ to explicitly ignore error returns for best-effort cleanup operations (errcheck) - Remove unused parameter from cleanupKubernetesBlockers (unparam) - Fix gofmt alignment in StageChecksConfig struct (gofmt) * test: add unit tests for DaemonSetStageCheck and GetDaemonSetStatus - Add comprehensive tests for DaemonSetStageCheck in stages package - Add tests for GetDaemonSetStatus in provider/kubernetes - Add test for CleanupStuckTerminatingPods - Improve overall test coverage for new code * chore: add codecov.yml and additional test coverage - Add codecov.yml to configure coverage thresholds and ignore CLI integration code - Exclude aws_cleanup.go and internal.go (heavy exec.CommandContext usage) - Add test for DaemonSet not found error path - Set patch target to 50% with 5% threshold for integration-heavy code - Set project threshold to allow 2% decrease from base * test: add additional coverage for Kubernetes and stages packages - Add tests for ListVirtualServices and ListVirtualServicesNotFound - Add test for ForEachDynamicResourcesNamespaced - Add tests for appendChecks with DaemonSet and multiple check types - Add tests for preEventChecks and postEventChecks with DaemonSet ordering - Improve provider coverage from 75.7% to 76.2% - Improve stages coverage from 87.4% to 88.0% * test: add coverage for check callbacks and Kubernetes operations - Add tests for onCheckStart, onCheckComplete, onCheckRetry callbacks - Add tests for GetSecret and GetSecretNotFound - Add tests for PrintDiscoveredVirtualServices with and without CRD - Improve cmd coverage from 52.4% to 53.3% - Improve provider coverage from 76.3% to 78.2% * test: add coverage tests for Export and CleanupTerminatingPods - Add 4 tests for Export function covering success, errors, unknown kind, and empty objects - Add 2 tests for CleanupTerminatingPods covering default timeout and zero timeout - Coverage improved: internal/cmd 54.5%, internal/provider 80.9% * chore: remove internal.go from codecov exclusions internal.go now has 66-75% coverage after adding CleanupTerminatingPods tests * fix: format internal_test.go with gofmt * fix: update Go version to 1.24.11 in devbox.json * fix: update Go version to 1.24.11 in devbox.lock