SRVKP-10037: Fixed task node status in pipeline run topology which was not updating in real time#1027
Conversation
|
@anwesha-palit-redhat: This pull request references SRVKP-10306 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set. DetailsIn 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 openshift-eng/jira-lifecycle-plugin repository. |
| return _.merge(task, { status: { reason: ComputedStatus.Failed } }); | ||
| if (pipelineRunStatus(pipelineRun) === ComputedStatus.Failed) { | ||
| return { ...task, status: { reason: ComputedStatus.Failed } }; | ||
| } |
There was a problem hiding this comment.
updated the default tasknode to show as pending instead of failed
|
|
||
| const mTask = _.merge(task, { | ||
| status: pipelineRun?.status?.taskRuns | ||
| ? _.get( |
There was a problem hiding this comment.
pipelineRun.status.taskRuns is deprecated therefore removed this
| observer, | ||
| } from '@patternfly/react-topology'; | ||
| import classNames from 'classnames'; | ||
| import { observer } from 'mobx-react'; |
There was a problem hiding this comment.
this essentially fixed the issue, mobx-react shouldn't be directly used, PF internally uses it
|
@anwesha-palit-redhat: This pull request references SRVKP-10037 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set. DetailsIn 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 openshift-eng/jira-lifecycle-plugin repository. |
| } | ||
| }; | ||
| !skipFetch && fetchResults(); | ||
| !skipFetch && isTektonResultEnabled && fetchResults(); |
There was a problem hiding this comment.
good catch for violation of Rules of Hooks
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: anwesha-palit-redhat, arvindk-softwaredev The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
a635dae
into
openshift-pipelines:master
Summary
Pipeline topology task nodes were not reflecting live TaskRun status updates — statuses only appeared after hovering on a node or switching tabs. This was caused by a dual MobX instance problem:
PipelineTaskNodeimportedobserverfrom the plugin-bundledmobx-react, while@patternfly/react-topology(a shared module loaded from the host console) uses its own MobX instance. The mismatched instances meant observable changes on topology elements were invisible to the plugin'sobserver.Additionally, the task status derivation logic in
appendPipelineRunStatushad issues with mutation, a deprecated Tekton v0 field lookup, and incorrect failure defaults. TheuseTRRunshook also violated React's rules of hooks with a conditional early return before hook calls.Changes
PipelineTaskNode.tsx: Importobserverfrom@patternfly/react-topologyinstead ofmobx-reactto use the host console's MobX instance, ensuring topology observable changes trigger re-renders. This essentially fixed the main issue we were encountering. Removed redundantmemowrapper.pipeline-utils.ts(appendPipelineRunStatus): Replaced_.mergewith immutable object spreads to prevent stale status persisting via direct mutation ofpipeline.spec.tasks.Removed deprecated
pipelineRun.status.taskRunslookup (not present in Tekton v1 — status is now sourced from individualTaskRunobjects resolved viachildReferences).Fixed fallback logic so tasks default to
Pendinginstead ofFailedwhen TaskRuns haven't been fetched yet; tasks are only markedFailedwhen the PipelineRun itself has failed.useTektonResults.ts(useTRRuns): Moved the!isTektonResultEnabledearly return below all hook calls to comply with React's rules of hooks. The guard is now applied inside theuseEffectcondition instead.Screen Recording Before
before-10306.mov
Screen Recording After
after-10306.mov