Skip to content

Commit

Permalink
osbuild: set the cache-max-size to 20 G when checkpoints are defined
Browse files Browse the repository at this point in the history
Adding --checkpoints to the osbuild call has no effect right now unless
a previous run of osbuild set the max size already.
Since we support passing checkpoint args to the osbuild call, let's also
set the cache size to a baseline default value to have those checkpoints
actually checkpoint.
  • Loading branch information
achilleas-k authored and thozza committed Feb 20, 2025
1 parent ede2b6b commit 0d62970
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/osbuild/osbuild-exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"os"
"os/exec"
"strings"

"github.com/osbuild/images/pkg/datasizes"
)

// Run an instance of osbuild, returning a parsed osbuild.Result.
Expand All @@ -34,6 +36,11 @@ func RunOSBuild(manifest []byte, store, outputDirectory string, exports, checkpo
cmd.Args = append(cmd.Args, "--checkpoint", checkpoint)
}

if len(checkpoints) > 0 {
// set the cache-max-size to a reasonable size that the checkpoints actually get stored
cmd.Args = append(cmd.Args, "--cache-max-size", fmt.Sprint(20*datasizes.GiB))
}

if result {
cmd.Args = append(cmd.Args, "--json")
cmd.Stdout = &stdoutBuffer
Expand Down

0 comments on commit 0d62970

Please sign in to comment.