2025-01-02 11:53:15 +00:00
|
|
|
package validate
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/databricks/cli/bundle"
|
|
|
|
"github.com/databricks/cli/libs/diag"
|
|
|
|
)
|
|
|
|
|
|
|
|
// FastValidate runs a subset of fast validation checks. This is a subset of the full
|
|
|
|
// suite of validation mutators that satisfy ANY ONE of the following criteria:
|
|
|
|
//
|
|
|
|
// 1. No file i/o or network requests are made in the mutator.
|
|
|
|
// 2. The validation is blocking for bundle deployments.
|
|
|
|
//
|
|
|
|
// The full suite of validation mutators is available in the [Validate] mutator.
|
2025-03-03 13:35:36 +00:00
|
|
|
type fastValidate struct{ bundle.RO }
|
2025-01-02 11:53:15 +00:00
|
|
|
|
2025-03-03 13:35:36 +00:00
|
|
|
func FastValidate() bundle.ReadOnlyMutator {
|
|
|
|
return &fastValidate{}
|
2025-01-02 11:53:15 +00:00
|
|
|
}
|
|
|
|
|
2025-03-03 13:35:36 +00:00
|
|
|
func (f *fastValidate) Name() string {
|
2025-01-02 11:53:15 +00:00
|
|
|
return "fast_validate(readonly)"
|
|
|
|
}
|
|
|
|
|
2025-03-03 13:35:36 +00:00
|
|
|
func (f *fastValidate) Apply(ctx context.Context, rb *bundle.Bundle) diag.Diagnostics {
|
|
|
|
return bundle.ApplyParallel(ctx, rb,
|
2025-01-02 11:53:15 +00:00
|
|
|
// Fast mutators with only in-memory checks
|
|
|
|
JobClusterKeyDefined(),
|
|
|
|
JobTaskClusterSpec(),
|
|
|
|
SingleNodeCluster(),
|
|
|
|
|
|
|
|
// Blocking mutators. Deployments will fail if these checks fail.
|
|
|
|
ValidateArtifactPath(),
|
2025-03-03 13:35:36 +00:00
|
|
|
)
|
2025-01-02 11:53:15 +00:00
|
|
|
}
|