Skip to content

Latest commit

 

History

History
95 lines (71 loc) · 3.56 KB

conditions.md

File metadata and controls

95 lines (71 loc) · 3.56 KB

Conditions

This document defines Conditions and their capabilities.

Syntax

To define a configuration file for a Condition resource, you can specify the following fields:

  • Required:
    • apiVersion - Specifies the API version, for example tekton.dev/v1alpha1.
    • kind - Specify the Condition resource object.
    • metadata - Specifies data to uniquely identify the Condition resource object, for example a name.
    • spec - Specifies the configuration information for your Condition resource object. In order for a Condition to do anything, the spec must include:
      • check - Specifies a container that you want to run for evaluating the condition
      • description - Description of the Condition.

Check

The check field is required. You define a single check to define the body of a Condition. The check must specify a Step. The container image runs till completion. The container must exit successfully i.e. with an exit code 0 for the condition evaluation to be successful. All other exit codes are considered to be a condition check failure.

Description

The description field is an optional field and can be used to provide description of the Condition.

Parameters

A Condition can declare parameters that must be supplied to it during a PipelineRun. Sub-fields within the check field can access the parameter values using the templating syntax:

spec:
  parameters:
    - name: image
      default: ubuntu
  check:
    image: $(params.image)

Parameters name are limited to alpha-numeric characters, - and _ and can only start with alpha characters and _. For example, fooIs-Bar_ is a valid parameter name, barIsBa$ or 0banana are not.

Each declared parameter has a type field, assumed to be string if not provided by the user. The other possible type is array — useful, for instance, checking that a pushed branch name doesn't match any of multiple protected branch names. When the actual parameter value is supplied, its parsed type is validated against the type field.

Resources

Conditions can declare input PipelineResources via the resources field to provide the Condition container step with data or context that is needed to perform the check.

Resources in Conditions work similar to the way they work in Tasks i.e. they can be accessed using variable substitution and the targetPath field can be used to control where the resource is mounted

Labels and Annotations

Labels and annotations defined as part of the Condition metadata will be automatically propagated to the Pod.

Examples

For complete examples, see the examples folder.


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.