For the complete documentation index, see llms.txt. This page is also available as Markdown.

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 test

Multi-language cache

CACHE INVALIDATION

Cache keys are matched exactly. When the hash of your lock files changes, the primary key will miss and Harness will try the restore_keys in order. After the stage completes, the cache is saved under the primary key.


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.


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

REPORT AGGREGATION

When multiple report files match the glob patterns, Harness automatically aggregates all results into a single test summary. This works across parallel test splits and matrix instances.


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.

PIPELINE DESIGN

This example follows best practices for production pipelines: typed inputs with validation, dependency caching, parallel testing, security scanning, progressive deployment with staging verification, approval gates, automated rollback, and notifications regardless of outcome.

Last updated

Was this helpful?