Skip to content

Commit 9e297bb

Browse files
committed
skip expansion for validate vsa
1 parent 773b42a commit 9e297bb

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

cmd/validate/vsa.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,10 @@ func validateVSACmd(validate vsaValidationFunc) *cobra.Command {
139139

140140
// Determine input spec from various sources (image, images, etc.)
141141
if data.imageRef != "" || data.images != "" {
142-
if s, _, err := applicationsnapshot.DetermineInputSpec(ctx, applicationsnapshot.Input{
142+
if s, _, err := applicationsnapshot.DetermineInputSpecWithExpansion(ctx, applicationsnapshot.Input{
143143
Image: data.imageRef,
144144
Images: data.images,
145-
}); err != nil {
145+
}, true); err != nil {
146146
return fmt.Errorf("determine input spec: %w", err)
147147
} else {
148148
data.spec = s
@@ -234,6 +234,7 @@ func validateVSAFile(ctx context.Context, cmd *cobra.Command, data struct {
234234

235235
// Parse VSA content to extract image reference
236236
predicate, err := vsa.ParseVSAContent(vsaContent)
237+
fmt.Printf("VSA predicate: %+v\n", predicate)
237238
if err != nil {
238239
return fmt.Errorf("failed to parse VSA content: %w", err)
239240
}

internal/applicationsnapshot/input.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ func (s *snapshot) merge(snap app.SnapshotSpec) {
9191
}
9292

9393
func DetermineInputSpec(ctx context.Context, input Input) (*app.SnapshotSpec, *ExpansionInfo, error) {
94+
return DetermineInputSpecWithExpansion(ctx, input, false)
95+
}
96+
97+
func DetermineInputSpecWithExpansion(ctx context.Context, input Input, skipExpansion bool) (*app.SnapshotSpec, *ExpansionInfo, error) {
9498
var snapshot snapshot
9599
provided := false
96100

@@ -173,11 +177,16 @@ func DetermineInputSpec(ctx context.Context, input Input) (*app.SnapshotSpec, *E
173177
log.Debug("No application snapshot available")
174178
return nil, nil, errors.New("neither Snapshot nor image reference provided to validate")
175179
}
176-
exp := expandImageIndex(ctx, &snapshot.SnapshotSpec)
180+
var exp *ExpansionInfo
181+
if !skipExpansion {
182+
exp = expandImageIndex(ctx, &snapshot.SnapshotSpec)
183+
}
177184

178185
// Store expansion info in the snapshot for later use
179186
// This will be used when building the Report
180-
snapshot.Expansion = exp
187+
if exp != nil {
188+
snapshot.Expansion = exp
189+
}
181190

182191
return &snapshot.SnapshotSpec, exp, nil
183192
}

0 commit comments

Comments
 (0)