Skip to content

Commit 0a20958

Browse files
committed
add pre and post steps to config ref
1 parent 4f43fd2 commit 0a20958

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

jekyll/_cci2/configuration-reference.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,6 +1585,38 @@ workflows:
15851585
- build-v0.2
15861586
```
15871587

1588+
###### **`pre-steps`** and **`post-steps`** (requires version: 2.1)
1589+
Every job invocation in a workflow may optionally accept two special arguments: `pre-steps` and `post-steps`.
1590+
1591+
Steps under `pre-steps` are executed before any of the other steps in the job. The steps under `post-steps` are executed after all of the other steps.
1592+
1593+
Pre and post steps allow you to execute steps in a given job without modifying the job. This is useful, for example, to run custom setup steps before job execution.
1594+
1595+
```yaml
1596+
version: 2.1
1597+
1598+
jobs:
1599+
bar:
1600+
machine: true
1601+
steps:
1602+
- checkout
1603+
- run:
1604+
command: echo "building"
1605+
- run:
1606+
command: echo "testing"
1607+
1608+
workflows:
1609+
build:
1610+
jobs:
1611+
- bar:
1612+
pre-steps: # steps to run before steps defined in the job bar
1613+
- run:
1614+
command: echo "install custom dependency"
1615+
post-steps: # steps to run after steps defined in the job bar
1616+
- run:
1617+
command: echo "upload artifact to s3"
1618+
```
1619+
15881620
##### **Using `when` in Workflows**
15891621

15901622
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.

0 commit comments

Comments
 (0)