-
Notifications
You must be signed in to change notification settings - Fork 265
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
Check for the wrong start date #3092
Conversation
Hi @jisoolee. Thanks for your PR. I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
/kind bug |
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.
Thanks for the PR @jisoolee. I've left a suggestion for a change to make sure handles some other possible bad input.
const wrongDateChecker = new Date(startTime).getTime() | ||
|
||
if (!startTime || !endTime || wrongDateChecker == 0) { |
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.
If the startTime is either an empty string ''
or undefined
this will not give the expected result.
new Date('')
and new Date(undefined)
both result in an 'Invalid Date' object, and the call to getTime()
will return NaN
instead of 0.
Since this is a relatively simple expression we can just inline it in the if-statement after we've already checked that startTime
is truthy so we know it won't hit these cases.
const wrongDateChecker = new Date(startTime).getTime() | |
if (!startTime || !endTime || wrongDateChecker == 0) { | |
if (!startTime || !endTime || new Date(startTime).getTime() == 0) { |
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.
Thank you @AlanGreene for the suggestion and catching that. I did not think about those cases.
I applied the change.
Add wrongDateChecker to catch the wrong start date which is causing the wrong duration for PipelineRuns and TaskRuns
ea4df10
to
39a9de2
Compare
/ok-to-test |
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AlanGreene 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:
Approvers can indicate their approval by writing |
Add wrongDateChecker to catch the wrong start date which is causing the wrong duration for PipelineRuns and TaskRuns
Changes
This will prevent to show the wrong duration for the users.
Related issue: https://github.ibm.com/one-pipeline/adoption-issues/issues/1374
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
functionality, content, code)
/kind <type>
. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes