Back to Pipeline

Bundles Resolver

docs/bundle-resolver.md

1.12.08.0 KB
Original Source
<!-- --- linkTitle: "Bundles Resolver" weight: 308 --- -->

Bundles Resolver

Resolver Type

This Resolver responds to type bundles.

Parameters

Param NameDescriptionExample Value
secretThe name of the secret to use when constructing registry credentialsdefault
bundleThe bundle url pointing at the image to fetchgcr.io/tekton-releases/catalog/upstream/golang-build:0.1
nameThe name of the resource to pull out of the bundlegolang-build
kindThe resource kind to pull out of the bundletask
cacheControls caching behavior for the resolved resourcealways, never, auto

Requirements

  • A cluster running Tekton Pipeline v0.41.0 or later.
  • The built-in remote resolvers installed.
  • The enable-bundles-resolver feature flag in the resolvers-feature-flags ConfigMap in the tekton-pipelines-resolvers namespace set to true.
  • Beta features enabled.

Configuration

This resolver uses a ConfigMap for its settings. See ../config/resolvers/bundleresolver-config.yaml for the name, namespace and defaults that the resolver ships with.

Options

Option NameDescriptionDefault ValueRequiredExample Values
backoff-durationThe initial duration for backoff retries.2sfalse500ms, 2s
backoff-factorThe factor by which the sleep duration increases at each retry step.2.0false2.5, 4.0
backoff-jitterRandom jitter added to each backoff duration (duration * jitter).0.1false0.1, 0.5
backoff-stepsThe number of backoff retries to attempt.2false3, 7
backoff-capThe maximum backoff duration. If reached, remaining retry steps are capped.10sfalse10s, 20s
default-service-accountThe default service account name to use for bundle requests.defaulttruebuild-bot, default
default-kindThe default layer kind in the bundle image.tasktruetask, pipeline

Caching Options

The bundle resolver supports caching of resolved resources to improve performance. The caching behavior can be configured using the cache option:

Cache ValueDescription
alwaysAlways cache resolved resources. This is the most aggressive caching strategy and will cache all resolved resources regardless of their source.
neverNever cache resolved resources. This disables caching completely.
autoCaching will only occur for bundles pulled by digest. (default)

Cache Configuration

The resolver cache can be configured globally using the resolver-cache-config ConfigMap. This ConfigMap controls the cache size and TTL (time-to-live) for all resolvers.

Option NameDescriptionDefault ValueExample Values
max-sizeMaximum number of entries in the cache1000500, 2000
ttlTime-to-live for cache entries5m10m, 1h

The ConfigMap name can be customized using the RESOLVER_CACHE_CONFIG_MAP_NAME environment variable. If not set, it defaults to resolver-cache-config.

Additionally, you can set a default cache mode for the bundle resolver by adding the default-cache-mode option to the bundleresolver-config ConfigMap. This overrides the system default (auto) for this resolver:

Option NameDescriptionValid ValuesDefault
default-cache-modeDefault caching behavior when cache parameter is not specifiedalways, never, autoauto

Example:

yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: bundleresolver-config
  namespace: tekton-pipelines-resolvers
data:
  default-cache-mode: "always"  # Always cache unless task/pipeline specifies otherwise

Usage

Task Resolution

yaml
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
  name: remote-task-reference
spec:
  taskRef:
    resolver: bundles
    params:
    - name: bundle
      value: docker.io/ptasci67/example-oci@sha256:053a6cb9f3711d4527dd0d37ac610e8727ec0288a898d5dfbd79b25bcaa29828
    - name: name
      value: hello-world
    - name: kind
      value: task

Pipeline Resolution

Unfortunately the Tekton Catalog does not publish pipelines at the moment. Here's an example PipelineRun that talks to a private registry but won't work unless you tweak the bundle field to point to a registry with a pipeline in it:

yaml
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
  name: bundle-demo
spec:
  pipelineRef:
    resolver: bundles
    params:
    - name: bundle
      value: 10.96.190.208:5000/simple/pipeline:latest
    - name: name
      value: hello-pipeline
    - name: kind
      value: pipeline
  params:
  - name: username
    value: "tekton pipelines"

ResolutionRequest Status

ResolutionRequest.Status.RefSource field captures the source where the remote resource came from. It includes the 3 subfields: url, digest and entrypoint.

  • uri: The image repository URI
  • digest: The map of the algorithm portion -> the hex encoded portion of the image digest.
  • entrypoint: The resource name in the OCI bundle image.

Example:

  • TaskRun Resolution
yaml
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
  name: remote-task-reference
spec:
  taskRef:
    resolver: bundles
    params:
    - name: bundle
      value: gcr.io/tekton-releases/catalog/upstream/git-clone:0.7
    - name: name
      value: git-clone
    - name: kind
      value: task
  params:
    - name: url
      value: https://github.com/octocat/Hello-World
  workspaces:
    - name: output
      volumeClaimTemplate:
        spec:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: 500Mi
  • ResolutionRequest
yaml
apiVersion: resolution.tekton.dev/v1beta1
kind: ResolutionRequest
metadata:
  ...
  labels:
    resolution.tekton.dev/type: bundles
  name: bundles-21ad80ec13f3e8b73fed5880a64d4611
  ...
spec:
  params:
  - name: bundle
    value: gcr.io/tekton-releases/catalog/upstream/git-clone:0.7
  - name: name
    value: git-clone
  - name: kind
    value: task
status:
  annotations: ...
  ...
  data: xxx
  observedGeneration: 1
  refSource:
    digest:
      sha256: f51ca50f1c065acba8290ef14adec8461915ecc5f70a8eb26190c6e8e0ededaf
    entryPoint: git-clone
    uri: gcr.io/tekton-releases/catalog/upstream/git-clone

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License.