Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ignore cache for "apt update" #364

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions pkg/pkgmgr/dpkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,11 @@ func (dm *dpkgManager) probeDPKGStatus(ctx context.Context, toolImage string) er
llb.Platform(dm.config.Platform),
llb.ResolveModeDefault,
)
updated := toolingBase.Run(llb.Shlex("apt update"), llb.WithProxy(utils.GetProxy())).Root()
updated := toolingBase.Run(
llb.Shlex("apt update"),
llb.WithProxy(utils.GetProxy()),
llb.IgnoreCache,
).Root()

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

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

// Run apt update && apt download list of updates to target folder
updated := toolingBase.Run(llb.Shlex("apt update"), llb.WithProxy(utils.GetProxy())).Root()
updated := toolingBase.Run(
llb.Shlex("apt update"),
llb.WithProxy(utils.GetProxy()),
llb.IgnoreCache,
).Root()

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