-
Notifications
You must be signed in to change notification settings - Fork 258
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
Tasks should be sorted in Pipeline spec order not alphabetically #932
Comments
@AlanGreene do you think this'd be particularly hard to do? I've noticed we've got a sorting by time already on the TaskRuns page, for full disclosure it's being asked for as a useful feature to have for the upcoming release of the Kabanero project as there's a validate task that actually happens first, but it's displayed at the bottom |
hrmm displaying them alphabetically (the current mystery behaviour we have no explicit code for...) is definitely not right, but I'm not sure if sorting by timestamp is right either as it won't be consistent across multiple PipelineRuns for the same Pipeline where some Tasks are run in parallel. Ideally we'd display them in topologically sorted order (walk the DAG essentially), but this would take a bit of work considering the current approach to processing the data. Maybe we could display them in the order they're defined in the Pipeline definition? That would be relatively simple and we already do it for steps so could take a similar approach. If we do want to sort by timestamp it would be simple enough to do in either the PipelineRun or TaskTree component assuming the metadata including timestamps is available at those points. |
Good points, yeah I like the idea of doing it based on the position in the Pipeline for now, I'm wary there's run after and folks needn't place things in order really but at least it'll be done in a well defined way and to some specification |
consensus here: prefer displaying in the order defined in the Pipeline definition rather than by timestamp. Can we update the issue description? :) |
Done |
Right, got a test Pipeline, PipelineRun and some tasks, actually fixing the code now, the getTektonAPI get does return the Task names in name order 🤔
I'm looking at introducing moment to sort by timestamp as at least that'd solve the simple case and we'd expand from there. Had a look at the existing step reordering code and I can't currently see how to apply that to this case. The structure of the PipelineRun is
note that startedAt is present on the steps themselves and not on the Tasks that get run as part of the TaskRun. |
I have something working, needs more testing though. While a PipelineRun is still happening: And when it's done, it's the same. I'm sorting on terminated.startedAt here, I've had to introduce moment for the useful before/after methods. Oddly enough I've only changed PipelineRuns here, not TaskRuns, and yet TaskRuns appears to be sorted by |
This is open now for anyone else to build upon to actually implement the displaying of steps by Spec order, I implemented by earliest startedAt time Here's some code in use by the Dashboard as part of the IBM public cloud team offering for Tekton that @AlanGreene has kindly shared that we can build upon, perhaps adding a switch to change the sorting method used:
|
Stale issues rot after 30d of inactivity. /lifecycle rotten Send feedback to tektoncd/plumbing. |
Rotten issues close after 30d of inactivity. /close Send feedback to tektoncd/plumbing. |
@tekton-robot: Closing this issue. In response to this:
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. |
/remove-lifecycle rotten |
@AlanGreene: Reopened this issue. In response to this:
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. |
Revisiting the comment above, relevant piece for sorting in Pipeline spec order: const orderedTaskRuns = [];
pipeline.spec.tasks.forEach(pipelineTask => {
const taskRun = taskRuns.find(
run =>
run.metadata.labels["tekton.dev/pipelineTask"] === pipelineTask.name
);
if (taskRun) {
orderedTaskRuns.push(taskRun);
}
}); The line: We should review the order in PipelineRun.status.taskRuns or other locations we might rely on to see if they're stable in recent Pipelines releases. I know there was a recent change to ensure the step order is consistent (including the init steps), but not sure if similar has been done for TaskRuns. |
Also relevant: #1445 |
Expected behavior
Tasks should be sorted by the order they are defined in the Pipeline, not alphabetically
Actual behavior
They're sorted alphabetically
Steps to reproduce the problem
Environment (e.g. Docker Desktop, OpenShift)
All
Tekton Pipelines version (e.g. 0.9.2, 0.8.0, master)
Any
Tekton Triggers version (e.g. 0.2, 0.1, master)
Any
Tekton Dashboard version (e.g. 0.4.0, 0.3.0, master)
All
The text was updated successfully, but these errors were encountered: