Tags: sighupio/furyctl
Tags
feat: v0.33.0 (#630) * docs: update docs for v0.33.0 * feat: update compatibility.go * feat: add upgrade paths for 1.33.0 * feat: add flags configuration support in furyctl.yaml (#619) * feat: add flags configuration support in furyctl.yaml Implements comprehensive flags configuration feature allowing users to store command flags directly in their furyctl.yaml configuration files. Key Features: - Priority system: furyctl.yaml < env vars < CLI flags - Dynamic value support using {env://} and {file://} syntax - Schema validation preprocessing to maintain fury-distribution compatibility - Support for all commands (global, apply, delete, create, get, diff, tools) - Comprehensive validation with conflict detection - Full backward compatibility with existing configurations Architecture: - Created internal/flags package with loader, merger, validator components - Enhanced config validation with preprocessing approach - Integrated flags loading into command PreRun phases - Added comprehensive test coverage including integration tests Benefits: - Enables team standardization of flag usage - Supports consistent behavior across environments - Reduces need to remember and repeatedly type common flags - Maintains clean separation between cluster config and tool behavior The feature is completely optional and non-intrusive - existing configurations continue to work without any changes. * fix: missing license * fix: resolve format-go and linter conflicts Remove -extra flag from gofumpt to prevent conflicts with linting rules. The -extra flag was too aggressive and removed blank lines required by wsl and nlreturn linters. This ensures a stable development workflow where format-go and lint commands work harmoniously together. Signed-off-by: Samuele Chiocca <[email protected]> * fix: standardize flag naming and add missing validation - Standardize all flags to use camelCase in furyctl.yaml - Add missing FlagTypeDuration case in validator - Separate const declarations to fix grouper linting - Add comprehensive static error definitions - Ensure consistent flag type validation across all commands This resolves the core issue where flags had inconsistent naming conventions mixing camelCase and kebab-case. Signed-off-by: Samuele Chiocca <[email protected]> * refactor: improve linting compliance in flags merger - Add command name constants to eliminate goconst violations - Replace dynamic errors with static wrapped errors for err113 compliance - Fix unused receiver and improve error handling - Add proper blank lines for wsl compliance - Handle unhandled errors in string builder operations These changes ensure the merger follows Go best practices while maintaining backward compatibility and functionality. Signed-off-by: Samuele Chiocca <[email protected]> * docs: fix flag naming inconsistencies in documentation Update all flag examples to use consistent camelCase format in furyctl.yaml files. Add explanatory note about automatic conversion from camelCase to kebab-case for CLI compatibility. This ensures users understand the correct format to use in configuration files while maintaining CLI compatibility. Signed-off-by: Samuele Chiocca <[email protected]> * test: enhance environment variable integration and validation - Add comprehensive environment variable integration tests - Update test cases to use consistent camelCase flag names - Improve test coverage for flag conversion and validation - Add edge case testing for dynamic value resolution These tests ensure the flags feature works correctly with environment variables and validates proper camelCase to kebab-case conversion in all scenarios. Signed-off-by: Samuele Chiocca <[email protected]> * fix: resolve all golangci-lint violations systematically This commit achieves zero linting violations by systematically addressing multiple linter issues across the flags feature and related components. **Linting Issues Fixed:** - WSL: Added proper newlines in switch cases and control structures - godot: Added periods to comment endings for consistency - usetesting: Replaced deprecated os.MkdirTemp with t.TempDir() - paralleltest: Added nolint directives for global viper state - nlreturn: Added blank lines before return statements - err113: Defined static error variables for consistent error handling - revive: Added nolint for intentionally explicit API names - grouper: Combined const declarations into single blocks - testpackage: Changed tests to use _test package suffix - exptostd: Updated golang.org/x/exp/slices to stdlib slices - forcetypeassert: Replaced unsafe type assertions with safe checks - gci: Fixed import grouping (stdlib, external, internal) - gofmt: Applied proper Go formatting **Key Changes:** - internal/flags/*: Comprehensive linting fixes while preserving functionality - internal/config/validate.go: Added static error definitions - pkg/template/mapper/mapper.go: Safe type assertion with ok pattern - test files: Modernized with t.TempDir() and proper package naming - cmd/*: Minor comment punctuation fixes **Testing:** - All unit tests pass ✓ - Flags compatibility tests pass ✓ - Build successful ✓ - Race detection clean ✓ - Zero linting violations achieved ✓ The flags feature functionality remains fully intact while achieving complete linting compliance across 101 active linters. * fix: preserve array types in dynamic value parsing Arrays in dynamic values were being converted to strings, causing data corruption. For example, force: ["upgrades"] became "upgrades" instead of preserving the array type. - Modified ParseDynamicValue to return `any` instead of `string` - Added proper type handling for []any and []string cases - Maintains backward compatibility while fixing type preservation Signed-off-by: Samuele Chiocca <[email protected]> * fix: add critical error handling for flags file operations File-not-found errors in flags dynamic values were being logged as warnings instead of failing the operation, creating security risks. - Added isCriticalError() function to detect file operation failures - Modified LoadAndMergeFlags to propagate critical errors instead of logging - Ensures file reference failures in flags cause immediate failure Signed-off-by: Samuele Chiocca <[email protected]> * feat: expand dynamic values before schema validation Schema validation was failing on dynamic value patterns like {file://./secrets/keepalived-passphrase.txt} because validation happened before expansion. - Added expandDynamicValues() function to pre-process configurations - Recursively expands {env://}, {file://}, {path://}, {http://}, {https://} - Ensures schema sees actual values instead of reference patterns - Fixes OnPremises keepalived passphrase validation issue Signed-off-by: Samuele Chiocca <[email protected]> * fix: remove t.Parallel() from flags tests to prevent viper state contamination Integration tests were failing because t.Parallel() caused race conditions with global viper state modifications. - Removed t.Parallel() from integration tests that modify viper - Added nolint:paralleltest comments with justification - Ensures test reliability for flags functionality validation Signed-off-by: Samuele Chiocca <[email protected]> * refactor: fix WSL and formatting linting violations Fixed assignment cuddling issues by properly separating variable assignments from unrelated statements. Updated ParseDynamicValue usage to handle the new any return type with proper type conversion to string where needed. Signed-off-by: Samuele Chiocca <[email protected]> * docs: add infos on how to implement configuration flags from furyctl.yaml in a new command * fix: e2e tests failing due to changing how the dynamic values expansions happens after fixing the behaviour * feat: make strict fatal errors when validation of the flags fails. Warn only errors if the flags are unknown * fix: update integration test with the new fatal fail logic on flags validation errors * docs: refactor documentation mentioning mise instead of make, add streamlined DEVELOPMENT.md file, and splitted the old development.md to FAQ.md * feat: replace makefile with mise * fix: unset GOBIN in the install step * fix: remove GOARCH from mise.toml, add debug messages * fix: remove debug messages in install step * fix: move complext shell commands from commands in the e2e step to a dedicated script * fix: wrong version for golanci-lint was used, causing memory leaks * feat: add test-flags e2e step in CI * feat: add flag test e2e * fix: address review issues: addressing ordering behaviour from flags when coming from config file. Addressing problems in expanding ENV var. Make error on flags to be fatal instead of warning. Add the support on flag validation via schema, with fallback if the schema does not have flags. * fix: missing license header on go and yaml files * fix: linting issues * feat: make all commands to read flags from config furyctl.yaml file. Remove the possibility to use config inside flags.command , otherwise recursive loading will happen. Update tests * docs: update doc reference with updated flag behaviours * feat: implement PR comments, refactored some code * fix: fix loading flags order for get kubeconfig subcommand * fix: fix unit tests --------- Signed-off-by: Samuele Chiocca <[email protected]> Co-authored-by: Filo01 <[email protected]> Co-authored-by: Filippo <[email protected]> * chore: bump fury-distribution to v1.33.0-rc.0 * fix: bump eks installer to version 3.3.0 in v1.32 * chore: bump fury-distribution to final v1.33.0 --------- Signed-off-by: Samuele Chiocca <[email protected]> Co-authored-by: Filo01 <[email protected]> Co-authored-by: Stefano Ghinelli <[email protected]> Co-authored-by: Samuele Chiocca <[email protected]> Co-authored-by: Filippo <[email protected]>
PreviousNext