Skip to content
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

Merged
merged 1 commit into from
Aug 31, 2021

Conversation

MarlonGamez
Copy link
Contributor

@MarlonGamez MarlonGamez commented Aug 26, 2021

Fixes: #6541

Description
The output we were sending to buildpacks client was stripped from our output.SkaffoldWriter type, when we really do want to use that type. This PR fixes that. We should now see output from buildpacks builder in the Event API.

I've removed the check for terminal on the io.Writer as well because this already happens at the beginning of execution.

@MarlonGamez MarlonGamez requested a review from a team as a code owner August 26, 2021 23:41
@google-cla google-cla bot added the cla: yes label Aug 26, 2021
@codecov
Copy link

codecov bot commented Aug 26, 2021

Codecov Report

Merging #6530 (63c7a2d) into main (7aff46a) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6530      +/-   ##
==========================================
- Coverage   70.44%   70.43%   -0.01%     
==========================================
  Files         515      515              
  Lines       23144    23142       -2     
==========================================
- Hits        16303    16300       -3     
- Misses       5783     5784       +1     
  Partials     1058     1058              
Impacted Files Coverage Δ
pkg/skaffold/build/buildpacks/logger.go 0.00% <ø> (ø)
pkg/skaffold/build/buildpacks/lifecycle.go 83.59% <100.00%> (ø)
pkg/skaffold/log/stream/stream.go 71.42% <0.00%> (-14.29%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7aff46a...63c7a2d. Read the comment docs.

@@ -20,10 +20,7 @@ import (
"io"

"github.com/buildpacks/pack/logging"
"github.com/mattn/go-colorable"
"github.com/sirupsen/logrus"
Copy link
Contributor

Choose a reason for hiding this comment

The 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 output.Log.
Removing dependency on logger here will make the custom lint analyzer ignore list simpler.
See here https://github.com/GoogleContainerTools/skaffold/pull/6357/files#diff-82c7b02016fd4c13ff671a6b3c038aacdb4ed7aa4ec92871709e1c6bbaebe8d0R32

Copy link
Contributor

Choose a reason for hiding this comment

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

Could be done as a follow up later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good idea, I can handle this in a follow up 👍🏼

@@ -97,7 +96,7 @@ func (b *Builder) build(ctx context.Context, out io.Writer, a *latestV1.Artifact

builderImage, runImage, pullPolicy := resolveDependencyImages(artifact, b.artifacts, a.Dependencies, b.pushImages)

if err := runPackBuildFunc(ctx, output.GetUnderlyingWriter(out), b.localDocker, pack.BuildOptions{
if err := runPackBuildFunc(ctx, out, b.localDocker, pack.BuildOptions{
Copy link
Member

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?

Copy link
Contributor Author

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?

Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Contributor

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?

@@ -97,7 +96,7 @@ func (b *Builder) build(ctx context.Context, out io.Writer, a *latestV1.Artifact

builderImage, runImage, pullPolicy := resolveDependencyImages(artifact, b.artifacts, a.Dependencies, b.pushImages)

if err := runPackBuildFunc(ctx, output.GetUnderlyingWriter(out), b.localDocker, pack.BuildOptions{
if err := runPackBuildFunc(ctx, out, b.localDocker, pack.BuildOptions{
Copy link
Contributor

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?

@MarlonGamez
Copy link
Contributor Author

@nkubala I believe buildpacks builder is the only builder/deployer that has this issue, so we should be good from here

@MarlonGamez MarlonGamez merged commit 76cee85 into GoogleContainerTools:main Aug 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Buildpacks builder output isn't sent through gRPC/HTTP API
4 participants