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

Function ValidateImageWithVSACheck

internal/image/validate.go:175–202  ·  view source on GitHub ↗

ValidateImageWithVSACheck executes validation with VSA expiration checking. If a valid, unexpired VSA exists, validation is skipped.

(ctx context.Context, comp app.SnapshotComponent, snap *app.SnapshotSpec, p policy.Policy, evaluators []evaluator.Evaluator, detailed bool, vsaChecker *vsa.VSAChecker, vsaExpiration time.Duration)

Source from the content-addressed store, hash-verified

173// ValidateImageWithVSACheck executes validation with VSA expiration checking.
174// If a valid, unexpired VSA exists, validation is skipped.
175func ValidateImageWithVSACheck(ctx context.Context, comp app.SnapshotComponent, snap *app.SnapshotSpec, p policy.Policy, evaluators []evaluator.Evaluator, detailed bool, vsaChecker *vsa.VSAChecker, vsaExpiration time.Duration) (*output.Output, error) {
176 if trace.IsEnabled() {
177 region := trace.StartRegion(ctx, "ec:validate-image-with-vsa-check")
178 defer region.End()
179 trace.Logf(ctx, "", "image=%q vsa-expiration=%v", comp.ContainerImage, vsaExpiration)
180 }
181
182 // Check for existing valid VSA
183 isValid, err := vsaChecker.IsValidVSA(ctx, comp.ContainerImage, vsaExpiration)
184 if err != nil {
185 log.Warnf("Failed to check for existing VSA for image %s: %v", comp.ContainerImage, err)
186 // Continue with validation on VSA lookup failure
187 } else if isValid {
188 log.WithFields(log.Fields{
189 "image": comp.ContainerImage,
190 "expiration_threshold": vsaExpiration,
191 }).Info("Valid VSA found, skipping validation")
192
193 // Return nil to indicate validation was skipped due to valid VSA
194 return nil, nil
195 } else {
196 log.Debugf("No valid VSA found for image %s, proceeding with validation", comp.ContainerImage)
197 }
198
199 // Perform normal validation, if no valid VSA is found
200 log.Debugf("Performing full validation for image %s", comp.ContainerImage)
201 return ValidateImage(ctx, comp, snap, p, evaluators, detailed)
202}
203
204func resolveAndSetImageUrl(ctx context.Context, url string, asi *application_snapshot_image.ApplicationSnapshotImage) (string, error) {
205 // Ensure image URL contains a digest to avoid ambiguity in the next

Calls 5

ValidateImageFunction · 0.85
IsValidVSAMethod · 0.80
LogfMethod · 0.65
WarnfMethod · 0.65
InfoMethod · 0.65