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

Refactoring log reader. #749

Merged
merged 1 commit into from
Feb 26, 2020

Conversation

16yuki0702
Copy link
Member

Related issue is #748

taskrun's logreader and pipelinerun's logreader has a few same logic.
moving these code into same package.

and remove reference from pkg/helper/taskrun/taskrun.go to cmd package.

Changes

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

See the contribution guide
for more details.

Release Notes

release-note

@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 21, 2020
int(taskNum), lr.Follow, lr.AllSteps)
pipeLogs(logC, errC, tlr)
// clone the object to keep task number and name separately
c := r.clone()
Copy link
Member Author

Choose a reason for hiding this comment

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

By this the reference from pkg/helper/taskrun to pkg/cmd/taskrun package can be deleted.

// Check if taskrun failed on start up
if err := hasTaskRunFailed(tr.Status.Conditions, r.task); err != nil {
if r.stream != nil {
fmt.Fprintf(r.stream.Err, "%s\n", err.Error())
}
return nil, nil, err
Copy link
Member Author

@16yuki0702 16yuki0702 Feb 21, 2020

Choose a reason for hiding this comment

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

Isn't failed pod log shown again without -f flag 🤔 ?
(because return at this point before readStepsLogs)

following code is correct 🤔 ?

if r.stream != nil {
	fmt.Fprintf(r.stream.Err, "%s\n", err.Error())
} else {
	return nil, nil, err
}

Copy link
Member

Choose a reason for hiding this comment

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

Yes, that was something that was overlooked on my part in #721. I think adding the else block makes sense.

Overall, we need to clean up error messaging in logs/have better testing around this. Maybe even an e2e scenario.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that was something that was overlooked on my part in #721. I think adding the else block makes sense.

Oh, Thanks !!
I'll add else block in this PR for now 👍

Overall, we need to clean up error messaging in logs/have better testing around this. Maybe even an e2e scenario.

+1

related issue is tektoncd#748

taskrun's logreader and pipelinerun's logreader has a few same logic.
It is useful and readable moving these code into same package.
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.

/meow

@tekton-robot
Copy link
Contributor

@vdemeester: cat image

In response to this:

/meow

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 Feb 24, 2020
}

//Sort taskruns, to display the taskrun logs as per pipeline tasks order
// Sort taskruns, to display the taskrun logs as per pipeline tasks order
Copy link
Member

@danielhelfand danielhelfand Feb 24, 2020

Choose a reason for hiding this comment

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

We need to do sorting for readLivePipelineLogs too? This looks like a bug that hasn't been reported.

Copy link
Member Author

Choose a reason for hiding this comment

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

Because readLivePipelineLogs get logs asynchronous in concurrent goroutine.
Logs are displayed in order from the started pod and this timing is uncontrollable.
if we sort order in readLivePipelineLogs we need to wait until all task pods will start.
(But it maybe lack of real time... tradeoff...🤔)

Copy link
Member Author

@16yuki0702 16yuki0702 Feb 25, 2020

Choose a reason for hiding this comment

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

Ahh... sorry, please let me considering it.
there is possibility I misunderstanding it, sorry 😅

Copy link
Member

Choose a reason for hiding this comment

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

I follow what you're saying, and that was my thought here too as far as having to wait for all TaskRuns. I figured I would ask to make sure but no worries if this is something out of the scope of this pr. We can always iterate on it if there isn't a clear solution here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I follow what you're saying, and that was my thought here too as far as having to wait for all TaskRuns. I figured I would ask to make sure but no worries if this is something out of the scope of this pr. We can always iterate on it if there isn't a clear solution here.

Thank you very much !!
yes, it seems be better addressing this on another PR 🙏

Copy link
Member

@danielhelfand danielhelfand left a comment

Choose a reason for hiding this comment

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

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 26, 2020
@tekton-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: danielhelfand, 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 [danielhelfand,vdemeester]

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

@tekton-robot tekton-robot merged commit 6cf4219 into tektoncd:master Feb 26, 2020
@16yuki0702 16yuki0702 deleted the refactoring_log_reader branch February 27, 2020 02:42
This was referenced Feb 27, 2020
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. cla: yes lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants