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

Add --tail flag to stream logs with skaffold run #914

Merged
merged 3 commits into from
Aug 23, 2018

Conversation

priyawadhwa
Copy link
Contributor

Shoulf fix #253. Adds option to stream logs from objects deployed by
skaffold run.

Shoulf fix GoogleContainerTools#253. Adds option to stream logs from objects deployed by
skaffold run.
@codecov-io
Copy link

codecov-io commented Aug 21, 2018

Codecov Report

Merging #914 into master will increase coverage by 0.02%.
The diff coverage is 7.14%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #914      +/-   ##
==========================================
+ Coverage   39.01%   39.04%   +0.02%     
==========================================
  Files          60       61       +1     
  Lines        2609     2638      +29     
==========================================
+ Hits         1018     1030      +12     
- Misses       1478     1495      +17     
  Partials      113      113
Impacted Files Coverage Δ
pkg/skaffold/config/options.go 100% <ø> (ø) ⬆️
cmd/skaffold/app/cmd/deploy.go 0% <0%> (ø) ⬆️
cmd/skaffold/app/cmd/run.go 0% <0%> (ø) ⬆️
cmd/skaffold/app/cmd/cmd.go 0% <0%> (ø) ⬆️
pkg/skaffold/runner/runner.go 54.59% <20%> (-2.72%) ⬇️
cmd/skaffold/app/cmd/dev.go 0% <0%> (ø) ⬆️
cmd/skaffold/app/cmd/signals.go 100% <0%> (ø)

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 6581755...2f8d27a. Read the comment docs.

Copy link
Contributor

@dgageot dgageot left a comment

Choose a reason for hiding this comment

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

A few questions. Other than that, it looks great!

return errors.Wrap(err, "starting logger")
}

for {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be replaced by just <-ctx.Done()?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, should we setup the signal handling to handle ctrl-c properly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yah good point, I'll replace it with <-ctx.Done()

For handling ctrl-c, I wasn't sure what the benefit of setting it up would be since there isn't any cleanup that needs to happen, the log stream just needs to end.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, same for me. I think it's cleaner but I have no idea if it's really better

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can add the ctrl-c handler to every command in another PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good!

@@ -35,6 +35,7 @@ func NewCmdRun(out io.Writer) *cobra.Command {
},
}
AddRunDevFlags(cmd)
AddRunFlags(cmd)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think also adding the flag to skaffold deploy would make sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yah I think that makes sense, I can add it there as well

@@ -172,6 +172,21 @@ func (r *SkaffoldRunner) Run(ctx context.Context, out io.Writer, artifacts []*v1
return errors.Wrap(err, "deploy step")
}

if !r.opts.Tail {
Copy link
Contributor

Choose a reason for hiding this comment

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

@priyawadhwa do you think the duplication could be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about moving it into a separate function, but I think four things would have to be passed in, so it would look like:

func StreamLogsFromDeployedObjects(ctx context.Context, out io.Writer, builds []build.Artifact, artifacts []*v1alpha2.Artifact)

and I personally didn't think that was much cleaner, but I don't have a strong opinion so can definitely move it into a function if you prefer that!

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's merge this one any think about how to remove the duplication afterwards!

@r2d4
Copy link
Contributor

r2d4 commented Aug 22, 2018

Looks like kokoro failed downloading gcloud

ERROR: (gcloud.components.install) The component [beta] failed to download.
<urlopen error timed out>
[ID: 2171690] Build finished after 73 secs, exit value: 1
Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
[11:52:34] Collecting build artifacts from build VMBuild script failed with exit code: 1

rebuilding

@dgageot dgageot merged commit 80a04db into GoogleContainerTools:master Aug 23, 2018
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.

Can we see the logs of a deployment when not in dev mode
4 participants