tektoncd/pipeline

Support using a PipelineTask in the Pipeline CRD to run other Pipelines the same way we run a Task (nest pipelines in pipelines)

Open

#2,134 opened on Mar 2, 2020

View on GitHub
 (31 comments) (17 reactions) (0 assignees)Go (1,943 forks)auto 404
area/roadmaphelp wantedkind/featurelifecycle/frozen

Repository metrics

Stars
 (9,013 stars)
PR merge metrics
 (PR metrics pending)

Description

Pipelines group tasks together in a workflow. It would be incredibly useful to be able to re-use that mechanism to create sub-workflows.

Pipelines and Tasks both take Params, Workspaces, and generate Results so with a little work it should be possible to use a PipelineRef in place of a TaskRef when defining a Pipeline Task. For the other aspects required to generate a "sub"-PipelineRun these could be inherited from the parent PipelineRun.

Here's a basic example to illustrate syntax...

apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
  name: pipeline-calling-pipeline
spec:
  params:
  - name: best-param-ever
  workspaces:
  - name: pipeline-ws1
  tasks:
  - name: pipeline-in-task-clothing
    pipelineRef:
      name: some-sub-pipeline
    workspaces:
    - name: sub-pipeline-ws0
      workspace: pipeline-ws1
  - name: regular-task
    taskRef:
      name: some-task
    params:
    - name: new-input
      value: $(tasks.pipeline-in-task-clothing.results.some-ouput)
    workspaces:
    - name: src
      workspace: pipeline-ws1
    runAfter:
    - pipeline-in-task-clothing

In a nutshell, other than using pipelineRef in-place of taskRef the definitions behave the same.

Contributor guide