-
Notifications
You must be signed in to change notification settings - Fork 222
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
[TEP-0100] Update to handle PipelineTask condition checks and when expressions #645
[TEP-0100] Update to handle PipelineTask condition checks and when expressions #645
Conversation
50d8d22
to
c38ad09
Compare
} | ||
``` | ||
|
||
Additionally, we will add a new struct `PipelineRunChildReferenceConditionCheckStatus` |
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.
I'm a bit confused by this, can't we reuse the existing PipelineRunConditionCheckStatus
struct?
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.
Because PipelineRunConditionCheckStatus
doesn't have the ConditionCheckName
as a field - it's currently just used in a map of ConditionCheckName
to PipelineRunConditionCheckStatus
, so we need to add a field to it, basically, unless we wanted to use a map instead of an array.
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.
Aaaah - we could just use PipelineRunConditionCheckStatus
and add a new ConditionCheckName
field to it, leaving it as the empty string when it's being used in the old fully-embedded form.
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.
It already has ConditionName, is that different from ConditionCheckName
?
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.
It is! ConditionCheckName
is to a PipelineTask
name as ConditionName
is to a Task
name, basically.
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.
got it-- I think I'd prefer something like:
type PipelineRunChildConditionCheckStatus {
ConditionCheckName string
PipelineRunConditionCheckStatus
}
with ChildStatus:
type ChildStatus struct {
...
ConditionChecks []PipelineRunChildConditionCheckStatus
}
and a note that the ConditionChecks
field will be removed when support for Conditions is removed.
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.
Ok, that was what I was doing initially. =)
@@ -221,13 +221,28 @@ identify related objects. | |||
|
|||
#### 1. Add Minimal Embedded Status | |||
|
|||
We will introduce a new struct to hold references to child `TaskRuns` and `Runs`: | |||
We will introduce a new struct to hold references to child `TaskRuns` and `Runs`, and | |||
their corresponding `WhenExpressions` and `ConditionChecks`: |
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.
a few quick comments:
- could you please make it clear that
whenexpressions
andconditionchecks
are already present inPipelineRunTaskRunStatus
? - Runs don't currently have
conditionChecks
; I'm guessing this is becausePipelineRunRunStatus
was created after conditions were deprecated. Becauseconditions
are deprecated, we may be able to removeconditionchecks
fromchildReference
if we do it in the correct order. see Deprecate Conditions CRD pipeline#3377. - with the inclusion of "whenexpressions" the childReference is back to being a "childStatus".
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.
1: Will do!
2: Yeah, that's what I assumed was the case. I guess we could say "if you're using minimal
for embedded-status
, you shouldn't be using conditions
, since that's going away before full
embedded-status
goes away"?
3: Yeah, in my work-in-progress, I'm actually calling the struct ChildStatusReference
- it's got some status in it alongside the reference.
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.
sounds good! I think we might have to include conditionChecks
in the minimal status for v1beta1 only, making a note that they will be removed when support for Conditions
is removed. This can just be empty for runs.
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.
👍
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.
Oh, and in my work-in-progress branch (which I'll be opening as a WIP implementation PR to pipeline after this PR gets merged), it's already not doing anything with Conditions
for Run
s. I'll mark the field as deprecated as well.
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.
Aaaaand PR is updated!
|
||
```go | ||
type PipelineRunChildConditionCheckStatus struct { | ||
*PipelineRunConditionCheckStatus `json:",inline"` // the inlined condition check status |
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.
nit: I don't think this needs to be a pointer. also please link to the issue on deprecating conditions
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.
aaaaah - ok, since PipelineRunConditionCheckStatus
was always used as a pointer, I just assumed I should keep doing that here. =) Easy enough to fix!
LGTM! (I have no powers here :( ) |
9a5a106
to
b3da905
Compare
Squashed - I tend to wait to squash til I've addressed a round of reviews. =) |
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 @abayer for the updates!
Please feel free to add yourself as an author!
I am seeing this status for the first time 😉 , we support proposed
, implementable
, implemented
, withdraw
, and replaced
:
Conditions
will be gone from v1
API and so as this new addition to the ChildStatusReference
but its necessary to add right now in beta
API.
/wip Putting this on hold for a bit - I think it's also missing some sort of trivial way to quickly see the status of a |
Its great we are discovering these findings at the implementation phase. Please feel free to propose any simplifications that you think might fit better 🙏 |
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 proposing these changes @abayer! I wonder if we really need to add the condition
and when
expressions though given the motivation of the TEP to make the status minimal?
- the
conditions
have been deprecated for a long time as discussed above, so I'd prefer we don't support them in the minimal status (we can document that they are not supported, and encourage users to migrate towhen
expressions to use the minimal status) - the
when
expressions are already in thepipeline
spec in thepipelinerun
status and all variables used (e.g.params
,results
) are available in thepipelinerun
,taskrun
orrun
statuses - we previously added them for convenience to users but in the spirit of keeping the status minimal, maybe we shouldn't duplicate this information in the minimal status?
@jerop Ah, for whatever reason, I just assumed the status of the when expressions was in there too. But if it's just duplicating the configuration of the when expressions, it's definitely not needed. And if there's a consensus around not including conditions in the minimal status, I'm completely fine with that too. Lemme think on that a little bit to be sure. =) |
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.
@abayer - that's right, we'd be duplicating the when
expressions but with resolved values, however we discussed at the pipeline working group on 03/08 (notes) and decided that while it's duplicated information, it provides a huge inconvenience to see when
expressions with the params
, results
, and other variables replaced
for conditions
, we agreed in the same meeting to only have child references to the taskruns
of the conditions
instead of the full status (similar to other taskruns
) - this looks like the only change that needs to be made to the TEP and should be good to go
thank you again for all your help here @abayer 😀
To support `ConditionChecks`, we will add a new struct `PipelineRunChildConditionCheckStatus` | ||
which will hold the names and statuses of condition checks for the `PipelineTask`. It | ||
will inline the `PipelineRunConditionCheckStatus` currently used in the full embedded | ||
statuses. This is needed because `PipelineRunConditionCheckStatus` doesn't contain | ||
the `ConditionCheckName`, which is the equivalent of a `PipelineTask`'s name, just | ||
`ConditionName`, which is the equivalent of a `TaskRun` or `Run`'s name. Since we're | ||
going to store an array of `PipelineRunChildConditionCheckStatus` rather than a map of | ||
`ConditionCheckName` to `PipelineRunConditionCheckStatus`, we need the `ConditionCheckName` | ||
in the new struct. |
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.
given that conditionchecks are taskruns, can we have childreferences to them instead of the whole status, the same way we'll be doing it for taskruns?
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.
I don't think we're storing the ConditionCheckStatus
's contents anywhere else - ConditionCheckStatus
is much simpler than TaskRunStatus
. It's just a duckv1beta1.Status
, PodName
, StartTime
, CompletionTime
, and an optional corev1.ContainerState
, vs TaskRunStatus
's embedded RetriesStatus
, Steps
, CloudEvents
, ResourceResults
, TaskRunResults
, Sidecars
, and TaskSpec
. I'll dig to see if we've got the ConditionCheckStatus
anywhere we can reference to, but if not, I think it's ok to just leave it as is. Particularly since we'll be removing conditions
in general at some point in the not-too-distant-future.
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.
Yeah, verified - ConditionCheckStatus
is only here. I guess we could reference the actual TaskRun
behind the scenes, but this seems minimal enough to not be worth the bother to me.
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.
good point that we're removing it soon after all and hopefully not many people are using it 👍🏾
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.
Aaaah, wait, this can just be a reference to the underlying ConditionName
and ConditionCheckName
with the condition check step name from within the TaskRun
, I think. I forgot that conditions
aren't separate TaskRun
s!
Since this will be stored inside the child reference for the relevant TaskRun
(meaning it's already got the information needed to look up the TaskRun
's status), we already have the duckv1beta.Status
, PodName
, StartTime
, and CompletionTime
which are used in the ConditionCheckStatus
available. Then adding the condition check step name to the ConditionName
and ConditionCheckName
is enough to get the container state for the condition check step from the TaskRun
's status.
Now I just need to figure out if we even need to specify the condition check step name - feels like that probably is one of ConditionName
or ConditionCheckName
- I can never remember which of those is which. =)
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.
Ok, I've reconsidered - while that's almost certainly a viable option, it's more work than feels worthwhile for something that's not going to be relevant for that much longer anyway, so I am going with the full ConditionCheckStatus
approach.
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 again @abayer!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jerop, 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 |
/assign @jerop |
title: Embedded TaskRuns and Runs Status in PipelineRuns | ||
creation-date: '2022-01-24' | ||
last-updated: '2022-02-14' | ||
last-updated: '2022-03-03' | ||
authors: | ||
- '@lbernick' | ||
- '@jerop' |
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.
@abayer please add yourself as an author 🙏🏾
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.
Done!
b3da905
to
e05e05b
Compare
…pressions With the current, full embedded status for `TaskRun`s and `Run`s, we include `ConditionChecks` and `WhenExpressions` fields as well as the `TaskRun`/`Run`'s status. The minimal embedded status approach as initially written does fine for anything that's available within the `TaskRun`/`Run` statuses, but `ConditionChecks` and `WhenExpressions` are not actually known by the `TaskRun`/`Run`. They're only known at the full `PipelineRun` level. In order to make that information available for reporting, etc in the new minimal embedded status approach, we will need to store `ConditionChecks` and `WhenExpressions` along with the kind/version/`TaskRun` or `Run` name/`PipelineTask` name. This also moves the TEP to `implementing` and updates its `last-updated`. Signed-off-by: Andrew Bayer <[email protected]>
e05e05b
to
db481a4
Compare
So what more do we need to merge this? |
I'll bring this up at today's WG-- this can probably be merged then! |
/kind tep |
Merged during the API WG /lgtm |
With the current, full embedded status for
TaskRun
s andRun
s, we includeConditionChecks
andWhenExpressions
fields as well as theTaskRun
/Run
's status. The minimal embedded status approach as initially written does fine for anything that's available within theTaskRun
/Run
statuses, butConditionChecks
andWhenExpressions
are not actually known by theTaskRun
/Run
. They're only known at the fullPipelineRun
level. In order to make that information available for reporting, etc in the new minimal embedded status approach, we will need to storeConditionChecks
andWhenExpressions
along with the kind/version/TaskRun
orRun
name/PipelineTask
name.cc @jerop @lbernick - not sure who else should review this?
Signed-off-by: Andrew Bayer [email protected]