-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Adjust PipelineRun's StartTime based on TaskRun state. #3461
Conversation
Occasionally, it is possible for us to be reconciling a PipelineRun and have the status we intend to report reflect an inaccurate StartTime (see issue for details). This corrects for those circumstances by ensuring that the StartTime we report for a PipelineRun is never later than the smallest CreationTimestamp of a child TaskRun. Fixes: tektoncd#3460
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.
Does this need a test?
@@ -71,6 +72,23 @@ func (state PipelineRunState) IsBeforeFirstTaskRun() bool { | |||
return true | |||
} | |||
|
|||
// AdjustStartTime adjusts potential drift in the PipelineRun's start time. |
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.
In addition to stating why we do this, can you add a sentence describing how we adjust, to make this easier to read?
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.
tweaked wording, PTAL 🙏
yes please, a test would be great. Does the same bug apply to |
I pushed unit tests for AdjustStartTime.
@pritidesai I haven't looked at the TaskRun StartTime logic. In principle it could similarly benefit from rationalizing its StartTime with the |
wow that was quick @mattmoor 🙏 So pipeline/pkg/apis/pipeline/v1beta1/taskrun_types.go Lines 245 to 259 in 51a02c8
pipeline/pkg/reconciler/taskrun/taskrun.go Lines 92 to 99 in adc4cfa
which means, we might not see this bug in |
@pritidesai that same logic is in PipelineRun (the initialization and clamping to its own creation timestamp), but the question is what outside resources we'd want to clamp the StartTime on. Maybe the Pod? |
yup I noticed |
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 @mattmoor
I was thinking of moving updating pr.Status
to a separate function for readability, we have many different status
fields being updated here, will create a refactoring PR.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: pritidesai 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 |
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
Rather, step start time 🤔 |
Changes
Occasionally, it is possible for us to be reconciling a PipelineRun and have the
status we intend to report reflect an inaccurate StartTime (see issue for
details). This corrects for those circumstances by ensuring that the StartTime
we report for a PipelineRun is never later than the smallest CreationTimestamp
of a child TaskRun.
Fixes: #3460
/kind bug
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
See the contribution guide for more details.
Double check this list of stuff that's easy to miss:
cmd
dir, please updatethe release Task to build and release this image.
Reviewer Notes
If API changes are included, additive changes must be approved by at least two OWNERS and backwards incompatible changes must be approved by more than 50% of the OWNERS, and they must first be added in a backwards compatible way.
Release Notes