-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(configuration): add initial support for Viper command initialization #607
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a PersistentPreRun
in many of the commands that override the rootCmd version -> specifically the dev ones, I see the viper config enabled there but due to this it doesn't seem to be reading the config data. Locally I removed PersistentPreRun from each of the dev commands and updated the parent devCmd as follows:
var devCmd = &cobra.Command{
Use: "dev",
Short: "Collection of dev commands to make dev life easier",
PersistentPreRun: func(cmd *cobra.Command, args []string) {
// Call the parent's PersistentPreRun
if parentPreRun := cmd.Parent().PersistentPreRun; parentPreRun != nil {
parentPreRun(cmd.Parent(), args)
}
config.SkipLogFile = true
},
}
I think this should solve it - the tools cmds also have this prerun, not sure if we want to update those as well/what the intended config recognition is there
(edit - happy to commit that fix ^^ if you agree, but refrained if there's more discussion needed, I might be missing something as well)
Co-authored-by: Megan Wolf <97549300+meganwolf0@users.noreply.github.com>
@meganwolf0 ended up coming full circle with a slight modification of your proposed solution. Optimally I wanted to have the inheritance of the Given we don't have much complexity baked into our command pre-runs this seems adequate for solving the problem on the two |
This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | Type | Update | |---|---|---|---|---|---|---|---| | [@commitlint/cli](https://commitlint.js.org/) ([source](https://togithub.com/conventional-changelog/commitlint/tree/HEAD/@commitlint/cli)) | `19.3.0` -> `19.4.1` | [![age](https://developer.mend.io/api/mc/badges/age/npm/@commitlint%2fcli/19.4.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@commitlint%2fcli/19.4.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@commitlint%2fcli/19.3.0/19.4.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@commitlint%2fcli/19.3.0/19.4.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | minor | | [@commitlint/config-conventional](https://commitlint.js.org/) ([source](https://togithub.com/conventional-changelog/commitlint/tree/HEAD/@commitlint/config-conventional)) | `19.2.2` -> `19.4.1` | [![age](https://developer.mend.io/api/mc/badges/age/npm/@commitlint%2fconfig-conventional/19.4.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@commitlint%2fconfig-conventional/19.4.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@commitlint%2fconfig-conventional/19.2.2/19.4.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@commitlint%2fconfig-conventional/19.2.2/19.4.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | minor | | [actions/upload-artifact](https://togithub.com/actions/upload-artifact) | `v4.3.4` -> `v4.4.0` | [![age](https://developer.mend.io/api/mc/badges/age/github-tags/actions%2fupload-artifact/v4.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/github-tags/actions%2fupload-artifact/v4.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/github-tags/actions%2fupload-artifact/v4.3.4/v4.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/github-tags/actions%2fupload-artifact/v4.3.4/v4.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | action | minor | | [defenseunicorns/lula](https://togithub.com/defenseunicorns/lula) | `v0.5.1` -> `v0.6.0` | [![age](https://developer.mend.io/api/mc/badges/age/github-tags/defenseunicorns%2flula/v0.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/github-tags/defenseunicorns%2flula/v0.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/github-tags/defenseunicorns%2flula/v0.5.1/v0.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/github-tags/defenseunicorns%2flula/v0.5.1/v0.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | minor | | [opentofu/setup-opentofu](https://togithub.com/opentofu/setup-opentofu) | `v1.0.3` -> `v1.0.4` | [![age](https://developer.mend.io/api/mc/badges/age/github-tags/opentofu%2fsetup-opentofu/v1.0.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/github-tags/opentofu%2fsetup-opentofu/v1.0.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/github-tags/opentofu%2fsetup-opentofu/v1.0.3/v1.0.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/github-tags/opentofu%2fsetup-opentofu/v1.0.3/v1.0.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | action | patch | --- ### Release Notes <details> <summary>conventional-changelog/commitlint (@​commitlint/cli)</summary> ### [`v19.4.1`](https://togithub.com/conventional-changelog/commitlint/blob/HEAD/@​commitlint/cli/CHANGELOG.md#1941-2024-08-28) [Compare Source](https://togithub.com/conventional-changelog/commitlint/compare/v19.4.0...v19.4.1) **Note:** Version bump only for package [@​commitlint/cli](https://togithub.com/commitlint/cli) ### [`v19.4.0`](https://togithub.com/conventional-changelog/commitlint/blob/HEAD/@​commitlint/cli/CHANGELOG.md#1940-2024-08-07) [Compare Source](https://togithub.com/conventional-changelog/commitlint/compare/v19.3.0...v19.4.0) ##### Features - support command line options from a file ([#​4109](https://togithub.com/conventional-changelog/commitlint/issues/4109)) ([a20e890](https://togithub.com/conventional-changelog/commitlint/commit/a20e890f6b6c8bacdc511d40cb41f29415bdd044)) - support linting from the last tag ([#​4110](https://togithub.com/conventional-changelog/commitlint/issues/4110)) ([4b204ec](https://togithub.com/conventional-changelog/commitlint/commit/4b204ecfb43dd6a00e24b51111aadbd78f9d58e1)) </details> <details> <summary>conventional-changelog/commitlint (@​commitlint/config-conventional)</summary> ### [`v19.4.1`](https://togithub.com/conventional-changelog/commitlint/blob/HEAD/@​commitlint/config-conventional/CHANGELOG.md#1941-2024-08-28) [Compare Source](https://togithub.com/conventional-changelog/commitlint/compare/v19.2.2...v19.4.1) **Note:** Version bump only for package [@​commitlint/config-conventional](https://togithub.com/commitlint/config-conventional) </details> <details> <summary>actions/upload-artifact (actions/upload-artifact)</summary> ### [`v4.4.0`](https://togithub.com/actions/upload-artifact/compare/v4.3.6...v4.4.0) [Compare Source](https://togithub.com/actions/upload-artifact/compare/v4.3.6...v4.4.0) ### [`v4.3.6`](https://togithub.com/actions/upload-artifact/compare/v4.3.5...v4.3.6) [Compare Source](https://togithub.com/actions/upload-artifact/compare/v4.3.5...v4.3.6) ### [`v4.3.5`](https://togithub.com/actions/upload-artifact/compare/v4.3.4...v4.3.5) [Compare Source](https://togithub.com/actions/upload-artifact/compare/v4.3.4...v4.3.5) </details> <details> <summary>defenseunicorns/lula (defenseunicorns/lula)</summary> ### [`v0.6.0`](https://togithub.com/defenseunicorns/lula/releases/tag/v0.6.0) [Compare Source](https://togithub.com/defenseunicorns/lula/compare/v0.5.1...v0.6.0) This release is an exciting advance for Lula and the OSCAL ecosystem. It includes initial development release of the Terminal User Interface that can be accessed via `lula console`. Given a specified OSCAL file -> Lula will now open a TUI in the appropriate OSCAL model format with some opinionation currently on what is visualized. Other features include a new viper integration baseline - setting the stage for future configuration and environment variable driven operations that enhance the assessment and authoring processes. A bug fix was included in this release to ensure that any modification to component definition models updates the `uuid` accordingly -> in alignment with the model specification. ##### Features - **configuration:** add initial support for Viper command initialization ([#​607](https://togithub.com/defenseunicorns/lula/issues/607)) ([2c94c83](https://togithub.com/defenseunicorns/lula/commit/2c94c8312233a40a536d0f98ca513e2bbe8bf720)) - **console:** initial tui for component-definition read ([#​608](https://togithub.com/defenseunicorns/lula/issues/608)) ([a0338af](https://togithub.com/defenseunicorns/lula/commit/a0338affd4934c5100ffc280b6fac016b9eb0b91)) ##### Bug Fixes - **oscal:** ensure component definition UUID is updated on modification ([#​615](https://togithub.com/defenseunicorns/lula/issues/615)) ([5516482](https://togithub.com/defenseunicorns/lula/commit/55164824f9f16c0c76c3a068d68c42aae80bd0f3)) ##### Miscellaneous - **deps:** update anchore/sbom-action action to v0.17.2 ([#​613](https://togithub.com/defenseunicorns/lula/issues/613)) ([4fb9090](https://togithub.com/defenseunicorns/lula/commit/4fb909046e769cacf528c88fd46d957c804affd2)) - **deps:** update commitlint monorepo to v19.4.1 ([#​619](https://togithub.com/defenseunicorns/lula/issues/619)) ([0adb2d0](https://togithub.com/defenseunicorns/lula/commit/0adb2d0093b035f60af8794722a354128bbc2446)) - **deps:** update github/codeql-action action to v3.26.2 ([#​600](https://togithub.com/defenseunicorns/lula/issues/600)) ([6601566](https://togithub.com/defenseunicorns/lula/commit/66015662002d17a7c3182f0c5d4565a50ece8093)) - **deps:** update github/codeql-action action to v3.26.4 ([#​611](https://togithub.com/defenseunicorns/lula/issues/611)) ([dd592ce](https://togithub.com/defenseunicorns/lula/commit/dd592ceabc834eeb0a453bc8a0a78b04b4576bfb)) - **deps:** update github/codeql-action action to v3.26.5 ([#​616](https://togithub.com/defenseunicorns/lula/issues/616)) ([aa4e122](https://togithub.com/defenseunicorns/lula/commit/aa4e1220c725002e448707f00c456dd09161254e)) - **deps:** update github/codeql-action action to v3.26.6 ([#​626](https://togithub.com/defenseunicorns/lula/issues/626)) ([488cd91](https://togithub.com/defenseunicorns/lula/commit/488cd915f7801dddd427edf56bb8effd2d3bbc92)) - **deps:** update kubernetes packages to v0.31.0 ([#​594](https://togithub.com/defenseunicorns/lula/issues/594)) ([6dd7463](https://togithub.com/defenseunicorns/lula/commit/6dd7463c724c91f3ec34ddca87605481bdd8356f)) - **deps:** update module github.com/open-policy-agent/opa to v0.68.0 ([#​628](https://togithub.com/defenseunicorns/lula/issues/628)) ([914b1f2](https://togithub.com/defenseunicorns/lula/commit/914b1f2717dd30d6c8b2c878da0ec1582e7b047c)) - **deps:** update module github.com/spf13/viper to v1.19.0 ([#​618](https://togithub.com/defenseunicorns/lula/issues/618)) ([22fd668](https://togithub.com/defenseunicorns/lula/commit/22fd668d81923f1f098c919d0472637aa63bb451)) - **docs:** add docs generation command ([#​606](https://togithub.com/defenseunicorns/lula/issues/606)) ([4dd0450](https://togithub.com/defenseunicorns/lula/commit/4dd0450fa5f91cf4d1b3dceee52bde8f47f50935)) - **docs:** adding 2024 roadmap to the project documentation ([#​320](https://togithub.com/defenseunicorns/lula/issues/320)) ([120d15a](https://togithub.com/defenseunicorns/lula/commit/120d15a77dbcdc553c117245d392d4dcc3238066)) - **docs:** update CODEOWNERS ([#​636](https://togithub.com/defenseunicorns/lula/issues/636)) ([77e60fe](https://togithub.com/defenseunicorns/lula/commit/77e60fe6ecf13e71acc035139904e1c9aa7ab3b4)) #### What's Changed - chore(deps): update github/codeql-action action to v3.26.2 by [@​renovate](https://togithub.com/renovate) in [https://github.com/defenseunicorns/lula/pull/600](https://togithub.com/defenseunicorns/lula/pull/600) - refactor(tests): 586 refactor unhappy path e2e tests by [@​meganwolf0](https://togithub.com/meganwolf0) in [https://github.com/defenseunicorns/lula/pull/598](https://togithub.com/defenseunicorns/lula/pull/598) - docs: adding 2024 roadmap to the project documentation by [@​brandtkeller](https://togithub.com/brandtkeller) in [https://github.com/defenseunicorns/lula/pull/320](https://togithub.com/defenseunicorns/lula/pull/320) - chore(deps): update anchore/sbom-action action to v0.17.2 by [@​renovate](https://togithub.com/renovate) in [https://github.com/defenseunicorns/lula/pull/613](https://togithub.com/defenseunicorns/lula/pull/613) - chore(deps): update github/codeql-action action to v3.26.4 by [@​renovate](https://togithub.com/renovate) in [https://github.com/defenseunicorns/lula/pull/611](https://togithub.com/defenseunicorns/lula/pull/611) - chore(deps): update github/codeql-action action to v3.26.5 by [@​renovate](https://togithub.com/renovate) in [https://github.com/defenseunicorns/lula/pull/616](https://togithub.com/defenseunicorns/lula/pull/616) - feat(configuration): add initial support for Viper command initialization by [@​brandtkeller](https://togithub.com/brandtkeller) in [https://github.com/defenseunicorns/lula/pull/607](https://togithub.com/defenseunicorns/lula/pull/607) - chore(deps): update module github.com/spf13/viper to v1.19.0 by [@​renovate](https://togithub.com/renovate) in [https://github.com/defenseunicorns/lula/pull/618](https://togithub.com/defenseunicorns/lula/pull/618) - chore(docs): add docs generation command by [@​brandtkeller](https://togithub.com/brandtkeller) in [https://github.com/defenseunicorns/lula/pull/606](https://togithub.com/defenseunicorns/lula/pull/606) - chore(deps): update commitlint monorepo to v19.4.1 by [@​renovate](https://togithub.com/renovate) in [https://github.com/defenseunicorns/lula/pull/619](https://togithub.com/defenseunicorns/lula/pull/619) - chore(deps): update module github.com/open-policy-agent/opa to v0.68.0 by [@​renovate](https://togithub.com/renovate) in [https://github.com/defenseunicorns/lula/pull/628](https://togithub.com/defenseunicorns/lula/pull/628) - chore(deps): update github/codeql-action action to v3.26.6 by [@​renovate](https://togithub.com/renovate) in [https://github.com/defenseunicorns/lula/pull/626](https://togithub.com/defenseunicorns/lula/pull/626) - feat(console): initial tui for component-defn read by [@​meganwolf0](https://togithub.com/meganwolf0) in [https://github.com/defenseunicorns/lula/pull/608](https://togithub.com/defenseunicorns/lula/pull/608) - fix(oscal): ensure component definition UUID is updated on modification by [@​brandtkeller](https://togithub.com/brandtkeller) in [https://github.com/defenseunicorns/lula/pull/615](https://togithub.com/defenseunicorns/lula/pull/615) - chore(deps): update kubernetes packages to v0.31.0 by [@​renovate](https://togithub.com/renovate) in [https://github.com/defenseunicorns/lula/pull/594](https://togithub.com/defenseunicorns/lula/pull/594) - feat: update CODEOWNERS by [@​daveworth](https://togithub.com/daveworth) in [https://github.com/defenseunicorns/lula/pull/636](https://togithub.com/defenseunicorns/lula/pull/636) - chore(main): release 0.6.0 by [@​github-actions](https://togithub.com/github-actions) in [https://github.com/defenseunicorns/lula/pull/604](https://togithub.com/defenseunicorns/lula/pull/604) #### New Contributors - [@​daveworth](https://togithub.com/daveworth) made their first contribution in [https://github.com/defenseunicorns/lula/pull/636](https://togithub.com/defenseunicorns/lula/pull/636) **Full Changelog**: defenseunicorns/lula@v0.5.1...v0.6.0 </details> <details> <summary>opentofu/setup-opentofu (opentofu/setup-opentofu)</summary> ### [`v1.0.4`](https://togithub.com/opentofu/setup-opentofu/releases/tag/v1.0.4) [Compare Source](https://togithub.com/opentofu/setup-opentofu/compare/v1.0.3...v1.0.4) #### What's Changed - Fix tofu output printing debug information by [@​VladMasarik](https://togithub.com/VladMasarik) in [https://github.com/opentofu/setup-opentofu/pull/31](https://togithub.com/opentofu/setup-opentofu/pull/31) #### New Contributors - [@​VladMasarik](https://togithub.com/VladMasarik) made their first contribution in [https://github.com/opentofu/setup-opentofu/pull/31](https://togithub.com/opentofu/setup-opentofu/pull/31) **Full Changelog**: opentofu/setup-opentofu@v1...v1.0.4 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/defenseunicorns/uds-core). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM4LjU2LjAiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbXX0=--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Description
Adds initial command support for viper configuration integrated with commands for initializing viper and detecting configuration file and environment variables.
Related Issue
Resolves #596
Type of change
Checklist before merging