Skip to content

Commit 94a173a

Browse files
Merge pull request circleci#4647 from circleci/add/yaml-alias
yaml alias config ref
2 parents 8cafdf3 + fb4543c commit 94a173a

File tree

1 file changed

+47
-13
lines changed

1 file changed

+47
-13
lines changed

jekyll/_cci2/configuration-reference.md

Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,20 +1654,19 @@ Refer to the [Orchestrating Workflows]({{ site.baseurl }}/2.0/workflows) documen
16541654

16551655
Certain dynamic configuration features accept logic statements as arguments. Logic statements are evaluated to boolean values at configuration compilation time, that is - before the workflow is run. The group of logic statements includes:
16561656

1657-
Type | Arguments | `true` if | Example
1658-
-------------------|--------------------|----------------------------------------|----------------------------------------
1659-
YAML literal | None | is truthy | `true`/`42`/`"a string"`
1660-
[Pipeline Value](https://circleci.com/docs/2.0/pipeline-variables/#pipeline-values) | None | resolves to a truthy value | `<< pipeline.git.branch >>`
1661-
[Pipeline Parameter](https://circleci.com/docs/2.0/pipeline-variables/#pipeline-parameters-in-configuration) | None | resolves to a truthy value | `<< pipeline.parameters.my-parameter >>`
1662-
and | N logic statements | all arguments are truthy | `and: [ true, true, false ]`
1663-
or | N logic statements | any argument is truthy | `or: [ false, true, false ]`
1664-
not | 1 logic statement | the argument is not truthy | `not: true`
1665-
equal | N values | all arguments evaluate to equal values | `equal: [ 42, << pipeline.number >>]`
1657+
Type | Arguments | `true` if | Example
1658+
---|---|---|---
1659+
YAML literal | None | is truthy | `true`/`42`/`"a string"`
1660+
YAML alias | None | resolves to a truthy value | *my-alias
1661+
[Pipeline Value]({{site.baseurl}}/2.0/pipeline-variables/#pipeline-values) | None | resolves to a truthy value | `<< pipeline.git.branch >>`
1662+
[Pipeline Parameter]({{site.baseurl}}/2.0/pipeline-variables/#pipeline-parameters-in-configuration) | None | resolves to a truthy value | `<< pipeline.parameters.my-parameter >>`
1663+
and | N logic statements | all arguments are truthy | `and: [ true, true, false ]`
1664+
or | N logic statements | any argument is truthy | `or: [ false, true, false ]`
1665+
not | 1 logic statement | the argument is not truthy | `not: true`
1666+
equal | N values | all arguments evaluate to equal values | `equal: [ 42, << pipeline.number >>]`
16661667
{: class="table table-striped"}
16671668

1668-
Truthiness rules are as follows:
1669-
1670-
`false`, `null`, `0`, the empty string, and `NaN` are falsy. Any other value is truthy.
1669+
Truthiness rules are as follows: `false`, `null`, `0`, the empty string, and `NaN` are falsy. Any other value is truthy.
16711670

16721671
Logic statements always evaluate to a boolean value at the top level, and coerce as necessary. They can be nested in an arbitrary fashion, according to their argument specifications, and to a maximum depth of 100 levels.
16731672

@@ -1695,8 +1694,43 @@ workflows:
16951694
- << pipeline.parameters.deploy-canary >>
16961695
```
16971696

1697+
```yaml
1698+
version: 2.1
1699+
1700+
executors:
1701+
linux-13:
1702+
docker:
1703+
- image: cimg/node:13.13
1704+
macos: &macos-executor
1705+
macos:
1706+
xcode: 11.4
1707+
1708+
jobs:
1709+
test:
1710+
parameters:
1711+
os:
1712+
type: executor
1713+
node-version:
1714+
type: string
1715+
executor: << parameters.os >>
1716+
steps:
1717+
- checkout
1718+
- when:
1719+
condition:
1720+
equal: [ *macos-executor, << parameters.os >> ]
1721+
steps:
1722+
- run: echo << parameters.node-version >>
1723+
- run: echo 0
1724+
1725+
workflows:
1726+
all-tests:
1727+
jobs:
1728+
- test:
1729+
os: macos
1730+
node-version: "13.13.0"
1731+
```
1732+
16981733
## Example Full Configuration
1699-
{:.no_toc}
17001734

17011735
{% raw %}
17021736
```yaml

0 commit comments

Comments
 (0)