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 EventListener Logs Command #1192

Merged
merged 1 commit into from
Oct 7, 2020
Merged

Add EventListener Logs Command #1192

merged 1 commit into from
Oct 7, 2020

Conversation

danielhelfand
Copy link
Member

@danielhelfand danielhelfand commented Sep 29, 2020

Part of #1030

This pull request adds a command for viewing logs of EventListener pods. Follow functionality is outside the scope of this pull request. A tail option is is supported with this command to reduce the amount of most recent log lines a user will see.

Example:

# By default, get 10 most recent log lines from each pod
$ tkn el logs eventListener

[eventListener-podName]: ....

[eventListener-podName2]: ....

[eventListener-podName3]: ....

# Get 3 most recent log lines from each pod
$ tkn el logs eventListener --tail 3

# Get all logs from all pods
$ tkn el logs eventListener --tail -1

Unit testing this feature is difficult since the triggers resources for seed test data doesn't offer the ability to specify pods as part of test data. So I have added e2e testing and will look towards identifying or adding pieces needed for unit testing.

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes tests (if functionality changed/added)
  • Run the code checkers with make check
  • Regenerate the manpages, docs and go formatting with make generated
  • Commit messages follow commit message best practices

Release Notes

Adding tkn eventlistener logs command to view EventListener logs

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Sep 29, 2020
@tekton-robot tekton-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Sep 29, 2020
@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/cmd/eventlistener/logs.go Do not exist 55.8%

@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/cmd/eventlistener/logs.go Do not exist 55.8%

@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/cmd/eventlistener/logs.go Do not exist 55.8%

@danielhelfand danielhelfand changed the title WIP: Add EventListener Logs Command Add EventListener Logs Command Sep 29, 2020
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 29, 2020
@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/cmd/eventlistener/logs.go Do not exist 55.8%

@danielhelfand
Copy link
Member Author

@dibyom Please feel free to review if you have any suggestions.

@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/cmd/eventlistener/logs.go Do not exist 54.2%

@danielhelfand
Copy link
Member Author

/test pull-tekton-cli-integration-tests

@dibyom
Copy link
Member

dibyom commented Sep 30, 2020

Just tried this out, looks great. Thanks @danielhelfand

The only minor nitpick is that using tail -1 for all logs is something I haven't seen before. That being said, not sure if I have any better ideas there (maybe --all-logs?)

/lgtm

@danielhelfand
Copy link
Member Author

The only minor nitpick is that using tail -1 for all logs is something I haven't seen before. That being said, not sure if I have any better ideas there (maybe --all-logs?)

Yeah, that's a good point on the UX of it. I was trying to base this off kubectl's implementation, which uses -1:

k logs deployment/el-github-listener-interceptor --tail -1

However, I think an explicit flag for it sounds better as you point out.

@dibyom
Copy link
Member

dibyom commented Sep 30, 2020

Oh, I didn't realize kubectl uses -1. In that case, maybe we can just stick with that?

@danielhelfand
Copy link
Member Author

So I guess kubectl actually does this:

--tail=-1: Lines of recent log file to display. Defaults to -1 with no selector, showing all log lines otherwise
10, if a selector is provided.

Maybe I can bring up in the working group this week to get some opinions. It seems kubectl by default gives all logs, but I wonder if that would be overwhelming.

@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/cmd/eventlistener/logs.go Do not exist 54.2%

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

@tekton-robot
Copy link
Contributor

@vdemeester: cat image

In response to this:

/meow
/cc @piyush-garg @chmouel

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 5, 2020
@tekton-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: piyush-garg, vdemeester

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [piyush-garg,vdemeester]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@pradeepitm12
Copy link
Contributor

It would be nice if we refactor it like other logs command, but for now, let's get this in.
/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 7, 2020
@tekton-robot tekton-robot merged commit bf3a351 into tektoncd:master Oct 7, 2020
piyush-garg added a commit that referenced this pull request Oct 21, 2020
#1194 | [Daniel Helfand] update README to v0.13.0 | 2020/09/30-22:18
#1196 | [Chmouel Boudjnah] Update OSX instruction to install from brew 🍻 | 2020/10/02-11:36
#1197 | [Daniel Helfand] reorganize release process docs and add details | 2020/10/07-07:26
#1192 | [Daniel Helfand] add eventlistener logs command | 2020/10/07-08:00
#1198 | [Matt Moore] Bump Knative/K8s dependencies | 2020/10/08-00:34
#1201 | [Daniel Helfand] avoid use of previous TaskRunSpecStatus and PipelineRunSpecStatus | 2020/10/13-17:32
#1205 | [Daniel Helfand] remove assertions to help with debugging eventlistener e2e failures | 2020/10/20-07:27
#1207 | [Piyush Garg] tkn pr describe failing in pr with conditions | 2020/10/20-08:57
#1189 | [Daniel Helfand] refactor pipelinerun and taskrun cancel err based on condition status | 2020/10/20-09:15
#1189 | [Daniel Helfand] add pipelinerun and taskrun cancel e2e tests | 2020/10/20-09:15
null | [Daniel Helfand] common way of referring to tekton resources in user facing messages: EventListener | 2020/10/21-07:21
null | [Daniel Helfand] common way of referring to tekton resources in user facing messages: TriggerBinding | 2020/10/21-08:00

Signed-off-by: Piyush Garg <pgarg@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants