---
title: "Config templating"
description: "Use compile-time config templating to insert pipeline values and parameters into your CircleCI configuration."
doc_version: "unversioned"
last_updated: "2026-09-10"
---

> For the complete documentation index, see [llms.txt](https://circleci.com/docs/llms.txt)

# Config templating

CircleCI can update your `.circleci/config.yml` at compile time using pipeline values and parameters. This config templating lets you insert values and check conditions.

## Insert a pipeline value

Wrap a pipeline value or pipeline parameter in `<<` and `>>` to insert it into a string or field:

Insert a pipeline value into a job step

```yaml
version: 2.1

jobs:
  build:
    docker:
      - image: cimg/base:current
    steps:
      - run: echo "This pipeline is on << pipeline.git.branch >>"
```

Insert a pipeline parameter into a job image

```yaml
version: 2.1

parameters:
  image-tag:
    type: string
    default: "current"

jobs:
  build:
    docker:
      - image: cimg/base:<< pipeline.parameters.image-tag >>
    steps:
      - checkout
```

For the full list of values you can insert, see the [Pipeline Values and Parameters](https://circleci.com/docs/guides/orchestrate/pipeline-variables/) page.

The YAML merge key `<<:` is a different feature. See [Merging Maps](https://circleci.com/docs/guides/getting-started/introduction-to-yaml-configurations/#merging-maps) in the YAML introduction.

## Add logic with expressions

Expressions add comparison and logic operators to this templating syntax. Use them to set a field from a condition, or to decide whether a job or workflow runs.

The job `filters`, and workflow `when` and `unless` fields accept expressions directly. For other fields wrap the expression in `<<` and `>>`.

Direct expression in a job filter

```yaml
version: 2.1

parameters:
  run-storybook-tests:
    type: boolean
    default: false

...
# jobs configuration omitted for brevity

workflows:
  build:
    jobs:
      - setup
      - storybook-tests:
# The "storybook-tests" job only runs if the "setup" job completes successfully AND if either the "run-storybook-test"s pipeline parameter is true OR the branch name is "dry-run-deploy" OR the branch name starts with "deploy".
          requires:
            - setup
          filters: |
            pipeline.parameters.run-storybook-tests
            or pipeline.git.branch == "dry-run-deploy"
            or pipeline.git.branch starts-with "deploy"
```

Direct expression in a workflow `when` clause

```yaml
workflows:
  nightly-run-workflow:
# The "nightly-run-workflow" workflow only runs if the branch name is "main" OR "staging".
    when: pipeline.git.branch == "main" or pipeline.git.branch == "staging"
    jobs:
      - build
      - deploy:
          requires:
            - build
```

Direct expression in a workflow `unless` clause

```yaml
version: 2.1

jobs:
  build:
    docker:
      - image: cimg/base:current
    steps:
      - checkout

workflows:
  feature-workflow:
    unless: pipeline.git.branch == "main"
    jobs:
      - build
```

Expression wrapped in `<<` and `>>`

```yaml
version: 2.1

jobs:
  test:
    docker:
      - image: cimg/base:current
    parallelism: << pipeline.git.branch == "main" and 10 or 1 >>
    steps:
      - checkout
```

For operators and more examples, see [Using Expressions in Your Configuration](https://circleci.com/docs/reference/configuration-reference/#using-expressions-in-your-configuration).

## How this differs from dynamic configuration

Config templating edits the config you already have, before CircleCI assembles the pipeline. [Dynamic Configuration](https://circleci.com/docs/guides/orchestrate/dynamic-config/) uses a setup workflow to generate or continue with a different config at runtime.

## Next steps

*   [Pipeline Values and Parameters](https://circleci.com/docs/guides/orchestrate/pipeline-variables/)
    
*   [Using Expressions in Your Configuration](https://circleci.com/docs/reference/configuration-reference/#using-expressions-in-your-configuration)
    
*   [Branch and Tag Filtering](https://circleci.com/docs/guides/orchestrate/using-branch-filters/)
    
*   [Dynamic Configuration Overview](https://circleci.com/docs/guides/orchestrate/dynamic-config/)