Skip to content

Instantly share code, notes, and snippets.

@danielfbm
Created March 13, 2026 13:36
Show Gist options
  • Select an option

  • Save danielfbm/eda2ba59ed0e2dac53d44db4e41554fe to your computer and use it in GitHub Desktop.

Select an option

Save danielfbm/eda2ba59ed0e2dac53d44db4e41554fe to your computer and use it in GitHub Desktop.
Test manifests for pipeline in pipeline
# Basic PipelineRef: Parent pipeline references a child pipeline by name.
# Verifies that PipelineRef resolution and child PipelineRun creation work.
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: child-basic
spec:
tasks:
- name: greet
taskSpec:
steps:
- name: echo
image: mirror.gcr.io/busybox
script: |
echo "Hello from child pipeline!"
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: parent-basic
spec:
tasks:
- name: child-basic
pipelineRef:
name: child-basic
---
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: pr-basic-pipelineref
spec:
pipelineRef:
name: parent-basic
# PipelineRef with Params: Parent passes parameters to child pipeline.
# Verifies that params declared in PipelineTask are propagated to the child PipelineRun.
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: child-params
spec:
params:
- name: message
type: string
- name: count
type: string
default: "1"
tasks:
- name: echo-params
params:
- name: message
value: $(params.message)
- name: count
value: $(params.count)
taskSpec:
params:
- name: message
type: string
- name: count
type: string
steps:
- name: echo
image: mirror.gcr.io/busybox
script: |
echo "Message: $(params.message)"
echo "Count: $(params.count)"
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: parent-params
spec:
params:
- name: greeting
type: string
tasks:
- name: child-params
pipelineRef:
name: child-params
params:
- name: message
value: $(params.greeting)
- name: count
value: "42"
---
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: pr-pipelineref-params
spec:
pipelineRef:
name: parent-params
params:
- name: greeting
value: "hello-from-parent"
# PipelineRef with Workspaces: Parent maps a workspace to the child pipeline.
# Verifies that workspace bindings are propagated and renamed correctly.
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: child-workspaces
spec:
workspaces:
- name: shared-data
optional: false
- name: config
optional: false
tasks:
- name: write-file
workspaces:
- name: output
workspace: shared-data
taskSpec:
workspaces:
- name: output
steps:
- name: write
image: mirror.gcr.io/busybox
script: |
echo "Written by child pipeline" > $(workspaces.output.path)/message.txt
echo "File written to workspace"
cat $(workspaces.output.path)/message.txt
- name: read-file
runAfter: [write-file]
workspaces:
- name: input
workspace: shared-data
taskSpec:
workspaces:
- name: input
steps:
- name: read
image: mirror.gcr.io/busybox
script: |
echo "Reading from workspace:"
cat $(workspaces.input.path)/message.txt
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: parent-workspaces
spec:
workspaces:
- name: my-workspace
- name: config
tasks:
- name: child-workspaces
pipelineRef:
name: child-workspaces
workspaces:
- name: shared-data
workspace: my-workspace
# - name: config
# workspace: config
---
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: pr-pipelineref-workspaces
spec:
pipelineRef:
name: parent-workspaces
workspaces:
- name: my-workspace
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Mi
- name: config
emptyDir: {}
# PipelineRef with Workspaces: Parent maps a workspace to the child pipeline.
# Verifies that workspace bindings are propagated and renamed correctly.
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: child-workspaces
spec:
workspaces:
- name: shared-data
tasks:
- name: write-file
workspaces:
- name: output
workspace: shared-data
taskSpec:
workspaces:
- name: output
steps:
- name: write
image: mirror.gcr.io/busybox
script: |
echo "Written by child pipeline" > $(workspaces.output.path)/message.txt
echo "File written to workspace"
cat $(workspaces.output.path)/message.txt
- name: read-file
runAfter: [write-file]
workspaces:
- name: input
workspace: shared-data
taskSpec:
workspaces:
- name: input
steps:
- name: read
image: mirror.gcr.io/busybox
script: |
echo "Reading from workspace:"
cat $(workspaces.input.path)/message.txt
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: parent-workspaces
spec:
workspaces:
- name: my-workspace
tasks:
- name: child-workspaces
pipelineRef:
name: child-workspaces
workspaces:
- name: shared-data
workspace: my-workspace
---
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: pr-pipelineref-workspaces
spec:
pipelineRef:
name: parent-workspaces
workspaces:
- name: my-workspace
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Mi
# PipelineRef with Params AND Workspaces: Full combined flow.
# Verifies both params and workspaces are propagated together.
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: child-full
spec:
params:
- name: filename
type: string
- name: content
type: string
workspaces:
- name: storage
tasks:
- name: write
params:
- name: filename
value: $(params.filename)
- name: content
value: $(params.content)
workspaces:
- name: ws
workspace: storage
taskSpec:
params:
- name: filename
type: string
- name: content
type: string
workspaces:
- name: ws
steps:
- name: write
image: mirror.gcr.io/busybox
script: |
echo "$(params.content)" > $(workspaces.ws.path)/$(params.filename)
echo "Wrote '$(params.content)' to $(params.filename)"
- name: verify
runAfter: [write]
params:
- name: filename
value: $(params.filename)
- name: content
value: $(params.content)
workspaces:
- name: ws
workspace: storage
taskSpec:
params:
- name: filename
type: string
- name: content
type: string
workspaces:
- name: ws
steps:
- name: verify
image: mirror.gcr.io/busybox
script: |
ACTUAL=$(cat $(workspaces.ws.path)/$(params.filename))
EXPECTED="$(params.content)"
if [ "$ACTUAL" = "$EXPECTED" ]; then
echo "PASS: Content matches"
else
echo "FAIL: Expected '$EXPECTED', got '$ACTUAL'"
exit 1
fi
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: parent-full
spec:
params:
- name: file
type: string
- name: msg
type: string
workspaces:
- name: data
tasks:
- name: child-full
pipelineRef:
name: child-full
params:
- name: filename
value: $(params.file)
- name: content
value: $(params.msg)
workspaces:
- name: storage
workspace: data
- name: verify
runAfter: [child-full]
params:
- name: filename
value: $(params.file)
- name: content
value: $(params.msg)
workspaces:
- name: ws
workspace: data
taskSpec:
params:
- name: filename
type: string
- name: content
type: string
workspaces:
- name: ws
steps:
- name: verify
image: mirror.gcr.io/busybox
script: |
ls $(workspaces.ws.path)
ACTUAL=$(cat $(workspaces.ws.path)/$(params.filename))
EXPECTED="$(params.content)"
if [ "$ACTUAL" = "$EXPECTED" ]; then
echo "PASS: Content matches"
else
echo "FAIL: Expected '$EXPECTED', got '$ACTUAL'"
exit 1
fi
---
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: pr-pipelineref-full
spec:
pipelineRef:
name: parent-full
params:
- name: file
value: "output.txt"
- name: msg
value: "hello from the parent pipeline"
workspaces:
- name: data
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Mi
# Two-level nested PipelineRef: A -> B -> C (all via PipelineRef).
# Verifies multi-level PipelineRef resolution works end to end.
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: grandchild-pipeline
spec:
params:
- name: message-grand
default: "hello world!"
tasks:
- name: leaf-task
taskSpec:
steps:
- name: echo
image: mirror.gcr.io/busybox
script: |
echo "Hello from grandchild (level 3): $(params.message-grand)!"
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: child-nested
spec:
params:
- name: message-child
default: "hello world!"
tasks:
- name: grandchild-pipeline
params:
- name: message-grand
value: $(params.message-child)
pipelineRef:
name: grandchild-pipeline
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: parent-nested
spec:
params:
- name: message
default: "hello world!"
tasks:
- name: child-nested
params:
- name: message-child
value: $(params.message)
pipelineRef:
name: child-nested
---
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: pr-nested-pipelineref
spec:
params:
- name: message
value: "hello from pipelinerun!"
pipelineRef:
name: parent-nested
# Two-level nested PipelineRef with params flowing through all levels.
# Verifies params are correctly threaded: parent -> child -> grandchild.
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: grandchild-params
spec:
params:
- name: deep-msg
type: string
tasks:
- name: echo-deep
params:
- name: deep-msg
value: $(params.deep-msg)
taskSpec:
params:
- name: deep-msg
type: string
steps:
- name: echo
image: mirror.gcr.io/busybox
script: |
echo "Grandchild received: $(params.deep-msg)"
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: child-nested-params
spec:
params:
- name: mid-msg
type: string
tasks:
- name: grandchild-params
pipelineRef:
name: grandchild-params
params:
- name: deep-msg
value: $(params.mid-msg)
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: parent-nested-params
spec:
params:
- name: top-msg
type: string
tasks:
- name: child-nested-params
pipelineRef:
name: child-nested-params
params:
- name: mid-msg
value: $(params.top-msg)
---
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: pr-nested-params
spec:
pipelineRef:
name: parent-nested-params
params:
- name: top-msg
value: "passed-through-3-levels"
# Self-referencing cycle: Pipeline A references itself.
# Expected: PipelineRun fails with cycle detection error.
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: self-ref-pipeline
spec:
tasks:
- name: ref-self
pipelineRef:
name: self-ref-pipeline
---
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: pr-cycle-self
spec:
pipelineRef:
name: self-ref-pipeline
# Two-level cycle: Pipeline A -> B -> A.
# Expected: The first child PipelineRun (for B) is created successfully.
# When B tries to create a child for A, cycle detection kicks in and B's
# PipelineRun fails. This causes A's PipelineRun to also fail.
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: cycle-a
spec:
tasks:
- name: ref-b
pipelineRef:
name: cycle-b
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: cycle-b
spec:
tasks:
- name: ref-a
pipelineRef:
name: cycle-a
---
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: pr-cycle-two-level
spec:
pipelineRef:
name: cycle-a
# PipelineRef not found: Parent references a pipeline that does not exist.
# Expected: PipelineRun fails with reason CouldntGetPipeline.
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: parent-ref-not-found
spec:
tasks:
- name: ref-missing
pipelineRef:
name: this-pipeline-does-not-exist
---
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: pr-ref-not-found
spec:
pipelineRef:
name: parent-ref-not-found
# Mixed pipeline: Parent has both regular tasks and a PipelineRef child.
# Verifies PipelineRef works alongside regular TaskRef/TaskSpec tasks
# and that runAfter ordering is respected.
---
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: simple-echo
spec:
params:
- name: msg
type: string
steps:
- name: echo
image: mirror.gcr.io/busybox
script: |
echo "$(params.msg)"
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: child-mixed
spec:
tasks:
- name: child-task
taskSpec:
steps:
- name: echo
image: mirror.gcr.io/busybox
script: |
echo "Running inside child pipeline (PipelineRef)"
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: parent-mixed
spec:
tasks:
- name: step-1-taskref
taskRef:
name: simple-echo
params:
- name: msg
value: "Step 1: regular TaskRef"
- name: step-2-taskspec
runAfter: [step-1-taskref]
taskSpec:
steps:
- name: echo
image: mirror.gcr.io/busybox
script: |
echo "Step 2: inline TaskSpec"
- name: step-3-pipelineref
runAfter: [step-2-taskspec]
pipelineRef:
name: child-mixed
---
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: pr-mixed
spec:
pipelineRef:
name: parent-mixed
# Multiple PipelineRef children: Parent spawns two child pipelines in parallel.
# Verifies that multiple PipelineRef tasks in the same parent work concurrently.
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: child-alpha
spec:
tasks:
- name: alpha-task
taskSpec:
steps:
- name: echo
image: mirror.gcr.io/busybox
script: |
echo "Child Alpha running"
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: child-beta
spec:
tasks:
- name: beta-task
taskSpec:
steps:
- name: echo
image: mirror.gcr.io/busybox
script: |
echo "Child Beta running"
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: parent-multi-children
spec:
tasks:
- name: child-alpha
pipelineRef:
name: child-alpha
- name: child-beta
pipelineRef:
name: child-beta
---
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: pr-multi-children
spec:
pipelineRef:
name: parent-multi-children
# PipelineRef with workspace SubPath: Parent maps a workspace with a subpath.
# Verifies that SubPath is correctly applied when propagating workspaces.
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: child-subpath
spec:
workspaces:
- name: data
tasks:
- name: write-task
workspaces:
- name: ws
workspace: data
taskSpec:
workspaces:
- name: ws
steps:
- name: write
image: mirror.gcr.io/busybox
script: |
echo "written in subpath" > $(workspaces.ws.path)/test.txt
echo "Wrote to: $(workspaces.ws.path)/test.txt"
ls -la $(workspaces.ws.path)/
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: parent-subpath
spec:
workspaces:
- name: root-ws
tasks:
- name: child-subpath
pipelineRef:
name: child-subpath
workspaces:
- name: data
workspace: root-ws
subPath: nested/dir
- name: child-subpath-another
pipelineRef:
name: child-subpath
workspaces:
- name: data
workspace: root-ws
subPath: nested
- name: read-task
runAfter:
- child-subpath
- child-subpath-another
workspaces:
- name: ws
workspace: root-ws
taskSpec:
workspaces:
- name: ws
steps:
- name: read
image: mirror.gcr.io/busybox
script: |
ls -la $(workspaces.ws.path)/
ls -la $(workspaces.ws.path)/nested/
ls -la $(workspaces.ws.path)/nested/dir
---
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: pr-workspace-subpath
spec:
pipelineRef:
name: parent-subpath
workspaces:
- name: root-ws
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Mi
# Kitchen Sink: Exercises every PINP feature in one manifest.
#
# Features tested:
# - TaskRef (external Task)
# - Inline TaskSpec
# - PipelineRef (child pipeline by name)
# - Inline PipelineSpec (child pipeline inline)
# - Param interpolation at every level, including defaults
# - Workspaces shared between child pipelines and regular tasks (volumeClaimTemplate)
# - SubPath on workspace mappings
# - runAfter ordering across mixed task types
# - Two-level nesting: parent -> child-pipelineref -> grandchild-pipelineref
#
# Topology (parent-kitchen-sink):
#
# step-1-taskref (TaskRef: echo-task)
# |
# step-2-taskspec (inline TaskSpec, writes to workspace)
# |
# step-3-pipelineref (PipelineRef: child-ks, params + workspaces)
# |
# step-4-pipelinespec (inline PipelineSpec, reads workspace)
# |
# step-5-verify (inline TaskSpec, reads workspace to verify all writes)
#
# Expected: Succeeded=True
---
# Standalone Task for TaskRef usage
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: echo-task
spec:
params:
- name: greeting
type: string
default: "hello from echo-task"
steps:
- name: echo
image: mirror.gcr.io/busybox
script: |
echo "$(params.greeting)"
---
# Grandchild pipeline: referenced by child-ks via PipelineRef
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: grandchild-ks
spec:
params:
- name: label
type: string
default: "grandchild-default"
workspaces:
- name: ws
tasks:
- name: write-grandchild
params:
- name: label
value: $(params.label)
workspaces:
- name: out
workspace: ws
taskSpec:
params:
- name: label
type: string
workspaces:
- name: out
steps:
- name: write
image: mirror.gcr.io/busybox
script: |
echo "grandchild: $(params.label)" >> $(workspaces.out.path)/log.txt
echo "Grandchild wrote: $(params.label)"
---
# Child pipeline: referenced by parent-kitchen-sink via PipelineRef.
# Contains a PipelineRef to grandchild-ks and a regular task.
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: child-ks
spec:
params:
- name: child-msg
type: string
default: "child-default"
- name: grandchild-msg
type: string
default: "grandchild-via-child-default"
workspaces:
- name: storage
tasks:
# Regular task inside the child pipeline — writes to workspace
- name: child-write
params:
- name: msg
value: $(params.child-msg)
workspaces:
- name: out
workspace: storage
taskSpec:
params:
- name: msg
type: string
workspaces:
- name: out
steps:
- name: write
image: mirror.gcr.io/busybox
script: |
echo "child: $(params.msg)" >> $(workspaces.out.path)/log.txt
echo "Child wrote: $(params.msg)"
# Nested PipelineRef to grandchild — shares same workspace with subPath
- name: grandchild-ref
runAfter: [child-write]
pipelineRef:
name: grandchild-ks
params:
- name: label
value: $(params.grandchild-msg)
workspaces:
- name: ws
workspace: storage
---
# Parent pipeline: the top-level orchestrator
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: parent-kitchen-sink
spec:
params:
- name: greeting
type: string
default: "hello from parent"
- name: child-msg
type: string
default: "msg-for-child"
- name: grandchild-msg
type: string
default: "msg-for-grandchild"
workspaces:
- name: shared
tasks:
# Step 1: TaskRef to external Task
- name: step-1-taskref
taskRef:
name: echo-task
params:
- name: greeting
value: "Step 1 — $(params.greeting)"
# Step 2: Inline TaskSpec — writes to workspace
- name: step-2-taskspec
runAfter: [step-1-taskref]
params:
- name: msg
value: $(params.greeting)
workspaces:
- name: out
workspace: shared
taskSpec:
params:
- name: msg
type: string
workspaces:
- name: out
steps:
- name: write
image: mirror.gcr.io/busybox
script: |
echo "parent-inline: $(params.msg)" >> $(workspaces.out.path)/log.txt
echo "Parent inline task wrote to workspace"
# Step 3: PipelineRef child — params + workspaces flow down
- name: step-3-pipelineref
runAfter: [step-2-taskspec]
pipelineRef:
name: child-ks
params:
- name: child-msg
value: $(params.child-msg)
- name: grandchild-msg
value: $(params.grandchild-msg)
workspaces:
- name: storage
workspace: shared
# Step 4: Inline PipelineSpec — reads workspace, adds its own line
- name: step-4-pipelinespec
runAfter: [step-3-pipelineref]
pipelineSpec:
workspaces:
- name: data
tasks:
- name: inline-pipeline-task
workspaces:
- name: ws
workspace: data
taskSpec:
workspaces:
- name: ws
steps:
- name: append
image: mirror.gcr.io/busybox
script: |
echo "inline-pipeline: step4" >> $(workspaces.ws.path)/log.txt
echo "Inline PipelineSpec wrote to workspace"
echo "--- log so far ---"
cat $(workspaces.ws.path)/log.txt
workspaces:
- name: data
workspace: shared
# Step 5: Final verification — reads workspace and checks all 4 entries
- name: step-5-verify
runAfter: [step-4-pipelinespec]
workspaces:
- name: ws
workspace: shared
taskSpec:
workspaces:
- name: ws
steps:
- name: verify
image: mirror.gcr.io/busybox
script: |
echo "=== Final log.txt ==="
cat $(workspaces.ws.path)/log.txt
echo "=== Verification ==="
LINES=$(wc -l < $(workspaces.ws.path)/log.txt)
if [ "$LINES" -ge 4 ]; then
echo "PASS: Found $LINES lines (expected >= 4)"
else
echo "FAIL: Found $LINES lines (expected >= 4)"
exit 1
fi
---
# PipelineRun: triggers the whole thing
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: pr-kitchen-sink
spec:
pipelineRef:
name: parent-kitchen-sink
params:
- name: greeting
value: "kitchen-sink-greeting"
- name: child-msg
value: "kitchen-sink-child"
- name: grandchild-msg
value: "kitchen-sink-grandchild"
workspaces:
- name: shared
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Mi
# Four-layer cycle: A -> B -> C -> D -> A.
# Tests that cycle detection catches longer transitive cycles, not just self or 2-level.
#
# Topology:
# pipeline-layer-a
# └─ pipelineRef: pipeline-layer-b
# └─ pipelineRef: pipeline-layer-c
# └─ pipelineRef: pipeline-layer-d
# └─ pipelineRef: pipeline-layer-a ← CYCLE
#
# Expected: The deepest child that tries to reference layer-a should fail with
# cycle detection (CreateRunFailed), which propagates up through all parents.
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: pipeline-layer-d
spec:
params:
- name: msg
type: string
default: "layer-d"
workspaces:
- name: ws
tasks:
- name: echo-d
params:
- name: msg
value: $(params.msg)
taskSpec:
params:
- name: msg
type: string
steps:
- name: echo
image: mirror.gcr.io/busybox
script: |
echo "Layer D: $(params.msg)"
# This creates the cycle: D -> A
- name: back-to-a
runAfter: [echo-d]
pipelineRef:
name: pipeline-layer-a
params:
- name: msg
value: "cycle-from-d"
workspaces:
- name: ws
workspace: ws
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: pipeline-layer-c
spec:
params:
- name: msg
type: string
default: "layer-c"
workspaces:
- name: ws
tasks:
- name: echo-c
params:
- name: msg
value: $(params.msg)
taskSpec:
params:
- name: msg
type: string
steps:
- name: echo
image: mirror.gcr.io/busybox
script: |
echo "Layer C: $(params.msg)"
- name: call-d
runAfter: [echo-c]
pipelineRef:
name: pipeline-layer-d
params:
- name: msg
value: "from-c"
workspaces:
- name: ws
workspace: ws
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: pipeline-layer-b
spec:
params:
- name: msg
type: string
default: "layer-b"
workspaces:
- name: ws
tasks:
- name: echo-b
params:
- name: msg
value: $(params.msg)
taskSpec:
params:
- name: msg
type: string
steps:
- name: echo
image: mirror.gcr.io/busybox
script: |
echo "Layer B: $(params.msg)"
- name: call-c
runAfter: [echo-b]
pipelineRef:
name: pipeline-layer-c
params:
- name: msg
value: "from-b"
workspaces:
- name: ws
workspace: ws
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: pipeline-layer-a
spec:
params:
- name: msg
type: string
default: "layer-a"
workspaces:
- name: ws
tasks:
- name: echo-a
params:
- name: msg
value: $(params.msg)
taskSpec:
params:
- name: msg
type: string
steps:
- name: echo
image: mirror.gcr.io/busybox
script: |
echo "Layer A: $(params.msg)"
- name: call-b
runAfter: [echo-a]
pipelineRef:
name: pipeline-layer-b
params:
- name: msg
value: "from-a"
workspaces:
- name: ws
workspace: ws
---
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: pr-four-layer-cycle
spec:
pipelineRef:
name: pipeline-layer-a
params:
- name: msg
value: "start"
workspaces:
- name: ws
emptyDir: {}
@danielfbm
Copy link
Author

Test Cases

Success cases (expect Succeeded=True)

# File What it tests
01 01-basic-pipelineref.yaml Basic PipelineRef resolution
02 02-pipelineref-with-params.yaml Params passed from parent to child
03 03-pipelineref-with-workspaces.yaml Workspace mapped from parent to child (emptyDir)
04 04-pipelineref-params-and-workspaces.yaml Params + workspaces together
05 05-nested-pipelineref.yaml Two-level nesting: A -> B -> C via PipelineRef
06 06-nested-pipelineref-with-params.yaml Params threaded through 3 levels of nesting
10 10-mixed-pipelineref-and-tasks.yaml PipelineRef alongside TaskRef and TaskSpec with runAfter
11 11-pipelineref-multiple-children.yaml Two PipelineRef children running in parallel
12 12-pipelineref-workspace-subpath.yaml Workspace propagation with SubPath
13 13-kitchen-sink.yaml Everything combined: TaskRef, TaskSpec, PipelineRef, PipelineSpec, params with defaults, workspaces (volumeClaimTemplate), 2-level nesting

Failure cases (expect Succeeded=False)

# File What it tests Expected reason
07 07-cycle-self-reference.yaml Self-referencing cycle (A -> A) CreateRunFailed
08 08-cycle-two-level.yaml Two-level cycle (A -> B -> A) Child fails with CreateRunFailed, parent fails too
09 09-pipelineref-not-found.yaml Reference to nonexistent pipeline CouldntGetPipeline
14 14-four-layer-cycle.yaml Four-layer cycle (A -> B -> C -> D -> A) Deepest child fails with CreateRunFailed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment