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

Implement concurrent manifest validation against Hub in CLI #437

Merged
merged 4 commits into from
Aug 11, 2021

Conversation

pkosiec
Copy link
Member

@pkosiec pkosiec commented Aug 9, 2021

Description

Changes proposed in this pull request:

  • Add JSON schema validation for Type
  • Validate manifest references for Interface, Implementation and Type
  • Refactor validator to concurrent validator
  • Add verbose flag for validation
  • Move /pkg/sdk/manifest validation-related logic to /pkg/sdk/manifest/validation

Notes

This PR is based on branch with fixes from #436. Once #436 is merged, this PR will be rebased to latest main.
EDIT: Done

Testing

  1. Run Capact from main branch:

    make dev-cluster
  2. Populate Hub manifests from main branch:

    kubectl -n capact-system port-forward svc/neo4j-neo4j 7687:7687
    APP_JSONPUBLISHADDR=http://$(ipconfig getifaddr en0) go run cmd/populator/main.go register ocf-manifests ../hub-manifests
  3. Log in to Capact CLI: https://capact.io/docs/cli/getting-started#first-use

  4. Run the following command against cloned hub-manifests in main branch:

    go run cmd/cli/main.go manifest validate --server-side -v ../hub-manifests/**/*.yaml
    • check the output with and without -v / --verbose flag
    • check the output with and without --server-side flag
    • press CTRL+C in the middle of validation to see how it behaves
  5. Check out the fixed manifests from PR: Fix manifest lint errors detected by CLI hub-manifests#16

  6. Run the populator:

    kubectl -n capact-system port-forward svc/neo4j-neo4j 7687:7687
    APP_JSONPUBLISHADDR=http://$(ipconfig getifaddr en0) go run cmd/populator/main.go register ocf-manifests ../hub-manifests
  7. Follow the 3rd step again. Observe no errors in manifests.

Related issue(s)

#398

Copy link
Member

@mszostok mszostok left a comment

Choose a reason for hiding this comment

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

Awesome work 🚀 tested and works like a charm.

I have just a few comments :)

cmd/cli/cmd/manifest/validate.go Outdated Show resolved Hide resolved
cmd/cli/cmd/manifest/validate.go Show resolved Hide resolved
internal/cli/validate/validate.go Outdated Show resolved Hide resolved
internal/cli/validate/validate.go Outdated Show resolved Hide resolved
internal/cli/validate/validate.go Outdated Show resolved Hide resolved
pkg/sdk/manifest/json_ocfschema.go Outdated Show resolved Hide resolved
pkg/sdk/manifest/json_remote_implementation.go Outdated Show resolved Hide resolved
pkg/sdk/manifest/fsvalidator_test.go Outdated Show resolved Hide resolved
pkg/hub/client/public/client.go Show resolved Hide resolved
pkg/sdk/manifest/json_type.go Outdated Show resolved Hide resolved
Copy link
Member

@mszostok mszostok left a comment

Choose a reason for hiding this comment

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

lgtm 👍

@pkosiec pkosiec merged commit 5ef56b7 into capactio:main Aug 11, 2021
@pkosiec pkosiec deleted the cli-validate branch August 11, 2021 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli Relates to CLI area/hub-manifests Relates to Hub manifests enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants