Skip to content

Conversation

crazy-max
Copy link
Member

@crazy-max crazy-max commented Dec 9, 2022

follow-up docker/buildx#1177 (comment)

$ docker buildx build .
[+] Building 4.8s (11/16)                                                               docker-container:builder2
 => [internal] load build definition from Dockerfile                                                         0.1s
 => => transferring dockerfile: 2.93kB                                                                       0.1s 
 => [internal] load .dockerignore                                                                            0.1s 
 => => transferring context: 45B                                                                             0.1s 
 => resolve image config for docker.io/docker/dockerfile-upstream:1.5.0                                      0.6s
 => CACHED docker-image://docker.io/docker/dockerfile-upstream:1.5.0@sha256:bda6ac9f61f2b676331acfd656a07bc  0.0s
 => => resolve docker.io/docker/dockerfile-upstream:1.5.0@sha256:bda6ac9f61f2b676331acfd656a07bcd55b369143a  0.0s 
 => [internal] load metadata for docker.io/tonistiigi/xx:1.1.2                                               2.4s 
 => [internal] load metadata for docker.io/library/golang:1.19-alpine                                        2.4s 
 => [auth] library/golang:pull token for registry-1.docker.io                                                0.0s
 => [auth] tonistiigi/xx:pull token for registry-1.docker.io                                                 0.0s
 => [xx 1/1] FROM docker.io/tonistiigi/xx:1.1.2@sha256:9dde7edeb9e4a957ce78be9f8c0fbabe0129bf5126933cd35748  0.0s
 => => resolve docker.io/tonistiigi/xx:1.1.2@sha256:9dde7edeb9e4a957ce78be9f8c0fbabe0129bf5126933cd3574888f  0.0s 
 => CANCELED [internal] load build context                                                                   1.5s 
 => => transferring context: 20.57kB                                                                         1.5s 
 => [golatest 1/1] FROM docker.io/library/golang:1.19-alpine@sha256:2381c1e5f8350a901597d633b2e517775eeac7a  0.1s 
 => => resolve docker.io/library/golang:1.19-alpine@sha256:2381c1e5f8350a901597d633b2e517775eeac7a6682be392  0.0s 
ERROR: failed to solve: Canceled: context canceled
$ BUILDKIT_PROGRESS=plain docker buildx build .
#0 building with "builder2" instance using docker-container driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 2.93kB 0.0s done
#1 DONE 0.1s

#2 [internal] load .dockerignore
#2 transferring context: 45B 0.0s done
#2 DONE 0.1s

#3 resolve image config for docker.io/docker/dockerfile-upstream:1.5.0
#3 DONE 0.7s

#4 docker-image://docker.io/docker/dockerfile-upstream:1.5.0@sha256:bda6ac9f61f2b676331acfd656a07bcd55b369143ab7db66bdf93b619da3e183
#4 resolve docker.io/docker/dockerfile-upstream:1.5.0@sha256:bda6ac9f61f2b676331acfd656a07bcd55b369143ab7db66bdf93b619da3e183
#4 resolve docker.io/docker/dockerfile-upstream:1.5.0@sha256:bda6ac9f61f2b676331acfd656a07bcd55b369143ab7db66bdf93b619da3e183 0.0s done
#4 CACHED

#5 [internal] load metadata for docker.io/library/golang:1.19-alpine
^C#5 CANCELED

#6 [internal] load metadata for docker.io/tonistiigi/xx:1.1.2
#6 CANCELED
ERROR: failed to solve: Canceled: context canceled

Signed-off-by: CrazyMax crazy-max@users.noreply.github.com

@@ -63,6 +64,9 @@ func (p *textMux) printVtx(t *trace, dgst digest.Digest) {
if p.notFirst {
fmt.Fprintln(p.w, "")
} else {
if p.desc != "" {
fmt.Fprintf(p.w, "#0 %s\n\n", p.desc)
Copy link
Member

@jedevc jedevc Dec 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there we could right-align the p.desc text?

So instead of:

$ docker buildx build .
[+] Building 2.6s (9/14)                                        docker-container:builder2
 => [internal] load build definition from Dockerfile            0.1s
 => => transferring dockerfile: 2.85kB                          0.1s 
 => [internal] load .dockerignore                               0.1s 
 => => transferring context: 45B                                0.1s 
 => resolve image config for docker.io/docker/dockerfile:1.4    0.4s

we could have:

$ docker buildx build .
[+] Building 2.6s (9/14)                   docker-container:builder2
 => [internal] load build definition from Dockerfile            0.1s
 => => transferring dockerfile: 2.85kB                          0.1s 
 => [internal] load .dockerignore                               0.1s 
 => => transferring context: 45B                                0.1s 
 => resolve image config for docker.io/docker/dockerfile:1.4    0.4s

Not sure, but ideally we should have the timing counts at the very end of the line.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it currently more readable imo. WDYT @tonistiigi?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wastes too much space without being aligned to the right.

In progress=plain I think this is more like a debug log.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes in console mode indeed it's not that great after all.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now aligned to the right in console mode (see updated PR description).

@@ -21,11 +21,16 @@ import (
"golang.org/x/time/rate"
)

func DisplaySolveStatus(ctx context.Context, phase string, c console.Console, w io.Writer, ch chan *client.SolveStatus) ([]client.VertexWarning, error) {
func DisplaySolveStatus(ctx context.Context, phase string, fndesc func() (string, string), c console.Console, w io.Writer, ch chan *client.SolveStatus) ([]client.VertexWarning, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: since this is a public function, can we create a public type for this?

Is there a reason this is a function btw, instead of just a struct pointer?

Copy link
Member Author

@crazy-max crazy-max Feb 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switched to variadic opt

Is there a reason this is a function btw, instead of just a struct pointer?

Easier to handle when it needs inline logic: https://github.com/docker/buildx/pull/1177/files#diff-3f9c21dce82a82fae6d5ca096e77e5ddcf0eccd7051f815b452ec26fbfeb314bR114-R123 but maybe a struct would be enough

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variadic opt looks good to me 👍

I think it would still be good to use a struct instead, since we always call that function anyways (so it's not saving an expensive operation or similar), and there are no parameters passed from inside DisplaySolveStatus.

@crazy-max crazy-max force-pushed the progress-desc branch 4 times, most recently from 2c62475 to 9ad7608 Compare February 13, 2023 14:43
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
@crazy-max crazy-max merged commit 46e4e7e into moby:master Feb 16, 2023
@crazy-max crazy-max deleted the progress-desc branch February 16, 2023 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants