Skip to content
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

Initial refactor for domains and providers #358

Merged
merged 10 commits into from
Apr 10, 2024

Conversation

meganwolf0
Copy link
Collaborator

Some initial stabs at refactoring the code to support domains and providers in a (hopefully) more extensible and modular way

Copy link

netlify bot commented Apr 4, 2024

Deploy Preview for lula-docs canceled.

Name Link
🔨 Latest commit c797e9f
🔍 Latest deploy log https://app.netlify.com/sites/lula-docs/deploys/66160388ad130f00080338c6

@meganwolf0 meganwolf0 linked an issue Apr 5, 2024 that may be closed by this pull request
Copy link
Member

@brandtkeller brandtkeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs docs/ files updated.

@meganwolf0 meganwolf0 marked this pull request as ready for review April 9, 2024 02:10
@meganwolf0 meganwolf0 marked this pull request as draft April 9, 2024 10:02
Copy link
Collaborator

@mike-winberry mike-winberry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just have one item for discussion on #354

@meganwolf0 meganwolf0 marked this pull request as ready for review April 9, 2024 20:07
@brandtkeller brandtkeller merged commit a084c2e into main Apr 10, 2024
7 checks passed
@brandtkeller brandtkeller deleted the 332-refactor-domain-and-resources branch April 10, 2024 14:40
mike-winberry added a commit that referenced this pull request Apr 10, 2024
* initial refactor for domains and providers

* fixed domain and provider instantiation

* updated tests

* fix: 332 component_test now passing successfully given a valid component definition

* fix: 332 actually fix the test.

* docs: update demo oscal to reflect changes

* added unit tests for GetProvider and GetDomain

* updated docs

* updated docs and tests

---------

Co-authored-by: Cole (Mike) Winberry <cole@defenseunicorns.com>
Co-authored-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Co-authored-by: Brandt Keller <43887158+brandtkeller@users.noreply.github.com>
brandtkeller added a commit that referenced this pull request Apr 10, 2024
* added command to get resources from validation manifest

* added tests, updated get-resources functionality

* fixed copy pasta error

* wip: #70. Add dev validate command tthat runs plula validations w/o oscal. Create initial e2e test.

* test(dev_validation_test): created scenario, and fixed the test breaking due to pod being deleted

* feat(dev/validate): #70. Add logic for outputting lula Validation w/ result. Update e2e test

* feat(dev/validation): Added expected result boolean that will print a message if the expected result is not the result given

* fix: #70 fixed the expected output logic.

* docs: #70 update dev validate cmd comments and cli output.

* feat(dev/validate): #70. Create initial LintValidation functionality and added to dev validate cmd

* refactor: #70 extracted LintValidation to Lint  method on the type Validation. Create types_test with validation.Lint tests

* refactor: #70 add comment to validation.Lint func

* fix: dev validate kyverno not passing due to incorrect yaml unmarshal method.\nchore: add kyverno validation to dev_validation_test\nfix: title being required for validation

* feat(cmd): #70 Update the dev validate command to handle taking input from stdin

* feat(dev-validate): #70 added a timeout cmd line arg to dev validate to kill stdin after the timeout
 (default: 1 (second), no timeout: -1)

* deps Update dependency go to v1.22.2 (#355)

* docs: ADR for validation format (#354)

* initial stab at validation yaml

* added placeholder workflow example

* updated adr

* updated adr

* removed examples for domains/providers we've yet to implement

* updated adr

* Rename and review ADR with modifications

* minor adr updates

* updated adr

* docs: Move ADR to Accepted

---------

Co-authored-by: Brandt Keller <brandt.keller@defenseunicorns.com>

* deps Update module sigs.k8s.io/controller-runtime to v0.17.3 (#359)

* feat: refactor for domains and providers (#358)

* initial refactor for domains and providers

* fixed domain and provider instantiation

* updated tests

* fix: 332 component_test now passing successfully given a valid component definition

* fix: 332 actually fix the test.

* docs: update demo oscal to reflect changes

* added unit tests for GetProvider and GetDomain

* updated docs

* updated docs and tests

---------

Co-authored-by: Cole (Mike) Winberry <cole@defenseunicorns.com>
Co-authored-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Co-authored-by: Brandt Keller <43887158+brandtkeller@users.noreply.github.com>

* refactor: #70 extracted conversion and validation logic into struct methods for LulaValidation and Validation.
fix(dev/validate): updated to use new Validation and Lula validation types.
refactor(component): BackMatterToMap now uses validation.ToLulaValidation()
refactor(validate): ValidateOnCompDef now uses LulaValidation.Validate()

* fix: remove types_test.go

* tests(dev/validate): update validation.kyverno.yaml with new schema

* fix(dev/validate): writeValidation -> writeValidationResult. Now writes a validation result instead of a common.Validation

* fix: typos and help menu not showing

---------

Co-authored-by: Megan Wolf <megan@defenseunicorns.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Megan Wolf <97549300+meganwolf0@users.noreply.github.com>
Co-authored-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Co-authored-by: Brandt Keller <43887158+brandtkeller@users.noreply.github.com>
brandtkeller added a commit that referenced this pull request Apr 16, 2024
* added command to get resources from validation manifest

* added tests, updated get-resources functionality

* fixed copy pasta error

* wip: #70. Add dev validate command tthat runs plula validations w/o oscal. Create initial e2e test.

* test(dev_validation_test): created scenario, and fixed the test breaking due to pod being deleted

* feat(dev/validate): #70. Add logic for outputting lula Validation w/ result. Update e2e test

* feat(dev/validation): Added expected result boolean that will print a message if the expected result is not the result given

* fix: #70 fixed the expected output logic.

* docs: #70 update dev validate cmd comments and cli output.

* feat(dev/validate): #70. Create initial LintValidation functionality and added to dev validate cmd

* refactor: #70 extracted LintValidation to Lint  method on the type Validation. Create types_test with validation.Lint tests

* refactor: #70 add comment to validation.Lint func

* fix: dev validate kyverno not passing due to incorrect yaml unmarshal method.\nchore: add kyverno validation to dev_validation_test\nfix: title being required for validation

* create initial set  up for remote_validation tests

* feat(cmd): #70 Update the dev validate command to handle taking input from stdin

* feat(dev-validate): #70 added a timeout cmd line arg to dev validate to kill stdin after the timeout
 (default: 1 (second), no timeout: -1)

* feat: Create network pkg methods to parse and fetch file from url.

* feat: added ability to link individual validations using href. TODO: add checksum validation

* feat(validate): added ability to fetch local validations given a path prefixed with file:.
feat(validate): added checksum validation to remote validation fetching

* feat: establish workflow for lula validation identifiers

* fix: remove back-matter identifier

* feat(validate): add functionality to switch cwd to input file path dir, and reset after validations for relative validation paths. Add ChangeCwd and ValidateChecksum methods to common. Remove ComponentDefinitionDir from config in favor or ChangeCwd method.

* deps Update dependency go to v1.22.2 (#355)

* docs: ADR for validation format (#354)

* initial stab at validation yaml

* added placeholder workflow example

* updated adr

* updated adr

* removed examples for domains/providers we've yet to implement

* updated adr

* Rename and review ADR with modifications

* minor adr updates

* updated adr

* docs: Move ADR to Accepted

---------

Co-authored-by: Brandt Keller <brandt.keller@defenseunicorns.com>

* deps Update module sigs.k8s.io/controller-runtime to v0.17.3 (#359)

* feat: refactor for domains and providers (#358)

* initial refactor for domains and providers

* fixed domain and provider instantiation

* updated tests

* fix: 332 component_test now passing successfully given a valid component definition

* fix: 332 actually fix the test.

* docs: update demo oscal to reflect changes

* added unit tests for GetProvider and GetDomain

* updated docs

* updated docs and tests

---------

Co-authored-by: Cole (Mike) Winberry <cole@defenseunicorns.com>
Co-authored-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Co-authored-by: Brandt Keller <43887158+brandtkeller@users.noreply.github.com>

* refactor: #70 extracted conversion and validation logic into struct methods for LulaValidation and Validation.
fix(dev/validate): updated to use new Validation and Lula validation types.
refactor(component): BackMatterToMap now uses validation.ToLulaValidation()
refactor(validate): ValidateOnCompDef now uses LulaValidation.Validate()

* fix: remove types_test.go

* fix: add testing of error scenarios for ValidationFromString()

* tests(dev/validate): update validation.kyverno.yaml with new schema

* tests(network): fixed shasums.
tests(remote-validations): fix artifacts to work with new schemas

* fix(dev/validate): writeValidation -> writeValidationResult. Now writes a validation result instead of a common.Validation

* fix: dev validate now shows help if it fails to read from stdin

* fix: dev validate cmd typo's in validateHelp

* fix: typos and help menu not showing

* fix: migrate to using ToLulaValidation function

* Debugging validation results issue

* fix: val assignment bug

* fix: update tests to use rel: lula

* fix: #298 update to work with changes to identifier.
feat: #298. add logic to read in validation maps (map[string]Validation).

* chore(github): fix bug_report template

* refactor: move checksumm validation from common to network. Write tests for common and network.

* docs(oscal-validation-links): updated with information on remote validations

* refactor: clean up

* #298. Rewrite to handle "---" delimeted validations instead of validation map

* chore: clean up unusued validation map funcs

* docs: update oscal-validation-links with info on multiple validation files

* test: add info to scenarios/remote-validations/component-definition

* test: fix TestSwitchCwd so they will work on mac filesystem

* docs(oscal-validation-links): #298 updated docs with wildcard for all validations.
test(remote_validation_test): updated component-definition resource w/ wildcard (fails)

* fix: #298. validate now runs all validations only when the wildcard is present

* fix(validate): #298 now throws error if no validations are found.

* chore: #298. update the lula-version in the remote-validations scenarios. Fix network_test with new checksum after filechange

---------

Co-authored-by: Megan Wolf <megan@defenseunicorns.com>
Co-authored-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Megan Wolf <97549300+meganwolf0@users.noreply.github.com>
Co-authored-by: Brandt Keller <43887158+brandtkeller@users.noreply.github.com>
This was referenced Jun 29, 2024
This was referenced Jul 12, 2024
This was referenced Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Refactor domain and resources
3 participants