Skip to main content
This example demonstrates a sophisticated pipeline with parallel tasks, shared workspaces, and data flowing through both results and files.

Pipeline Architecture

This pipeline implements a message transformation workflow:
The pipeline receives a message, transforms it in parallel to uppercase and lowercase, reports the uppercase version, then validates both transformations.

Complete Example

Task Definitions

Persist Parameter Task

Writes the input message to both a file and a result:

Transform Tasks

Both upper and lower tasks follow the same pattern - read from workspace, transform, write to both workspace and results:

How It Works

1

Initialize Message

The starter task receives the message parameter “Hello Tekton” and writes it to:
  • File: ws/init/message
  • Result: message
The task uses subPath: init to write to a subdirectory of the shared workspace.
2

Parallel Transformation

Both upper and lower tasks:
  • Wait for starter to complete (via runAfter)
  • Run in parallel (no dependency between them)
  • Read from ws/init/message
  • Transform the text
  • Write to both workspace files and results
upper produces:
  • File: ws/upper containing “HELLO TEKTON”
  • Result: “HELLO TEKTON”
lower produces:
  • File: ws/lower containing “hello tekton”
  • Result: “hello tekton”
3

Report Result

The reporter task:
  • Waits for upper to complete
  • Receives the uppercase message via result: $(tasks.upper.results.message)
  • Prints it (simulating sending to an external service)
  • Does NOT use a workspace, so can be scheduled on any node
4

Validate Outputs

The validator task:
  • Waits for both reporter and lower to complete
  • Reads files from workspace: ws/upper and ws/lower
  • Validates both contain the expected transformed text
  • Fails if either validation fails

Data Flow Patterns

This pipeline demonstrates two ways to pass data between tasks:

Via Workspace Files

Good for:
  • Large data (files, artifacts)
  • Binary data
  • Multiple files

Via Task Results

Good for:
  • Small text data (< 4KB)
  • Commit SHAs, version numbers
  • Status flags
  • Metadata

Execution Timeline

Workspace Organization

The shared workspace is organized with subpaths:

Affinity Assistant

Since multiple tasks use the same workspace, Tekton’s Affinity Assistant ensures they run on the same node. The reporter task doesn’t use a workspace, so it can run on any node.
You can disable the Affinity Assistant if your cluster has ReadWriteMany volumes or other shared storage solutions.

Expected Output

starter task:
upper task:
lower task:
reporter task:
validator task:

Real-World Applications

This pattern is useful for:
  • Multi-architecture builds: Build for amd64 and arm64 in parallel
  • Test suites: Run unit, integration, and e2e tests in parallel
  • Multi-environment deploys: Deploy to dev and staging in parallel
  • Data processing: Transform data in parallel pipelines
  • Notifications: Send status to multiple services

Key Concepts

  • Diamond Dependencies: Tasks converge and diverge in the dependency graph
  • Parallel Execution: Independent tasks run simultaneously
  • Data Persistence: Using workspaces for file-based data sharing
  • Result Propagation: Using results for lightweight data passing
  • Workspace Subpaths: Organizing data within a shared workspace
  • Implicit vs Explicit Dependencies: Using both runAfter and result references
  • Affinity Scheduling: Tasks sharing workspaces run on the same node

Performance Considerations

  • Parallelization: The pipeline completes faster because upper and lower run in parallel
  • Node Affinity: Workspace-sharing tasks avoid data transfer between nodes
  • Resource Requests: The reporter task can use spare capacity on any node

Next Steps