You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Using Amazon Elastic Container Service for Kubernetes (Amazon EKS)](#using-amazon-elastic-container-service-for-kubernetes-amazon-eks) | This section describes how you can use the Amazon ECS service for Kubernetes for Kubernetes-related tasks and operations.
66
66
[Deploying Applications to Heroku](#deploying-applications-to-heroku) | This section describes how you can deploy application to the Heroku platform using the CircleCI Heroku orb.
67
67
[Enabling Custom Slack Notifications in CircleCI Jobs](#enabling-custom-slack-notifications-in-circleci-jobs) | This section describes how you can enable customized Slack notifications in CircleCI jobs.
68
+
[Selecting a Workflow With a Pipeline Parameter](#selecting-a-workflow-with-a-pipeline-parameter) | This section describes how you can use pipeline parameters to run different workflows.
68
69
69
70
## Deploying Software Changes to Amazon ECS
70
71
@@ -1129,3 +1130,45 @@ version: 2.1
1129
1130
Notice in the example that the job is run and a Slack status alert is sent to your recipients (USERID1, USERID2) if the job has failed.
1130
1131
1131
1132
For more detailed information about this orb and its functionality, refer to the Slack orb in the [CircleCI Orb Registry](https://circleci.com/orbs/registry/orb/circleci/slack).
1133
+
1134
+
## Selecting a Workflow With a Pipeline Parameter
1135
+
1136
+
If you want to be able to trigger custom workflows manually via the API, but still run a workflow on every push, you can use pipeline parameters to decide which workflows to run.
Copy file name to clipboardExpand all lines: jekyll/_cci2/configuration-reference.md
+35-2
Original file line number
Diff line number
Diff line change
@@ -805,7 +805,7 @@ A conditional step consists of a step with the key `when` or `unless`. Under the
805
805
806
806
Key | Required | Type | Description
807
807
----|-----------|------|------------
808
-
condition | Y | String | A parameter value
808
+
condition | Y | Logic | [A logic statement](https://circleci.com/docs/2.0/configuration-reference/#logic-statements)
809
809
steps | Y | Sequence | A list of steps to execute when the condition is true
810
810
{: class="table table-striped"}
811
811
@@ -1547,7 +1547,7 @@ workflows:
1547
1547
1548
1548
##### **Using `when` in Workflows**
1549
1549
1550
-
With CircleCI v2.1 configuration, you may use a `when` clause (the inverse clause `unless` is also supported) under a workflow declaration with a truthy or falsy value to determine whether or not to run that workflow. The most common use of `when` is with [CircleCI API v2 pipeline triggering](https://circleci.com/docs/api/v2/#trigger-a-new-pipeline) with parameters. Truthy/falsy calues can be booleans, numbers, and strings. Falsy would be any of: false, 0, empty string, null, and NaN. Everything else would be truthy.
1550
+
With CircleCI v2.1 configuration, you may use a `when` clause (the inverse clause `unless` is also supported) under a workflow declaration with a [logic statement](https://circleci.com/docs/2.0/configuration-reference/#logic-statements) to determine whether or not to run that workflow.
1551
1551
1552
1552
The example configuration below uses a pipeline parameter, `run_integration_tests` to drive the `integration_tests` workflow.
1553
1553
@@ -1582,6 +1582,39 @@ This example prevents the workflow `integration_tests` from running unless the t
1582
1582
1583
1583
Refer to the [Orchestrating Workflows]({{ site.baseurl }}/2.0/workflows) document for more examples and conceptual information.
1584
1584
1585
+
## Logic Statements
1586
+
1587
+
Certain dynamic configuration features accept logic statements as arguments. Logic statements are evaluated to boolean values at configuration compilation time, so before the workflow is run. The group of logic statements includes:
YAML literal | None | is truthy | `true`/`42`/`"a string"`
1592
+
[Pipeline Value](https://circleci.com/docs/2.0/pipeline-variables/#pipeline-values) | None | resolves to a truthy value | `<< pipeline.git.branch >>`
1593
+
[Pipeline Parameter](https://circleci.com/docs/2.0/pipeline-variables/#pipeline-parameters-in-configuration) | None | resolves to a truthy value | `<< pipeline.parameter.my-parameter >>`
1594
+
and | N logic statements | all arguments are truthy | `and: [ true, true, false ]`
1595
+
or | N logic statements | any argument is truthy | `or: [ false, true, false ]`
1596
+
not | 1 logic statement | the argument is not truthy | `not: true`
1597
+
equal | N values | all arguments evaluate to equal values | `equal: [ 42, << pipeline.number >>]`
1598
+
{: class="table table-striped"}
1599
+
1600
+
Truthiness rules are as follows:
1601
+
1602
+
`false`, `null`, `0`, the empty string, and `NaN` are falsy. Any other value is truthy.
1603
+
1604
+
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.
0 commit comments