main: fix creating output dir for --with-buildlog

Trivial fix for the missing `mkdir()` call when `--with-buildlog`
is specified (and the matching test update).
This commit is contained in:
Michael Vogt 2025-03-07 13:55:28 +01:00 committed by Simon de Vlieger
parent 3fd0373bc0
commit c3ca146161
2 changed files with 5 additions and 2 deletions

View file

@ -37,10 +37,13 @@ func buildImage(pbar progress.ProgressBar, res *imagefilter.Result, osbuildManif
OutputDir: opts.OutputDir,
}
if opts.WriteBuildlog {
if err := os.MkdirAll(opts.OutputDir, 0755); err != nil {
return fmt.Errorf("cannot create buildlog base directory: %w", err)
}
p := filepath.Join(opts.OutputDir, fmt.Sprintf("%s.buildlog", outputNameFor(res)))
f, err := os.Create(p)
if err != nil {
return err
return fmt.Errorf("cannot create buildlog: %w", err)
}
defer f.Close()

View file

@ -401,7 +401,7 @@ func TestBuildIntegrationArgs(t *testing.T) {
},
} {
t.Run(strings.Join(tc.args, ","), func(t *testing.T) {
outputDir := t.TempDir()
outputDir := filepath.Join(t.TempDir(), "output")
cmd := []string{
"build",