Skip to content

Nr. 3 - [TEP-0056]: Implement Pipelines-in-Pipelines reconciliation. #8879

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

twoGiants
Copy link
Member

@twoGiants twoGiants commented Jul 12, 2025

Important

Pull request number 3.
The numbering Nr. 3 - [TEP-0056] means the PRs must be merged in order. They build on each other.

Changes

[TEP-0056]: Third PR of Pipelines-in-Pipelines feature implementation.

Child PipelineRuns (PinP) are created by the PipelineRun reconciler, equal to the TaskRun/CustomRun implementations.

An event handler for child PipelineRuns is registered in controller entrypoint. This will trigger the reconciliation loop when child PipelineRuns change their state.

Extend resolvePipelineState with getter for child PipelineRuns using lister and extend runNextSchedulableTask with a condition check for a PipelineTask which is a Pipeline and implement the creation of a new PipelineRun from the resolved pipeline state and pipeline facts.

Setting the ChildReferences was extended for child PipelineRuns.

Rename label/annotation factory.

The unit/e2e test framework was refactored and extended to prepare for future tests. The test setup is a parent pipeline with one or more embedded child/grandchild pipelines using the PipelineSpec (alpha) field. It follows the given-when-then test flow arrangement.

The pipeline manifests yaml definitions use variables for every field which is validated. Multiple helper functions were created equal to reconciliation unit tests for TaskRuns/CustomRuns.

Test data factory functions were put in the testing package in the factory.go file.

The unit tests validates:

  • the status and condition of the parent PipelineRuns which should trigger the creation of the child PipelineRuns,
  • the actual created child/grandchild PipelineRuns if they have the correct metadata i.e. name, owner reference, etc. and the embedded pipelines from the PipelineSpec fields in the pipeline tasks of the parent pipeline.

Similar checks are performed in TestReconcile for TaskRun and in TestReconcile_V1Beta1CustomTask for CustomTasks.

The e2e tests validate:

  • parent PipelineRun creation,
  • child PipelineRun creation,
  • successful finish of all resources,
  • correct label and annotation propagation,
  • amount of events published.

Similar checks are performed in
TestPipelineRun|TestPipelineRunStatusSpec|... for TaskRun and in TestCustomTask for CustomTask.

Issues #8760, #7166.

Release notes will be added with the last PR which will make this feature functional for users.

/kind feature

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • pre-commit Passed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

A Pipeline can now execute embedded Pipelines (Pipelines-in-Pipelines) using the `PipelineSpec` field under `tasks`. Refer to the TEP-0056 for more details.

[TEP-0056]: Third PR of Pipelines-in-Pipelines feature implementation.

Child `PipelineRuns` (PinP) are created by the `PipelineRun` reconciler,
equal to the `TaskRun/CustomRun` implementations.

An event handler for child `PipelineRuns` is registered in controller
entrypoint. This will trigger the reconciliation loop when child
`PipelineRuns` change their state.

Extend `resolvePipelineState` with getter for child `PipelineRuns` using
lister and extend `runNextSchedulableTask` with a condition check for a
`PipelineTask` which is a `Pipeline` and implement the creation of
a new `PipelineRun` from the resolved pipeline state and pipeline facts.

Setting the `ChildReferences` was extended for child `PipelineRuns`.

Rename label/annotation factory.

The unit/e2e test framework was refactored and extended to prepare for
future tests. The test setup is a parent pipeline with one or more
embedded child/grandchild pipelines using the `PipelineSpec` (alpha)
field. It follows the given-when-then test flow arrangement.

The pipeline manifests yaml definitions use variables for every field
which is validated. Multiple helper functions were created equal to
reconciliation unit tests for TaskRuns/CustomRuns.

Test data factory functions were put in the `testing` package in the
`factory.go` file.

The unit tests validates:
- the status and condition of the parent PipelineRuns which should
trigger the creation of the child PipelineRuns,
- the actual created child/grandchild PipelineRuns if they have the correct
metadata i.e. name, owner reference, etc. and the embedded pipelines
from the `PipelineSpec` fields in the pipeline tasks of the parent
pipeline.

Similar checks are performed in `TestReconcile` for `TaskRun` and in
`TestReconcile_V1Beta1CustomTask` for `CustomTasks`.

The e2e tests validate:
- parent PipelineRun creation,
- child PipelineRun creation,
- successful finish of all resources,
- correct label and annotation propagation,
- amount of events published.

Similar checks are performed in
`TestPipelineRun|TestPipelineRunStatusSpec|...` for `TaskRun` and in
`TestCustomTask` for `CustomTask`.

Issues tektoncd#8760, tektoncd#7166.

Signed-off-by: Stanislav Jakuschevskij <stas@two-giants.com>
@tekton-robot tekton-robot added kind/feature Categorizes issue or PR as related to a new feature. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Jul 12, 2025
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign yongxuanzhang after the PR has been reviewed.
You can assign the PR to them by writing /assign @yongxuanzhang in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jul 12, 2025
@tekton-robot
Copy link
Collaborator

The following Tekton test failed:

Test name Commit Details Required Rerun command
check-pr-has-kind-label 86cc7e7 link true /test check-pr-has-kind-label

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/testing/factory.go Do not exist 0.0%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/feature Categorizes issue or PR as related to a new feature. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

3 participants