-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix buildpacks builder output to go through Event API #6530
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,10 +20,7 @@ import ( | |
"io" | ||
|
||
"github.com/buildpacks/pack/logging" | ||
"github.com/mattn/go-colorable" | ||
"github.com/sirupsen/logrus" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be great to remove the logrus from here and instead add a helper func NewLogger in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could be done as a follow up later. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good idea, I can handle this in a follow up 👍🏼 |
||
|
||
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/util" | ||
) | ||
|
||
// logger exists to meet the requirements of the pack logger. | ||
|
@@ -33,11 +30,6 @@ type logger struct { | |
} | ||
|
||
func NewLogger(out io.Writer) logging.Logger { | ||
// If out is not a terminal, let's make sure no colors are printed. | ||
if _, isTerm := util.IsTerminal(out); !isTerm { | ||
out = colorable.NewNonColorable(out) | ||
} | ||
|
||
l := logrus.New() | ||
l.SetOutput(out) | ||
|
||
|
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.
Would it make sense to plumb through a logger so that we get real log entries, rather than just logrus-formatted output strings on
out
?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.
can you clarify what you mean by "real log entries" here?
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.
Pack uses its own logger implementation. With this change, we're passing in a logrus logger that's configured to write to this provided writer instance, which means we're losing information: the pack logging is being turned into Skaffold output, whereas we could pass the pack logging through as logging entries.
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.
Ah okay, I see what you mean. I'm not completely sure what the best approach for us would be here, as this change seems to be necessary for us to properly get the pack output through the event API stream
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.
this would probably be a good enhancement not just here, but for our other builder/deployers as well that use their own logging implementations. probably out of scope for this change though - can you add a TODO in the
runPackBuild()
function?