Skip to content

Further deduplication opportunities for Tekton *-pull-request.yaml files #1505

@coderabbitai

Description

@coderabbitai

Background

This issue continues the conversation started in PR #1501 and specifically in this comment thread about further deduplicating the *-pull-request.yaml files in the .tekton directory.

Current State

After the refactoring in PR #1501, we successfully extracted the common multiarch-pull-request-pipeline into its own file. However, there are still opportunities for further deduplication between the runtime-specific PipelineRun files:

  • .tekton/odh-pipeline-runtime-minimal-cpu-py311-ubi9-pull-request.yaml
  • .tekton/odh-pipeline-runtime-minimal-cpu-py312-ubi9-pull-request.yaml

Analysis: Both files are nearly identical (53 lines each) with only 7 component-specific variations:

  1. Component identifier: py311 vs py312
  2. Python version paths: ubi9-python-3.11 vs ubi9-python-3.12
  3. Dockerfile paths: runtimes/minimal/ubi9-python-3.11/Dockerfile.cpu vs runtimes/minimal/ubi9-python-3.12/Dockerfile.cpu
  4. Metadata fields: names, labels, service accounts, and trigger paths

Approaches Considered

1. Shell Script Templating ❌

Initially considered creating template files with environment variable substitution using envsubst, but this approach was rejected in favor of native Tekton mechanisms.

2. Native Tekton Parameter Substitution ✅

Using Tekton's native $(params.NAME) syntax within pipelines and PipelineRuns. However, this has a limitation: parameter values in spec.params are treated as opaque strings and don't support variable substitution within them.

3. TriggerTemplates ❌

Not available in Konflux since it uses Pipelines as Code (PaC) instead of Tekton Triggers.

4. PAC Templating ❌

Advanced PAC templating features like {{ custom_param }} syntax are not supported in Konflux.

Konflux-Specific Constraints

This project uses Konflux (https://konflux-ci.dev/), which has specific limitations:

  • No TriggerTemplates: Konflux uses PaC instead of Tekton Triggers
  • Limited PAC Templating: No {{ custom_param }} syntax support
  • GitOps-First: Designed for explicit, declarative PipelineRun files
  • Recommended Pattern: Centralized Pipeline + Individual PipelineRuns

Final Recommendation

Status Quo is Optimal

Based on Konflux documentation and best practices, the current approach is actually perfectly aligned with Konflux patterns:

  1. Centralized Pipeline ✅ (multiarch-pull-request-pipeline.yaml)
  2. Individual PipelineRuns ✅ (component-specific files)
  3. Shared Logic ✅ (extracted into the common pipeline)

The deduplication already achieved by extracting the common pipeline logic is the recommended Konflux approach. Further templating would go against Konflux's GitOps-first, declarative philosophy.

Optional Enhancement

If maintenance burden becomes an issue, a simple development-time generation script could be used as a maintenance tool (not runtime requirement):

# .tekton/generate.sh (development tool only)
#!/bin/bash
for runtime in py311 py312; do
  version_dot=${runtime#py}
  version_dot=${version_dot:0:1}.${version_dot:1}
  
  envsubst < template.yaml > "odh-pipeline-runtime-minimal-cpu-${runtime}-ubi9-pull-request.yaml"
done

Key Learnings

  1. Always consider native Tekton mechanisms first before external templating
  2. Konflux has specific patterns that differ from pure Tekton
  3. Current approach is optimal for the platform being used
  4. GitOps-first design sometimes means accepting some duplication for clarity

References

Conclusion

No action required - the current implementation follows Konflux best practices. This issue serves as documentation of the investigation and rationale for the current approach.

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