@@ -69,22 +69,24 @@ func (ic *ImageWriter) Commit(ctx context.Context, inp *exporter.Source, session
69
69
return nil , err
70
70
}
71
71
72
- requiredAttestations := false
73
- for _ , p := range ps .Platforms {
74
- if atts , ok := inp .Attestations [p .ID ]; ok {
75
- atts = attestation .Filter (atts , nil , map [string ][]byte {
76
- result .AttestationInlineOnlyKey : []byte (strconv .FormatBool (true )),
77
- })
78
- if len (atts ) > 0 {
79
- requiredAttestations = true
80
- break
72
+ if ! isMap {
73
+ // enable index if we need to include attestations
74
+ for _ , p := range ps .Platforms {
75
+ if atts , ok := inp .Attestations [p .ID ]; ok {
76
+ if ! opts .ForceInlineAttestations {
77
+ // if we don't need force inline attestations (for oci
78
+ // exporter), filter them out
79
+ atts = attestation .Filter (atts , nil , map [string ][]byte {
80
+ result .AttestationInlineOnlyKey : []byte (strconv .FormatBool (true )),
81
+ })
82
+ }
83
+ if len (atts ) > 0 {
84
+ isMap = true
85
+ break
86
+ }
81
87
}
82
88
}
83
89
}
84
- if requiredAttestations {
85
- isMap = true
86
- }
87
-
88
90
if opts .Epoch == nil {
89
91
if tm , ok , err := epoch .ParseSource (inp ); err != nil {
90
92
return nil , err
@@ -108,9 +110,6 @@ func (ic *ImageWriter) Commit(ctx context.Context, inp *exporter.Source, session
108
110
if len (ps .Platforms ) > 1 {
109
111
return nil , errors .Errorf ("cannot export multiple platforms without multi-platform enabled" )
110
112
}
111
- if requiredAttestations {
112
- return nil , errors .Errorf ("cannot export attestations without multi-platform enabled" )
113
- }
114
113
115
114
var ref cache.ImmutableRef
116
115
var p exptypes.Platform
0 commit comments