Skip to content

Commit 679d48a

Browse files
Revert changes
Signed-off-by: shubhamsugara22 <[email protected]>
1 parent e0bef0b commit 679d48a

File tree

1 file changed

+12
-32
lines changed

1 file changed

+12
-32
lines changed

pkg/patch/patch.go

+12-32
Original file line numberDiff line numberDiff line change
@@ -84,37 +84,24 @@ func patchWithContext(ctx context.Context, ch chan error, image, reportFile, pat
8484
imageName = reference.TagNameOnly(imageName)
8585
}
8686
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()
9890
} else {
99-
log.Warnf("Image name has no tag")
100-
}
91+
log.Warnf("Image name has no tag")
92+
}
10193
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+
}
108100
}
109101
_, err = reference.WithTag(imageName, patchedTag)
110102
if err != nil {
111103
return fmt.Errorf("%w with patched tag %s", err, patchedTag)
112104
}
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-
118105
patchedImageName := fmt.Sprintf("%s@sha256:%s", imageName.Name(), digest)
119106

120107
// Ensure working folder exists for call to InstallUpdates
@@ -147,16 +134,9 @@ func patchWithContext(ctx context.Context, ch chan error, image, reportFile, pat
147134
log.Debugf("updates to apply: %v", updates)
148135
}
149136

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-
157137
bkClient, err := buildkit.NewClient(ctx, bkOpts)
158138
if err != nil {
159-
return err
139+
return err
160140
}
161141
defer bkClient.Close()
162142

0 commit comments

Comments
 (0)