Skip to content

Commit

Permalink
fix: #34 close the reader to avoid leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
bohdan-shulha committed Aug 20, 2024
1 parent 9e2f6cb commit bc29b35
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/app/ptah-agent/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,16 @@ func (e *taskExecutor) uploadS3FileWithHelper(ctx context.Context, mounts []moun
}

// Pull the d3fk/s3cmd image before starting the container
_, err = e.docker.ImagePull(ctx, "d3fk/s3cmd", image.PullOptions{}) // Added underscore to ignore the first return value
pull, err := e.docker.ImagePull(ctx, "d3fk/s3cmd", image.PullOptions{}) // Added underscore to ignore the first return value
if err != nil {
return fmt.Errorf("check s3 storage: pull image: %w", err)
}
defer pull.Close()

_, err = io.ReadAll(pull)
if err != nil {
return fmt.Errorf("check s3 storage: read image pull: %w", err)
}

createResponse, err := e.docker.ContainerCreate(ctx, &container.Config{
Image: "d3fk/s3cmd",
Expand Down

0 comments on commit bc29b35

Please sign in to comment.