mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-09-15 12:07:53 +00:00
Fix podman-remote build output not being displayed
The podman-remote build command was not displaying build output, causing remotesystem tests to fail when expecting output like "COMMIT", "cache", "Successfully built", etc. Root causes: 1. BuildOptions.Out was set to nil when no --logfile was specified, causing all build output to be discarded 2. BuildOptions.Err was not set, preventing auxiliary build output from being displayed Changes: - Set Out and Err to default to os.Stdout and os.Stderr respectively - Both redirect to logfile when --logfile is specified - Remove incorrect client-side quiet flag handling (already handled by build engine via Quiet option) This matches the behavior of the non-remote build implementation in build.go and ensures build output is properly streamed from the server through the bindings to the client's stdout/stderr. Fixes test failures in make remotesystem for build-related tests. Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
This commit is contained in:
parent
25a9cfa392
commit
ec8e61e60a
1 changed files with 11 additions and 6 deletions
|
|
@ -363,6 +363,14 @@ func build(cmd *cobra.Command, args []string) error {
|
|||
defer logfile.Close()
|
||||
}
|
||||
|
||||
// Set output destinations: logfile if specified, otherwise stdout/stderr
|
||||
stdout := os.Stdout
|
||||
stderr := os.Stderr
|
||||
if logfile != nil {
|
||||
stdout = logfile
|
||||
stderr = logfile
|
||||
}
|
||||
|
||||
opts := entities.BuildOptions{
|
||||
BuildOptions: buildahDefine.BuildOptions{
|
||||
CommonBuildOpts: &buildahDefine.CommonBuildOptions{
|
||||
|
|
@ -376,11 +384,12 @@ func build(cmd *cobra.Command, args []string) error {
|
|||
AdditionalTags: tags,
|
||||
Args: buildArgs,
|
||||
ContextDirectory: contextDir,
|
||||
Err: stderr,
|
||||
Excludes: excludes,
|
||||
ForceRmIntermediateCtrs: buildOpts.ForceRm,
|
||||
Layers: layers,
|
||||
NoCache: buildOpts.NoCache,
|
||||
Out: logfile,
|
||||
Out: stdout,
|
||||
Output: output,
|
||||
PullPolicy: pullPolicy,
|
||||
Quiet: buildOpts.Quiet,
|
||||
|
|
@ -392,15 +401,11 @@ func build(cmd *cobra.Command, args []string) error {
|
|||
}
|
||||
|
||||
// Call the engine to perform the build (which will use bindings for remote)
|
||||
report, err := registry.ImageEngine().Build(registry.GetContext(), containerFiles, opts)
|
||||
_, err := registry.ImageEngine().Build(registry.GetContext(), containerFiles, opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if cmd.Flag("quiet").Changed {
|
||||
fmt.Println(report.ID)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue