Skip to content

feat: add virtwork validate subcommand for catalog entries#205

Merged
mrhillsman merged 2 commits into
mainfrom
feat/validate-subcommand
Jun 14, 2026
Merged

feat: add virtwork validate subcommand for catalog entries#205
mrhillsman merged 2 commits into
mainfrom
feat/validate-subcommand

Conversation

@mrhillsman

Copy link
Copy Markdown
Contributor

Summary

  • Add virtwork validate [entry-names...] [--catalog-dir path] subcommand for structural validation of catalog entries without deploying
  • Add BindValidateFlags to internal/config/config.go (binds --catalog-dir)
  • Add newValidateCmd() and validateE() to cmd/virtwork/main.go, wired into root command
  • Discovers and validates all entries when no positional args given, or targets specific named entries
  • Per-entry validation: YAML parsing, service file presence, storage/service constraints, and placeholder consistency via ValidatePlaceholders
  • Output: OK, WARN, or FAIL per entry; exits non-zero if any entry fails
  • 2 flag tests in main_test.go, 6 functional tests in validatee_test.go

Test plan

  • ginkgo -v --focus "validateE|Validate command" ./cmd/virtwork/ — all 8 tests pass
  • go run ./cmd/virtwork validate --catalog-dir ./catalog — validates shipped entries, exits 0
  • go run ./cmd/virtwork validate --catalog-dir ./catalog sysbench — single entry, exits 0
  • go run ./cmd/virtwork validate --catalog-dir /nonexistent — exits non-zero
  • go test ./... — full suite green, no regressions

Resolves #202

@exe-prow-github-app exe-prow-github-app Bot requested a review from OchiengEd June 14, 2026 21:40
@exe-prow-github-app

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mrhillsman

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@exe-prow-github-app exe-prow-github-app Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 14, 2026
Validates catalog entries structurally without deploying: checks YAML
parsing, service file presence, storage/service constraints, and
placeholder consistency via ValidatePlaceholders.

Usage: virtwork validate [entry-names...] [--catalog-dir path]
Exits 0 if all pass, non-zero with per-entry errors on failure.

Signed-off-by: Melvin Hillsman <mhillsma@redhat.com>
@mrhillsman mrhillsman force-pushed the feat/validate-subcommand branch from e302fd3 to b8aa2ff Compare June 14, 2026 22:21
- Use wrapped static errors (err113): add ErrNoEntries and
  ErrValidationFailed sentinels, wrap with %w in validateE
- Check fmt.Fprintf return values (errcheck): prefix with _, _
- Remove trailing blank lines in main_test.go (gci)
- Break long line in validatee_test.go (golines)
- Use 0o600 file permissions in test helper (gosec G306)

Signed-off-by: Melvin Hillsman <mhillsma@redhat.com>
@mrhillsman mrhillsman merged commit 103b634 into main Jun 14, 2026
3 of 4 checks passed
@mrhillsman mrhillsman deleted the feat/validate-subcommand branch June 15, 2026 03:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add virtwork validate subcommand for catalog entries

1 participant