Workspaces allow Tasks to share data with each other and declare the volumes they need at runtime.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tektoncd/pipeline/llms.txt
Use this file to discover all available pages before exploring further.
WorkspaceDeclaration
Declares a workspace required by a Task.Name of the workspace.Used to reference the workspace in steps and bind it at runtime.
Human-readable description of how the workspace is used.
Path where the workspace will be mounted.Defaults to
/workspace/<name> if not specified.Whether the workspace is read-only.If true, the volume is mounted read-only.
Whether the workspace is optional.If true, the Task can run without this workspace being provided.
WorkspaceBinding
Binds a declared workspace to an actual volume at runtime (in TaskRuns/PipelineRuns).Name of the workspace being bound.Must match a workspace declared in the Task or Pipeline.
Subdirectory on the volume to use for this binding.Useful when multiple workspaces share the same volume.
Volume Sources
One of the following volume sources must be specified:Temporary directory that shares the Task’s lifetime.Data is lost when the Task completes.
Reference to an existing PersistentVolumeClaim.
Template for creating a PVC for each run.The PVC is automatically created and deleted.
Populate workspace from a ConfigMap.
Populate workspace from a Secret.
Combine multiple volume sources into one.
Use a CSI (Container Storage Interface) driver.
PipelineWorkspaceDeclaration
Declares a workspace required by a Pipeline.Name of the workspace.
Description of how the workspace is used in the Pipeline.
Whether the workspace is optional.
WorkspacePipelineTaskBinding
Maps a Pipeline workspace to a Task workspace.Name of the workspace as declared by the Task.
Name of the workspace declared by the Pipeline.If omitted, assumes the names match.
Subdirectory within the Pipeline workspace.
Using Workspaces in Steps
Access workspace paths in steps:Workspace Isolation
Steps can request exclusive access to workspaces:Examples
Task with Workspace
TaskRun with emptyDir
TaskRun with PVC
Pipeline Sharing Workspace
PipelineRun with VolumeClaimTemplate
Using SubPath
ConfigMap Workspace
Secret Workspace
Best Practices
- Use descriptive names - Clearly indicate workspace purpose
- Document workspace usage - Explain what data the workspace contains
- Use volumeClaimTemplate for pipelines - Automatically provision storage
- Mark optional workspaces - Allow tasks to run without optional data
- Use subPath for organization - Share volumes across workspaces
- Choose appropriate volume types - Match volume type to data persistence needs
- Set readOnly when appropriate - Prevent accidental modifications
- Clean up PVCs - Remove volumeClaimTemplate PVCs after use