Pipeline Integration
TOC
Overview
When building CI/CD pipelines with Tekton, developers often need to integrate with external resources such as Git repositories, container registries, and artifact repositories. Traditionally, this requires manually configuring URLs, credentials, and parameters for each external tool, which is error-prone and time-consuming.
Integrating Tekton Pipelines with Connectors solves this problem by providing a standardized way to connect external resources to pipeline workflows. This integration enables:
- Easy Resource Browsing and Selection: Browse and add external resources like Git repositories, Git Revision, OCI repositories, and other resources through UI assistance instead of manual entry
- Unified Resource Attributes: Handle split attributes from the same remote resource as a cohesive unit, eliminating the need to configure separate
urlandrevisionparameters plus workspace configurations - Guided Workspace Setup: Quick workspace setup with relevant connectors and clear guidance on which connector type is appropriate for each workspace
- Maintained Flexibility: Preserve the current orchestration and pipeline execution experience while adding powerful connector capabilities
What is Pipeline Integration
Pipeline Integration is the mechanism that connects external resources (through Connectors and ResourceInterfaces) with Tekton Tasks and Pipelines. It defines:
- Which resource and connector to use in pipeline workflows
- Parameter configuration required for the resource
- Attribute mapping between resource outputs and pipeline parameters
- Workspace mapping for volumes and credentials
PipelineIntegration is not an actual Kubernetes resource, but integration metadata stored in Tekton Pipeline or Task annotations using the integrations.tekton.dev/integrations key.
This document describes the concepts and key fields of Pipeline Integration. If you want to integrate connectors into your custom pipeline or task, you should understand the details covered in this document.
The built-in Pipeline and Task components already support Pipeline Integration, so you can use them directly without any additional configuration.
Pipeline Integration Key Fields
A Pipeline Integration contains the following key fields:
- ResourceInterface Reference: Specifies which ResourceInterface to use (by category or name)
- Connector Reference: Identifies which Connector instance provides the resource
- Parameter Configuration: Input parameters required by the ResourceInterface
- Attribute Mapping: How resource attributes map to pipeline/task parameters
- Workspace Mapping: How resource workspaces map to pipeline workspaces
Storage in Annotations
Integration metadata is stored using the integrations.tekton.dev/integrations annotation as a YAML array:
Pipeline Integration Structure
Name
The name of the pipeline integration.
ResourceInterface Reference
Specifies which ResourceInterface to use. Supports both category-based and name-based references:
Category-based Reference (flexible, works with any compatible connector):
all category names are defined in the ResourceInterface labels named resourceinterface.connectors.cpaas.io/category.
Name-based Reference (specific interface):
When to use each approach:
- Use category-based for reusable pipelines that should work with different resourceinterfaces implementations
- Use name-based for pipelines that require specific resourceinterface name.
Connector Reference
Specifies which Connector instance to use for accessing the external resource:
Configuration Options:
- Fixed Connector: Set
nameandnamespace, leavesetAtRuntimeasfalseor omit it - Runtime Selection: Set
setAtRuntime: trueto allow connector selection during pipeline execution - Default with Override: Provide
nameand setsetAtRuntime: truefor default with runtime override capability
Parameters
Input parameters required by the ResourceInterface. These parameters are used to calculate resource attributes:
Parameter Behavior:
- When
setAtRuntime: true, the parameter must be provided when executing the pipeline - When
setAtRuntime: falseor omitted, the parameter uses the fixedvalue - Parameters without
valuebut withsetAtRuntime: truerequire user input at runtime
Attributes
Output attributes calculated from parameters and connector information, and their mapping to pipeline parameters:
Attribute Configuration:
- Attribute name must match
ResourceInterface.spec.attributes[].name - Attribute value is calculated using the expression defined in
ResourceInterface.spec.attributes[].expression - Parameterized attributes create pipeline parameters (specified by
paramfield) - Static attributes use fixed values (specified by
valuefield) - refPath defines where the attribute value is used in pipeline tasks
Workspaces
Workspace mapping between ResourceInterface workspaces and pipeline workspaces:
Workspace Configuration:
- Workspace name must match
ResourceInterface.spec.workspaces[].name - Pipeline workspace is automatically created with the specified by
workspacefield, and the default value is from theResourceInterface.spec.workspaces[].workspaceMapping.name. - refPath defines which pipelinetask's workspace use this workspace.
Task Integration Support
Tasks can declare integration support to enable automatic parameter and workspace mapping:
Examples
Revision set at runtime
- connector and repository are fixed values, revision is set at runtime.
- using fixed value
https://github.com/myorg/myapp.gitin git-clone task's url parameter. - using runtime parameter
$(params.revision)in git-clone task's revision parameter. - using workspace
source-workspacein git-clone task's source workspace.
如:
Connector and repository and revision are set at runtime
- connector and repository and revision are set at runtime.
- using runtime parameter
$(params.git-url)in git-clone task's url parameter. - using runtime parameter
$(params.git-revision)in git-clone task's revision parameter. - using workspace
source-workspacein git-clone task's source workspace.
如: