MCPcopy Create free account
hub / github.com/conforma/cli / validateImageFallbackWithWorkerContext

Function validateImageFallbackWithWorkerContext

cmd/validate/vsa.go:1698–1729  ·  view source on GitHub ↗

validateImageFallbackWithWorkerContext performs image validation using worker-specific evaluators This ensures thread safety while reusing evaluators within the worker

(ctx context.Context, data *validateVSAData, comp app.SnapshotComponent, workerFallbackContext *vsa.WorkerFallbackContext)

Source from the content-addressed store, hash-verified

1696// validateImageFallbackWithWorkerContext performs image validation using worker-specific evaluators
1697// This ensures thread safety while reusing evaluators within the worker
1698func validateImageFallbackWithWorkerContext(ctx context.Context, data *validateVSAData, comp app.SnapshotComponent, workerFallbackContext *vsa.WorkerFallbackContext) (*output.Output, error) {
1699 log.Debugf("🔄 Starting fallback validation for image: %s", comp.ContainerImage)
1700
1701 log.Debugf("🔄 Fallback: Using component name: %s", comp.Name)
1702
1703 // Use precomputed fallback context and worker-specific evaluators
1704 if data.fallbackContext == nil {
1705 return nil, fmt.Errorf("fallback context not initialized - this should not happen")
1706 }
1707
1708 if workerFallbackContext == nil {
1709 return nil, fmt.Errorf("worker fallback context not initialized - this should not happen")
1710 }
1711
1712 if data.snapshot == nil {
1713 return nil, fmt.Errorf("snapshot spec not available - this should not happen")
1714 }
1715
1716 log.Debugf("🔄 Fallback: Using precomputed policy configuration: %s", data.fallbackContext.PolicyConfiguration)
1717 log.Debugf("🔄 Fallback: Using worker evaluators: %d", len(workerFallbackContext.Evaluators))
1718
1719 // Perform image validation using precomputed context and worker-specific evaluators
1720 log.Debugf("🔄 Fallback: Starting image validation...")
1721 log.Debugf("🔄 Fallback: Using fallback policy: %s", data.fallbackContext.FallbackPolicy)
1722 result, err := image.ValidateImage(ctx, comp, data.snapshot, data.fallbackContext.FallbackPolicy, workerFallbackContext.Evaluators, data.info)
1723 if err != nil {
1724 log.Debugf("🔄 Fallback: Image validation failed with error: %v", err)
1725 return nil, err
1726 }
1727
1728 return result, nil
1729}
1730
1731// processSnapshotComponentWithWorkerContext processes a single component using worker-specific fallback context
1732func processSnapshotComponentWithWorkerContext(ctx context.Context, component app.SnapshotComponent, data *validateVSAData, workerFallbackContext *vsa.WorkerFallbackContext) vsa.ComponentResult {

Callers 2

handleComponentFallbackFunction · 0.85

Calls 2

ValidateImageFunction · 0.92
ErrorfMethod · 0.65

Tested by 1