slim
slim copied to clipboard
Console output as json with a flag to control when the console output is free form text and when it's json
Need to have a global flag to control the console output mode (--json-output or something like that).
@kcq Could I take a stab at this?
Go for it @loganshamberger :) Let me know if you'd like to do a code walk through to learn about the execution context used for I/O and other things.
@kcq I think that would be helpful. I've pulled it down and am just trying to get the code built and run to start.
@kcq hey , is someone still working on this?
still open and still TBD :)
Hi @kcq is someone still working on it?
@akankshakumari393 are you interested in contributing this enhancement :)
@kcq yeah I am interested.
@kcq yeah I am interested.
Let's chat then :)
hey @kcq, I am new to it, could you please suggest me where do we start with?
@akankshakumari393 when are you online? I can give you an overview.
A few notes to get you started in the meantime...
The docker-slim I/O happens using the ExecutionContext construct ( https://github.com/docker-slim/docker-slim/blob/master/pkg/app/execontext.go ). TheExecutionContext.Output.Info(), ExecutionContext.Output.State(), ExecutionContext.Output.Message() and ExecutionContext.Output.Error() calls are responsible for the actual console output and that's where we need to conditionally print using the standard formatting or json.
The docker-slim commands are here and that's where the ExecutionContext struct is used for I/O: https://github.com/docker-slim/docker-slim/tree/master/pkg/app/master/commands
Example:
xc.Out.Info("params",
ovars{
"target.type": "image",
"target": targetRef,
"continue.mode": continueAfter.Mode,
"rt.as.user": doRunTargetAsUser,
"keep.perms": doKeepPerms,
"tags": strings.Join(outputTags, ","),
})
https://github.com/docker-slim/docker-slim/blob/master/pkg/app/master/commands/build/handler.go#L255
Also a couple of videos to watch:
https://www.youtube.com/watch?v=Y60g3Jz2Fg8&t=14s https://www.youtube.com/watch?v=ioIG-oPg0pA&t=60s
Hey thanks, I will go through these references and will let you know in case I have any doubt. we can then discuss.
@kcq How is the globalflag --log-format different from the json-output that we are gonna add?
The log-format flag is for the logging data output. The standard app output data is different from the logging data, which is usually disabled and you enable it when you need additional debugging information. Both end up being printed to the screen, but they are independent of each other.
@akankshakumari393 let me know if you want to do an online session next week to go over the enhancements
@kcq I won't be available this week. I would be good if we can schedule it to next week.