|
@@ -4,7 +4,6 @@ import (
|
|
|
"context"
|
|
"context"
|
|
|
"io"
|
|
"io"
|
|
|
"net/netip"
|
|
"net/netip"
|
|
|
- "os"
|
|
|
|
|
"strings"
|
|
"strings"
|
|
|
"time"
|
|
"time"
|
|
|
|
|
|
|
@@ -34,7 +33,6 @@ type (
|
|
|
dockerImage struct {
|
|
dockerImage struct {
|
|
|
docker *docker
|
|
docker *docker
|
|
|
auth string
|
|
auth string
|
|
|
- out io.Writer
|
|
|
|
|
}
|
|
}
|
|
|
dockerContainer struct {
|
|
dockerContainer struct {
|
|
|
docker *docker
|
|
docker *docker
|
|
@@ -340,13 +338,11 @@ func (t *dockerContainer) Remove() error {
|
|
|
func (t *docker) Image() *dockerImage {
|
|
func (t *docker) Image() *dockerImage {
|
|
|
return &dockerImage{
|
|
return &dockerImage{
|
|
|
docker: t,
|
|
docker: t,
|
|
|
- out: os.Stderr,
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// RegistryAuth is the base64 encoded credentials for the registry
|
|
// RegistryAuth is the base64 encoded credentials for the registry
|
|
|
func (t *dockerImage) Auth(RegistryAuth string) { t.auth = RegistryAuth }
|
|
func (t *dockerImage) Auth(RegistryAuth string) { t.auth = RegistryAuth }
|
|
|
-func (t *dockerImage) Out(out io.Writer) { t.out = out }
|
|
|
|
|
func (t *dockerImage) Build(tag, path, dockerfile string) error {
|
|
func (t *dockerImage) Build(tag, path, dockerfile string) error {
|
|
|
cli, err := t.docker.client()
|
|
cli, err := t.docker.client()
|
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -372,9 +368,9 @@ func (t *dockerImage) Build(tag, path, dockerfile string) error {
|
|
|
}
|
|
}
|
|
|
defer buildResponse.Body.Close()
|
|
defer buildResponse.Body.Close()
|
|
|
|
|
|
|
|
- if t.out != nil {
|
|
|
|
|
- fd, isTerminal := term.GetFdInfo(t.out)
|
|
|
|
|
- return jsonmessage.DisplayJSONMessagesStream(buildResponse.Body, t.out, fd, isTerminal, nil)
|
|
|
|
|
|
|
+ if log != nil {
|
|
|
|
|
+ fd, isTerminal := term.GetFdInfo(log)
|
|
|
|
|
+ return jsonmessage.DisplayJSONMessagesStream(buildResponse.Body, log, fd, isTerminal, nil)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
return nil
|
|
@@ -413,9 +409,9 @@ func (t *dockerImage) Push(image string) error {
|
|
|
}
|
|
}
|
|
|
defer res.Close()
|
|
defer res.Close()
|
|
|
|
|
|
|
|
- if t.out != nil {
|
|
|
|
|
- fd, isTerminal := term.GetFdInfo(t.out)
|
|
|
|
|
- return jsonmessage.DisplayJSONMessagesStream(res, t.out, fd, isTerminal, nil)
|
|
|
|
|
|
|
+ if log != nil {
|
|
|
|
|
+ fd, isTerminal := term.GetFdInfo(log)
|
|
|
|
|
+ return jsonmessage.DisplayJSONMessagesStream(res, log, fd, isTerminal, nil)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
return nil
|
|
@@ -454,9 +450,9 @@ func (t *dockerImage) Pull(image string, timeout time.Duration) error {
|
|
|
|
|
|
|
|
defer res.Close()
|
|
defer res.Close()
|
|
|
|
|
|
|
|
- if t.out != nil {
|
|
|
|
|
- fd, isTerminal := term.GetFdInfo(t.out)
|
|
|
|
|
- return jsonmessage.DisplayJSONMessagesStream(res, t.out, fd, isTerminal, nil)
|
|
|
|
|
|
|
+ if log != nil {
|
|
|
|
|
+ fd, isTerminal := term.GetFdInfo(log)
|
|
|
|
|
+ return jsonmessage.DisplayJSONMessagesStream(res, log, fd, isTerminal, nil)
|
|
|
} else {
|
|
} else {
|
|
|
err = res.Wait(ctx)
|
|
err = res.Wait(ctx)
|
|
|
if err != nil {
|
|
if err != nil {
|