Specifying remote tasks using hub resolvers

TOC

Feature Overview

Tasks are reusable blocks for your CI/CD processes. When creating a pipeline run or task run, you can specify a remote task from the Catalog available on Hub. A default Hub instance is provided, you can use it directly.

Steps

1. Select a Task Using the Web Console

  1. Go to Container Platform.
  2. In the left navigation bar, click Pipelines > Pipelines.
  3. Create a Pipeline, then you can select a remote Task from the Catalog.

2. Specifying the remote task using the hub resolver

To specify a remote task, use the following reference format in the taskRef:

# ...
  taskRef:
    resolver: hub
    params:
    - name: catalog
      value: catalog
    - name: kind
      value: task
    - name: name
      value: <resource_name>
    - name: version
      value: "<resource_version>"
# ...
ParameterDescriptionExample value
catalogThe catalog for pulling the resource.catalog
kindEither task or pipeline.task
nameThe name of the task or pipeline to fetch from the hub.git-cli
versionThe version of the task or pipeline to fetch from the hub. You must use quotes (") around the number."0.4"

If the task requires additional parameters, specify values for these parameters in the params section of the specification of the pipeline, or task run. The params section of the taskRef specification must contain only the parameters that the resolver supports.

Examples:

The following example pipeline references a remote task from the catalog:

apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
  name: pipeline-with-hub-task-reference-demo
spec:
  tasks:
  - name: "cluster-task-reference-demo"
    taskRef:
      resolver: hub
      params:
      - name: catalog
        value: catalog
      - name: kind
        value: task
      - name: name
        value: git-cli
      - name: version
        value: "0.4"
    params:
    - name: sample-task-parameter
      value: "foo"

The following example task run references a remote task from the catalog:

apiVersion: tekton.dev/v1
kind: TaskRun
metadata:
  name: hub-task-reference-demo
spec:
  taskRef:
    resolver: hub
    params:
    - name: catalog
      value: catalog
    - name: kind
      value: task
    - name: name
      value: git-cli
    - name: version
      value: "0.4"
  params:
  - name: sample-task-parameter
    value: "foo"

Learn More