-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add JSON stream progress writer #11478
Conversation
73e9f16
to
3fec17c
Compare
I still need to run |
3fec17c
to
dea886c
Compare
Docs are updated, CI passes (checked in felixfontein#1), but while testing this (now that I was actually able to build this) I noticed that Docker Compose apparently expects Docker Buildx and Docker CLI itself to also have a JSON progress writer. I'm getting |
I eventually noticed that in case of errors, the error is always printed regularly and not via the progress API. I added code in d3b85f9 that in case |
d3b85f9
to
15d3343
Compare
This is now ready for review. |
150e636
to
07a29dd
Compare
It probably makes sense to set logging to JSON ( |
cmd/compose/build.go
Outdated
@@ -67,10 +67,15 @@ func (opts buildOptions) toAPIBuildOptions(services []string) (api.BuildOptions, | |||
builderName = os.Getenv("BUILDX_BUILDER") | |||
} | |||
|
|||
// The build backends do not have a "json" progress; use "plain" instead |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use rawjson
so buildkit will render raw json solver events and you get a clean json stream for all events
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created moby/buildkit#4769 since I think it would be better if the rawjson
output would write one JSON object per line, instead of using multiple lines to show a more human-readable JSON record (that's not really that human readable anyway).
c5266d4
to
2f78203
Compare
Signed-off-by: Felix Fontein <[email protected]>
Signed-off-by: Felix Fontein <[email protected]>
Signed-off-by: Felix Fontein <[email protected]>
Signed-off-by: Felix Fontein <[email protected]>
Signed-off-by: Felix Fontein <[email protected]>
2f78203
to
2245943
Compare
@ndeloof can you take another look at this? Thanks! |
Can you please squash your commits and rebase, I'll enable auto-merge on this PR |
@ndeloof thanks a lot for reviewing and merging! Since you rebase-merged I assume I don't need to rebase/squash this anymore :) |
auto-merge applied before squash, never mind |
What I did
I added a JSON stream progress writer. This allows to write machine readable output to stderr, which makes it a lot easier to use Docker Compose from other tools, like Ansible.
Related issue
Fixes #10872.
(not mandatory) A picture of a cute animal, if possible in relation to what you did