-
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
Sync the pipelinerun status from the informers #2573
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@afrittoli
pr.Status.TaskRuns
holds an entry for thepipelineTask
associated to a condition (could be more than one condition as well) with nilTaskRunStatus
and one or more checks underConditionChecks
as inpr.Status.TaskRuns[PipelineTaskRunName].ConditionChecks
.Condition containers are always under
ConditionChecks
and not part of the map pr.Status.TaskRuns.For example, for a pipelineTask with two conditions,
conditionTaskRuns
contains two containers, one for each condition and after these condition containers are created, this query returns them as valid taskRuns associated with the current pipeline:c.taskRunLister.TaskRuns(pr.Namespace).List(labels.SelectorFromSet(pipelineRunLabels))
so in the looping over those tasks, as they are conditionalChecks, line 974 is not executed and assumes the pipelineTask was not found in line 987 and creates a new taskRun name.
Hope its making sense 😉
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 so much for looking into this!
L974 is designed explicitly to only track
TaskRun
not associated to conditions, but I agree the logic is broken there. It works fine in case of orphaned conditions, but it doesn't in case of non-orphaned ones.If the conditions are created and still running, there will be
TaskRun
s for them in the list, they can be identified as condition ones from the labels. The mainTaskRun
does not exists yet, however its name, under normal conditions, will already be in thePipelineRun
status so that it may contain the status of the conditions:Since my loops are based on what I get from the
TaskRun
list, I do not discover the existingTaskRunName
with no realTaskRun
under which conditions are hosted. I create a new one, and I end up having twoTaskRuns
with the same conditions - I think.I will work on fixing this. I now separated my function in two parts, one which doesn't need the controller and takes the list of taskruns as input, so that it should be easier to write extra tests.
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 fixed the issue now by initializing
taskRunByPipelineTask
from the known PR status, and adding to it as orphanedTaskRuns
are recovered.I added much more test coverage, hopefully it will work ok this time.