Atkins supports variables at pipeline, job, and step levels with two interpolation syntaxes.
Interpolation Syntax
${{ expr }}
- Atkins Variables
Atkins uses ${{ expr }}
for variable interpolation. This avoids conflicts with bash ${var}
:
vars:
name: world
jobs:
hello:
steps:
- run: echo "Hello, ${{ name }}!"
$(command)
- Shell Execution
Shell command output can populate variable values:
vars:
date: $(date +%Y-%m-%d)
jobs:
show:
steps:
- run: echo "Today is ${{ date }}"
Static Variables
name: Static Variables
vars:
app_name: myservice
version: 1.0.0
debug: true
jobs:
info:
aliases: [default]
steps:
- run: echo "App ${{ app_name }} v${{ version }}"
- run: echo "Debug mode ${{ debug }}"

Dynamic Shell Variables
name: Dynamic Variables
vars:
hostname: $(hostname)
user: $(whoami)
pwd: $(pwd)
jobs:
info:
aliases: [default]
steps:
- run: echo "Host ${{ hostname }}"
- run: echo "User ${{ user }}"
- run: echo "Directory ${{ pwd }}"

Nested Variables
Access nested values with dot notation:
name: Nested Variables
vars:
build:
output: bin
name: app
deploy:
target: production
region: us-east
jobs:
show:
aliases: [default]
steps:
- run: echo "Output to ${{ build.output }}/${{ build.name }}"
- run: echo "Deploy to ${{ deploy.target }} in ${{ deploy.region }}"

Environment Variables
Set environment variables with env:
:
name: Environment Variables
env:
vars:
APP_ENV: production
LOG_LEVEL: info
DEBUG: "false"
jobs:
show:
aliases: [default]
steps:
- run: echo "Environment $APP_ENV"
- run: echo "Log level $LOG_LEVEL"

Variable Scope
Variables cascade from pipeline to job to step:
name: Variable Scope
vars:
level: pipeline
jobs:
override:
aliases: [default]
vars:
level: job
steps:
- run: echo "Level is ${{ level }}"
- vars:
level: step
run: echo "Level is ${{ level }}"

Coexistence with Shell
Atkins ${{ }}
and shell $VAR
/${VAR}
can coexist without escaping:
vars:
binary: app
jobs:
build:
steps:
# ${{ binary }} resolved by Atkins before execution
# $USER and ${GIT_TAG} resolved by shell at runtime
- run: echo "Building ${{ binary }} as $USER at ${GIT_TAG}"
Atkins resolves ${{ }}
interpolations first, then passes the resulting command to the shell which handles $VAR
and ${VAR}
references.
See Also
- Pipeline - Pipeline-level configuration
- Templating - Expression syntax