@@ -84,37 +84,24 @@ func patchWithContext(ctx context.Context, ch chan error, image, reportFile, pat
84
84
imageName = reference .TagNameOnly (imageName )
85
85
}
86
86
var tag string
87
- var digest string
88
- if taggedName , ok := imageName .(reference.Tagged ); ok {
89
- tag = taggedName .Tag ()
90
- digest , err = FetchImageDigest (taggedName )
91
- if err != nil {
92
- return err
93
- }
94
- imageName , err = reference .WithDigest (imageName , digest )
95
- if err != nil {
96
- return err
97
- }
87
+ taggedName , ok := imageName .(reference.Tagged )
88
+ if ok {
89
+ tag = taggedName .Tag ()
98
90
} else {
99
- log .Warnf ("Image name has no tag" )
100
- }
91
+ log .Warnf ("Image name has no tag" )
92
+ }
101
93
if patchedTag == "" {
102
- if tag == "" {
103
- log .Warnf ("No output tag specified for digest-referenced image, defaulting to `%s`" , defaultPatchedTagSuffix )
104
- patchedTag = defaultPatchedTagSuffix
105
- } else {
106
- patchedTag = fmt .Sprintf ("%s-%s" , tag , defaultPatchedTagSuffix )
107
- }
94
+ if tag == "" {
95
+ log .Warnf ("No output tag specified for digest-referenced image, defaulting to `%s`" , defaultPatchedTagSuffix )
96
+ patchedTag = defaultPatchedTagSuffix
97
+ } else {
98
+ patchedTag = fmt .Sprintf ("%s-%s" , tag , defaultPatchedTagSuffix )
99
+ }
108
100
}
109
101
_ , err = reference .WithTag (imageName , patchedTag )
110
102
if err != nil {
111
103
return fmt .Errorf ("%w with patched tag %s" , err , patchedTag )
112
104
}
113
- // Make sure the digest was successfully fetched earlier and is valid
114
- if digest == "" {
115
- return fmt .Errorf ("failed to fetch digest for image %s" , imageName )
116
- }
117
-
118
105
patchedImageName := fmt .Sprintf ("%s@sha256:%s" , imageName .Name (), digest )
119
106
120
107
// Ensure working folder exists for call to InstallUpdates
@@ -147,16 +134,9 @@ func patchWithContext(ctx context.Context, ch chan error, image, reportFile, pat
147
134
log .Debugf ("updates to apply: %v" , updates )
148
135
}
149
136
150
- if updates != nil && len (updates .Updates ) > 0 {
151
- if err := vex .TryOutputVexDocument (updates , manager , patchedImageName , format , output ); err != nil {
152
- return err
153
- }
154
- }
155
- return eg .Wait ()
156
-
157
137
bkClient , err := buildkit .NewClient (ctx , bkOpts )
158
138
if err != nil {
159
- return err
139
+ return err
160
140
}
161
141
defer bkClient .Close ()
162
142
0 commit comments