Advanced Configuration
Advanced Harness 3.0 pipeline capabilities; caching, volumes, failure strategies, execution strategies, concurrency control, container configuration, clone settings, permissions, and test reporting.
This section covers advanced pipeline capabilities including caching, volumes, failure strategies, execution strategies, concurrency control, container configuration, clone settings, permissions, and test reporting.
Caching
Caching preserves files between pipeline runs to speed up builds. Harness 3.0 supports key-based caching with automatic invalidation based on file hashes.
interface CacheConfig {
// Cache key (supports expressions and hashFiles)
key: string
// Fallback keys to try if the primary key misses
restore_keys: string[]
// Paths to cache
paths: string[]
// Cache backend (auto, s3, gcs)
backend: string
}Node.js cache
stages:
- name: build
cache:
key: node-${{ hashFiles('**/package-lock.json') }}
restore_keys:
- node-
paths:
- node_modules/
- ~/.npm
steps:
- run: npm ci
- run: npm run build
- run: npm testMulti-language cache
Volumes
Volumes provide shared storage between steps within a stage. They are useful for sharing build artifacts, caches, or data between steps that run in different containers.
Temporary volume
Host volume
Persistent volume claim
Failure strategies
Failure strategies define how the pipeline responds to errors at the step, stage, or pipeline level. Strategies can be simple actions or complex chains with escalation paths.
Error-specific strategies
Rollback strategy
Strategy (matrix & loops)
Execution strategies control how stages or steps are repeated. Harness 3.0 supports matrix expansion, for loops, and while loops.
Matrix with fail-fast
For loop with concurrency
Concurrency control
Concurrency control limits how many instances of a pipeline or stage can run simultaneously. This prevents resource contention and ensures orderly deployments.
Pipeline-level concurrency
Stage-level concurrency
Container configuration
Steps can run inside specific container images with custom configuration for pull policies, credentials, resource limits, and entry points.
Full container configuration
Privileged container (Docker-in-Docker)
Clone configuration
Configure how and whether the pipeline repository is cloned at the pipeline or stage level.
Disable clone
Custom clone configuration
Stage-level clone override
Permissions
Pipeline permissions control access to resources and operations. Permissions can be configured at the pipeline, stage, or step level.
LEAST PRIVILEGE
Always apply the principle of least privilege. Grant only the permissions that are strictly required for the pipeline to function. Avoid granting write permissions unless the pipeline actually needs to modify resources.
Test reports
Test reports collect and display test results in the Harness UI. Harness 3.0 supports JUnit and NUnit report formats with automatic parsing, trend analysis, and flaky test detection.
JUnit reports
NUnit reports
Wildcard report paths
Complete pipeline example
The following example demonstrates many advanced features combined in a single production-grade pipeline: typed inputs, caching, matrix testing, container steps, concurrency control, failure strategies, approvals, and multi-environment deployment.
Last updated
Was this helpful?