Tekton Hub isn’t just a catalog; it’s a dynamic, community-driven marketplace where the best Tekton building blocks are shared, discovered, and rapidly integrated.
Let’s see it in action. Imagine you need to build a simple CI pipeline that clones a Git repository, runs npm install, and then npm test. Instead of writing all that yourself, you head to Tekton Hub. You search for "git clone," "npm install," and "npm test." You find community-contributed Tasks for each.
Here’s how you might use them in a Tekton Pipeline definition:
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: my-npm-app-pipeline
spec:
tasks:
- name: clone-repo
taskRef:
name: git-clone # This refers to a Task found on Tekton Hub
kind: Task
# Optionally specify a version or namespace if needed
# For example:
# bundle: docker://ghcr.io/tektoncd/catalog/git-clone:0.3.0
params:
- name: url
value: "https://github.com/my-user/my-npm-app.git"
- name: revision
value: "main"
# Define a workspace for the cloned code
workspaces:
- name: output
workspace: shared-workspace
- name: install-dependencies
taskRef:
name: npm-install # Another Task from Tekton Hub
kind: Task
runAfter:
- clone-repo # Ensure cloning happens first
params:
- name: packageManager
value: "npm"
# Use the same workspace where the code was cloned
workspaces:
- name: source
workspace: shared-workspace
- name: run-tests
taskRef:
name: npm-test # And another one
kind: Task
runAfter:
- install-dependencies
params:
- name: packageManager
value: "npm"
workspaces:
- name: source
workspace: shared-workspace
workspaces:
- name: shared-workspace # Define the workspace used by the tasks
This Pipeline definition is remarkably concise. The heavy lifting of defining how to clone a Git repo, how to run npm install, and how to run npm test is abstracted away into reusable Tasks. Tekton Hub is where you find these Tasks.
The core problem Tekton Hub solves is the "reinventing the wheel" syndrome in CI/CD. Every team, every project, eventually needs to perform common operations: cloning code, building container images, running linters, deploying to cloud providers, sending notifications. Without a shared catalog, each team writes these steps from scratch, leading to duplicated effort, inconsistent implementations, and increased maintenance overhead.
Tekton Hub provides a standardized way to publish and discover these reusable Tasks and Pipelines. It leverages the Open Container Initiative (OCI) image format, specifically through Tekton Bundles. This means a Task or Pipeline is packaged as a container image. When you reference a Task from the Hub using its bundle (e.g., bundle: docker://ghcr.io/tektoncd/catalog/git-clone:0.3.0), Tekton tkn CLI or the Tekton controller pulls this image, extracts the Tekton resource definitions (Task or Pipeline) from it, and uses them to execute your pipeline. This ensures that the Task you’re using is exactly as it was published, providing consistency and reliability.
The system works by defining Tasks (reusable units of work) and Pipelines (sequences of Tasks). Tasks themselves are composed of Steps, which are essentially container images that run specific commands. Tekton Hub acts as a registry and discovery layer for these Tasks. You can browse by category, search by keyword, or even look at the popular and trending Tasks. Once you find a Task you like, you can reference it directly in your Pipeline definitions, either by its name if it’s installed in your cluster, or more commonly, by its OCI bundle reference.
The exact levers you control are the params and workspaces exposed by each Task. When you select a Task from the Hub, examine its documentation to understand what parameters it accepts (like url, revision, packageManager in the example) and what workspaces it requires (like source or output). These are your integration points. You provide the specific values for your project, and the Task handles the rest.
A common misconception is that Tekton Hub only hosts Tasks. While Tasks are the primary building blocks, the OCI bundle format also allows for the packaging and distribution of entire Pipelines, Conditions, and CustomTasks, making the Hub a comprehensive repository for a wide range of Tekton components.
The next step after leveraging existing Tasks from the Hub is understanding how to create and publish your own custom Tasks.