feat: introduce azd validate command with pipeline and gate framework#8597
Draft
vhvb1989 wants to merge 3 commits into
Draft
feat: introduce azd validate command with pipeline and gate framework#8597vhvb1989 wants to merge 3 commits into
vhvb1989 wants to merge 3 commits into
Conversation
Implements the core validation pipeline framework for azd validate (#7817). The design introduces three concepts: - Pipeline: orchestrates sequential execution of validation gates - Gate: a named validation stage containing related checks - Check: an individual validation function within a gate Key components: - pkg/validate/types.go: Core types (CheckResult, GateResult, PipelineResult) - pkg/validate/gate.go: Gate interface and PipelineContext with typed values - pkg/validate/check.go: CheckBasedGate for composing checks into gates - pkg/validate/pipeline.go: Pipeline engine with abort/continue behavior - pkg/validate/report.go: ValidationReport UX rendering (reuses preflight pattern) - pkg/validate/gate_project_config.go: Example built-in gate - internal/cmd/validate.go: ValidateAction with --gate filter flag The pipeline flows a shared PipelineContext through gates, enabling inter-gate data sharing via a typed Values map. Gates run sequentially with configurable error behavior (abort on first error vs continue). The existing local-preflight in the bicep provider can be migrated to a Gate implementation in a follow-up, making it the first gate in the pipeline alongside the new project-config gate. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The constructor was creating an empty gates slice without registering any built-in gates, causing azd validate to succeed immediately with no checks. Now registers NewProjectConfigGate() by default. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add Validate() to the provisioning.Provider interface and implement it in BicepProvider (reuses plan() + local preflight checks), with stubs for Terraform, TestProvider, DevCenter, and external gRPC providers. Create LocalPreflightGate in pkg/validate that delegates to the provisioning Manager and converts results into the validate framework's CheckResult types. Register the local-preflight gate in ValidateAction so 'azd validate' runs both project-config and local-preflight gates. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Implements the core validation pipeline framework for
azd validate(resolves #7817).Design Overview
The framework introduces three core concepts:
Pipeline — Orchestrates sequential execution of validation gates. Supports configurable error behavior (
aborton first error vscontinuethrough all gates).Gate — A named validation stage (e.g.
local-preflight,project-config). Each gate groups related checks and implements theGateinterface (Name() + Run(ctx, pipelineCtx)).Check — An individual validation function within a gate, identified by a stable
RuleID.Shared Pipeline Context
A
PipelineContextflows through all gates, providing:Valuesmap for inter-gate data sharing (e.g. a gate can store computed resource data for downstream gates)Extension Integration (future)
The design supports two extension contribution models:
EventStreamgRPC, no new proto surface needed.validation-gatecapability — requires new gRPC messages, deferred.Files
pkg/validate/types.goCheckResult,CheckSeverity,GateResult,PipelineResultpkg/validate/gate.goGateinterface,PipelineContextwith typed value accessorspkg/validate/check.goCheck,CheckFn,CheckBasedGate(convenience gate from checks)pkg/validate/pipeline.goPipelineengine with abort/continue behaviorpkg/validate/report.goValidationReportUX rendering (reuses preflight report pattern)pkg/validate/gate_project_config.gopkg/validate/pipeline_test.gointernal/cmd/validate.goValidateActionwith--gatefilter flagHow existing local-preflight becomes a gate
The existing
localArmPreflightin the bicep provider maps directly to aGateimplementation. In a follow-up PR,BicepProvider.validatePreflight()will be wrapped as a gate, making it the first gate in theazd validatepipeline alongside the newproject-configgate. The existing checks (role_assignment_permissions,ai_model_quota,reserved_resource_names) becomeCheckentries in that gate.What is NOT in this PR
azure.yamlconfiguration for gate enablement (future)Testing
pkg/validate/pipeline_test.gocovering:golangci-lint,cspell,gofmt,go fix, copyright check — all cleanResolves #7817