Skip to content

🔧 Fix invalid $(tasks.status) usage in Tekton pipeline failure notifications #1381

@coderabbitai

Description

@coderabbitai

Problem Description

The new Python 3.12 Tekton pipeline files being added in PR #1379 use an invalid variable reference $(tasks.status) in when expressions for Slack notification failure gating. This causes the condition to never match, resulting in build failure alerts never reaching Slack.

Technical Details

Issue: $(tasks.status) is not a valid Tekton variable
Impact: Slack notification tasks are silently skipped because the condition cannot resolve
Root Cause: When expressions can reference $(tasks.<taskName>.status) or $(context.pipelineRun.status), but not the synthetic token $(tasks.status)

Current Problematic Pattern

when:
- input: $(tasks.status)
  operator: in
  values:
  - "Failed"

Correct Solutions

Option 1: Use overall pipeline status

when:
- input: $(context.pipelineRun.status)
  operator: in
  values:
  - "Failed"

Option 2: Use specific task status

when:
- input: $(tasks.build-container.status)
  operator: in
  values:
  - "Failed"

Affected Files

Based on the current PR #1379, this issue affects the new Python 3.12 pipeline files being added:

  • All new .tekton/-py312-.yaml files in the PR

Impact Analysis

  • Severity: High - Critical failure notifications are not being sent
  • Scope: Affects new Python 3.12 pipelines being introduced
  • User Impact: Development teams will not receive build failure alerts via Slack
  • Operational Impact: Failed builds may go unnoticed, affecting development workflow

Solution Requirements

  1. Pattern Replacement: Replace all instances of $(tasks.status) with valid Tekton variables
  2. Consistency: Use the same approach across all pipeline files
  3. Testing: Verify that failure notifications are properly triggered after changes
  4. Validation: Check if similar issues exist in Python 3.11 pipelines

Acceptance Criteria

  • All instances of $(tasks.status) are replaced with valid Tekton variables in new Python 3.12 files
  • Consistent approach is used across all affected pipeline files
  • Slack failure notifications are properly triggered when pipelines fail
  • Changes are tested with both successful and failed pipeline runs
  • Audit existing Python 3.11 pipelines for similar issues
  • No new instances of $(tasks.status) are introduced

Context

Implementation Notes

  • Recommend using $(context.pipelineRun.status) for overall pipeline status
  • Ensure consistent implementation across all pipeline files
  • Consider adding validation to prevent future instances of this pattern
  • May need to audit existing Python 3.11 files for similar patterns

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

📋 Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions