Skip to content

Commit

Permalink
chore(server): expand artifact build log with stderr
Browse files Browse the repository at this point in the history
Signed-off-by: Evgeniy Frolov <[email protected]>
  • Loading branch information
Fral738 committed Feb 21, 2025
1 parent 47700e3 commit 7d01b00
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion server/pkg/docker/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package docker

import (
"archive/tar"
"bytes"
"context"
"fmt"
"os/exec"
Expand Down Expand Up @@ -105,11 +106,16 @@ func BuildReleaseArtifacts(ctx context.Context, opts BuildReleaseArtifactsOpts,
func RunCliBuild(contextReader *nio.PipeReader, tarWriter *nio.PipeWriter, args ...string) error {
finalArgs := append([]string{"buildx", "build"}, args...)
cmd := exec.Command("docker", finalArgs...)

cmd.Stdout = tarWriter

var stderr bytes.Buffer
cmd.Stderr = &stderr

cmd.Stdin = contextReader

if err := cmd.Run(); err != nil {
return fmt.Errorf("failed to execute docker build: %w", err)
return fmt.Errorf("failed to execute docker build: %w: %s", err, stderr.String())
}

return nil
Expand Down

0 comments on commit 7d01b00

Please sign in to comment.