Inputs & Variables
Typed pipeline inputs, expression syntax, and output variables for building dynamic, reusable Harness 3.0 pipelines.
Harness 3.0 introduces a fully typed input system that replaces the runtime inputs of previous versions. Inputs are declared at the pipeline level with explicit types, default values, validation rules, and descriptions. Combined with a powerful expression syntax, inputs and variables enable dynamic, reusable pipelines.
Input types
string
Free-form text value. Supports regex validation.
"v1.2.3"
number
Numeric value. Supports min/max validation.
42
boolean
True or false value.
true
array
List of values. Supports item type validation.
["us-east-1", "eu-west-1"]
duration
Time duration string.
"30m", "2h", "1d"
choice
Selection from a predefined list of options.
"staging"
environment
Reference to a Harness environment entity.
"production"
secret
Reference to a Harness secret. Value is masked in logs.
"account.docker_password"
step
Reference to a step template.
"deploy-k8s@1.0.0"
object
Structured key-value object.
{ region: "us-east-1", count: 3 }
Input schema
interface Input {
// Input data type
type: "string" | "number" | "boolean" | "array"
| "duration" | "choice" | "environment"
| "secret" | "step" | "object"
// Default value (used when no value is provided at runtime)
default: any
// Human-readable description (shown in the UI)
description: string
// Whether this input is required
required: boolean
// Validation rules
validation:
| { regex: string; message: string }
| { min: number; max: number }
// Options for choice type
options: string[]
// Whether multiple selections are allowed (choice type)
multiple: boolean
// Item type for array inputs
items: { type: string }
// Properties for object type
properties: Record<string, Input>
}Complete input examples
Expression syntax
Expressions use the ${{ }} syntax to dynamically resolve values at runtime. Harness 3.0 supports variables from multiple contexts and built-in functions.
Variable contexts
${{ inputs.<name> }}
Pipeline input variable value.
${{ matrix.<key> }}
Current matrix dimension value.
${{ strategy.iteration }}
Current iteration index in a for/while loop.
${{ strategy.total }}
Total number of iterations.
${{ trigger.branch }}
Branch that triggered the pipeline.
${{ trigger.event }}
Trigger event type (push, pull_request, etc.).
${{ trigger.commit_sha }}
Full commit SHA that triggered the build.
${{ trigger.user }}
User who triggered the pipeline.
${{ pipeline.sequenceId }}
Auto-incrementing pipeline execution number.
${{ pipeline.executionId }}
Unique identifier for this execution.
${{ stages.<name>.output.<key> }}
Output variable from a previous stage.
${{ steps.<name>.output.<key> }}
Output variable from a previous step.
${{ secrets.<name> }}
Secret value (masked in logs).
${{ service.name }}
Current service name in multi-service stages.
${{ environment.name }}
Current environment name.
Built-in functions
Outputs
Steps and stages can produce output variables that are consumed by subsequent steps or stages. Outputs are the primary mechanism for passing data between pipeline components.
Step outputs with HARNESS_OUTPUT
Write key-value pairs to the $HARNESS_OUTPUT file to create output variables.
Stage outputs
Step outputs are promoted to stage outputs and can be referenced from subsequent stages.
Declaring outputs explicitly
Use the outputs property to explicitly declare which variables a step will produce. This improves documentation and enables validation.
Last updated
Was this helpful?