Skip to content

Commit efe84ba

Browse files
committed
apt: ignore cache for "apt update"
"apt update" should never be cached. This also shouldn't break caching for anything run after it unless the rootfs changed (ie. apt cache was actually updated). Signed-off-by: Brian Goff <[email protected]>
1 parent 949d6c2 commit efe84ba

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

pkg/pkgmgr/dpkg.go

+15-3
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,11 @@ func (dm *dpkgManager) probeDPKGStatus(ctx context.Context, toolImage string) er
148148
llb.Platform(dm.config.Platform),
149149
llb.ResolveModeDefault,
150150
)
151-
updated := toolingBase.Run(llb.Shlex("apt update"), llb.WithProxy(utils.GetProxy())).Root()
151+
updated := toolingBase.Run(
152+
llb.Shlex("apt update"),
153+
llb.WithProxy(utils.GetProxy()),
154+
llb.IgnoreCache,
155+
).Root()
152156

153157
const installBusyBoxCmd = "apt install busybox-static"
154158
busyBoxInstalled := updated.Run(llb.Shlex(installBusyBoxCmd), llb.WithProxy(utils.GetProxy())).Root()
@@ -198,7 +202,11 @@ func (dm *dpkgManager) installUpdates(ctx context.Context, updates types.UpdateP
198202
// Since this takes place in the target container, it can interfere with install actions
199203
// such as the installation of the updated debian-archive-keyring package, so it's probably best
200204
// to separate it out to an explicit container edit command or opt-in before patching.
201-
aptUpdated := dm.config.ImageState.Run(llb.Shlex("apt update"), llb.WithProxy(utils.GetProxy())).Root()
205+
aptUpdated := dm.config.ImageState.Run(
206+
llb.Shlex("apt update"),
207+
llb.WithProxy(utils.GetProxy()),
208+
llb.IgnoreCache,
209+
).Root()
202210

203211
// Install all requested update packages without specifying the version. This works around:
204212
// - Reports being slightly out of date, where a newer security revision has displaced the one specified leading to not found errors.
@@ -237,7 +245,11 @@ func (dm *dpkgManager) unpackAndMergeUpdates(ctx context.Context, updates types.
237245
)
238246

239247
// Run apt update && apt download list of updates to target folder
240-
updated := toolingBase.Run(llb.Shlex("apt update"), llb.WithProxy(utils.GetProxy())).Root()
248+
updated := toolingBase.Run(
249+
llb.Shlex("apt update"),
250+
llb.WithProxy(utils.GetProxy()),
251+
llb.IgnoreCache,
252+
).Root()
241253

242254
// Download all requested update packages without specifying the version. This works around:
243255
// - Reports being slightly out of date, where a newer security revision has displaced the one specified leading to not found errors.

0 commit comments

Comments
 (0)