Skip to content

Commit 0d1e75b

Browse files
authored
Merge pull request circleci#4394 from circleci/more-logic-examples
2 parents 7f0ef4f + 08d08d9 commit 0d1e75b

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

jekyll/_cci2/configuration-cookbook.md

+29-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Configuration Recipe | Description
6565
[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.
6666
[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.
6767
[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+
[Using Logic in Configuration](#using-logic-in-configuration) | This section describes how you can use pipeline values & parameters to select the work to perform.
6969

7070
## Deploying Software Changes to Amazon ECS
7171

@@ -1131,7 +1131,9 @@ Notice in the example that the job is run and a Slack status alert is sent to yo
11311131

11321132
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).
11331133

1134-
## Selecting a Workflow With a Pipeline Parameter
1134+
## Using Logic in Configuration
1135+
1136+
### Selecting a Workflow With a Pipeline Parameter
11351137

11361138
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.
11371139

@@ -1172,3 +1174,28 @@ workflows:
11721174
```
11731175

11741176
The `action` parameter will default to `build` on pushes, but you can supply a different value to select a different workflow to run, like `report`.
1177+
1178+
### Branch-filtering for Job Steps
1179+
1180+
Branch filtering has previously only been available for workflows, but with compile-time logic statements, you can implement it for job steps as well.
1181+
1182+
```yaml
1183+
version: 2.1
1184+
1185+
jobs:
1186+
my-job:
1187+
docker:
1188+
- image: cimg/base:stable
1189+
steps:
1190+
- checkout
1191+
- when:
1192+
condition:
1193+
equal: [ master, << pipeline.git.branch >> ]
1194+
steps:
1195+
- run: echo "I am on master"
1196+
1197+
workflows:
1198+
my-workflow:
1199+
jobs:
1200+
- my-job
1201+
```

0 commit comments

Comments
 (0)