Skip to content

Commit

Permalink
Update PipelineRun container logic to correctly select TaskRuns with …
Browse files Browse the repository at this point in the history
…conditions

The `tekton.dev/pipelineTask` label is applied to both the condition check TaskRun
and the owning TaskRun. The previous logic could in some cases incorrectly select
the condition check for display in the UI.

Update the logic to ensure a match for the `tekton.dev/pipelineTask` label is only
counted when there is no accompanying `tekton.dev/conditionCheck` label. This will
ensure the condition is only matched when the selected value appears in the
conditionCheck label, regardless of the order TaskRuns are listed in the data.
  • Loading branch information
AlanGreene authored and tekton-robot committed Jul 30, 2020
1 parent e87482d commit 0222c32
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/containers/PipelineRun/PipelineRun.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ export /* istanbul ignore next */ class PipelineRunContainer extends Component {
({ metadata }) =>
metadata.labels &&
(metadata.labels[labelConstants.CONDITION_CHECK] === pipelineTaskName ||
metadata.labels[labelConstants.PIPELINE_TASK] === pipelineTaskName)
// the `pipelineTask`` label is present on both TaskRuns (the owning
// TaskRun and the TaskRun created for the condition check), ensure
// we only match on the owning TaskRun here and not another condition
(!metadata.labels[labelConstants.CONDITION_CHECK] &&
metadata.labels[labelConstants.PIPELINE_TASK] === pipelineTaskName))
);

if (!taskRun) {
Expand Down

0 comments on commit 0222c32

Please sign in to comment.