summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pkg/artifacts/server.go2
-rw-r--r--pkg/container/docker_run.go16
2 files changed, 11 insertions, 7 deletions
diff --git a/pkg/artifacts/server.go b/pkg/artifacts/server.go
index 4b88ea4..160dd4d 100644
--- a/pkg/artifacts/server.go
+++ b/pkg/artifacts/server.go
@@ -300,7 +300,7 @@ func Serve(ctx context.Context, artifactPath string, addr string, port string) c
go func() {
logger.Infof("Start server on http://%s:%s", addr, port)
if err := server.ListenAndServe(); err != nil && err != http.ErrServerClosed {
- logger.Fatal(err)
+ logger.Fatalf("http listener: %v", err)
}
}()
diff --git a/pkg/container/docker_run.go b/pkg/container/docker_run.go
index 3232c14..08bf53d 100644
--- a/pkg/container/docker_run.go
+++ b/pkg/container/docker_run.go
@@ -526,8 +526,9 @@ func (cr *containerReference) extractFromImageEnv(env *map[string]string) common
inspect, _, err := cr.cli.ImageInspectWithRaw(ctx, cr.input.Image)
if err != nil {
+ err = fmt.Errorf("inspect image: %w", err)
logger.Error(err)
- return fmt.Errorf("inspect image: %w", err)
+ return err
}
if inspect.Config == nil {
@@ -536,8 +537,9 @@ func (cr *containerReference) extractFromImageEnv(env *map[string]string) common
imageEnv, err := godotenv.Unmarshal(strings.Join(inspect.Config.Env, "\n"))
if err != nil {
+ err = fmt.Errorf("unmarshal image env: %w", err)
logger.Error(err)
- return fmt.Errorf("unmarshal image env: %w", err)
+ return err
}
for k, v := range imageEnv {
@@ -709,7 +711,7 @@ func (cr *containerReference) waitForCommand(ctx context.Context, isTerminal boo
return ctx.Err()
case err := <-cmdResponse:
if err != nil {
- logger.Error(err)
+ logger.Errorf("command response: %v", err)
}
return nil
@@ -754,11 +756,11 @@ func (cr *containerReference) copyDir(dstPath string, srcPath string, useGitIgno
name := tarFile.Name()
err := tarFile.Close()
if err != nil && !errors.Is(err, os.ErrClosed) {
- logger.Error(err)
+ logger.Errorf("close tar file: %s: %v", name, err)
}
err = os.Remove(name)
if err != nil {
- logger.Error(err)
+ logger.Errorf("remove file: %s: %v", name, err)
}
}(tarFile)
tw := tar.NewWriter(tarFile)
@@ -797,6 +799,8 @@ func (cr *containerReference) copyDir(dstPath string, srcPath string, useGitIgno
return err
}
if err := tw.Close(); err != nil {
+ err = fmt.Errorf("close tar writer: %w", err)
+ logger.Debug(err)
return err
}
@@ -875,7 +879,7 @@ func (cr *containerReference) attach() common.Executor {
_, err = io.Copy(outWriter, out.Reader)
}
if err != nil {
- common.Logger(ctx).Error(err)
+ common.Logger(ctx).Errorf("redirect container output: %v", err)
}
}()
return nil