build: address some review nits
Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
parent
5a103e1844
commit
b3a5c153d5
@ -414,7 +414,7 @@ func (c *diskUsageBuilderContext) Size() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *diskUsageBuilderContext) Reclaimable() string {
|
func (c *diskUsageBuilderContext) Reclaimable() string {
|
||||||
inUseBytes := int64(0)
|
var inUseBytes int64
|
||||||
for _, bc := range c.buildCache {
|
for _, bc := range c.buildCache {
|
||||||
if bc.InUse {
|
if bc.InUse {
|
||||||
inUseBytes += bc.Size
|
inUseBytes += bc.Size
|
||||||
|
@ -101,6 +101,7 @@ func DetectArchiveReader(input io.ReadCloser) (rc io.ReadCloser, isArchive bool,
|
|||||||
// name specified by DefaultDockerfileName and returns the path to the
|
// name specified by DefaultDockerfileName and returns the path to the
|
||||||
// temporary directory containing the Dockerfile.
|
// temporary directory containing the Dockerfile.
|
||||||
func WriteTempDockerfile(rc io.ReadCloser) (dockerfileDir string, err error) {
|
func WriteTempDockerfile(rc io.ReadCloser) (dockerfileDir string, err error) {
|
||||||
|
// err is a named return value, due to the defer call below.
|
||||||
dockerfileDir, err = ioutil.TempDir("", "docker-build-tempdockerfile-")
|
dockerfileDir, err = ioutil.TempDir("", "docker-build-tempdockerfile-")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", errors.Errorf("unable to create temporary context directory: %v", err)
|
return "", errors.Errorf("unable to create temporary context directory: %v", err)
|
||||||
|
@ -43,8 +43,6 @@ func runBuildBuildKit(dockerCli command.Cli, options buildOptions) error {
|
|||||||
return errors.Errorf("buildkit not supported by daemon")
|
return errors.Errorf("buildkit not supported by daemon")
|
||||||
}
|
}
|
||||||
|
|
||||||
buildID := stringid.GenerateRandomID()
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
remote string
|
remote string
|
||||||
body io.Reader
|
body io.Reader
|
||||||
@ -118,13 +116,6 @@ func runBuildBuildKit(dockerCli command.Cli, options buildOptions) error {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
// statusContext, cancelStatus := context.WithCancel(ctx)
|
|
||||||
// defer cancelStatus()
|
|
||||||
|
|
||||||
// if span := opentracing.SpanFromContext(ctx); span != nil {
|
|
||||||
// statusContext = opentracing.ContextWithSpan(statusContext, span)
|
|
||||||
// }
|
|
||||||
|
|
||||||
s.Allow(authprovider.NewDockerAuthProvider())
|
s.Allow(authprovider.NewDockerAuthProvider())
|
||||||
|
|
||||||
eg, ctx := errgroup.WithContext(ctx)
|
eg, ctx := errgroup.WithContext(ctx)
|
||||||
@ -133,6 +124,7 @@ func runBuildBuildKit(dockerCli command.Cli, options buildOptions) error {
|
|||||||
return s.Run(context.TODO(), dockerCli.Client().DialSession)
|
return s.Run(context.TODO(), dockerCli.Client().DialSession)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
buildID := stringid.GenerateRandomID()
|
||||||
if body != nil {
|
if body != nil {
|
||||||
eg.Go(func() error {
|
eg.Go(func() error {
|
||||||
buildOptions := types.ImageBuildOptions{
|
buildOptions := types.ImageBuildOptions{
|
||||||
@ -233,20 +225,15 @@ func doBuild(ctx context.Context, eg *errgroup.Group, dockerCli command.Cli, opt
|
|||||||
if jerr.Code == 0 {
|
if jerr.Code == 0 {
|
||||||
jerr.Code = 1
|
jerr.Code = 1
|
||||||
}
|
}
|
||||||
// if options.quiet {
|
|
||||||
// fmt.Fprintf(dockerCli.Err(), "%s%s", progBuff, buildBuff)
|
|
||||||
// }
|
|
||||||
return cli.StatusError{Status: jerr.Message, StatusCode: jerr.Code}
|
return cli.StatusError{Status: jerr.Message, StatusCode: jerr.Code}
|
||||||
}
|
}
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
return err
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func resetUIDAndGID(s *fsutil.Stat) bool {
|
func resetUIDAndGID(s *fsutil.Stat) bool {
|
||||||
s.Uid = uint32(0)
|
s.Uid = 0
|
||||||
s.Gid = uint32(0)
|
s.Gid = 0
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,6 +255,7 @@ func (t *tracer) write(msg jsonmessage.JSONMessage) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var dt []byte
|
var dt []byte
|
||||||
|
// ignoring all messages that are not understood
|
||||||
if err := json.Unmarshal(*msg.Aux, &dt); err != nil {
|
if err := json.Unmarshal(*msg.Aux, &dt); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user