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
Copy file name to clipboardExpand all lines: user/conditional-builds-stages-jobs.md
+7-15Lines changed: 7 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -7,9 +7,9 @@ You can filter out and reject builds, stages and jobs by specifying conditions i
7
7
8
8
## Conditional Builds
9
9
10
-
Configure Travis CI to only run builds when certain conditions are met. Any builds that do not meet these conditions are listed in the *Requests* tab of your repository, even though the actual build is not generated.
10
+
You can configure Travis CI to only run builds when certain conditions are met. Any builds that do not meet these conditions are listed in the *Requests* tab of your repository, even though the actual build is not generated.
11
11
12
-
For example, this allows builds only to run on the master branch:
12
+
For example, this allows builds only to run on the `master` branch:
13
13
14
14
```yaml
15
15
# require the branch name to be master (note for PRs this is the base branch name)
@@ -21,9 +21,7 @@ Build requests that do not match the condition will not generate a build, but wi
21
21
22
22
## Conditional Stages
23
23
24
-
Configure Travis CI to only include stages when certain conditions are met. Stages that do not match the given condition are silently skipped.
25
-
26
-
For example, this allows the deploy stage to run only on the master branch:
24
+
You can configure Travis CI to only include stages when certain conditions are met. Stages that do not match the given condition are silently skipped. For example, this allows the deploy stage to run only on the `master` branch:
27
25
28
26
```yaml
29
27
stages:
@@ -37,9 +35,7 @@ Stages that do not match the condition will be skipped silently.
37
35
38
36
## Conditional Jobs
39
37
40
-
Configure Travis CI to only include jobs when certain conditions are met.
41
-
42
-
For example, this includes the listed job only to builds on the master branch:
38
+
You can configure Travis CI to only include jobs when certain conditions are met. For example, this includes the listed job only to builds on the `master` branch:
43
39
44
40
```yaml
45
41
jobs:
@@ -50,15 +46,13 @@ jobs:
50
46
```
51
47
{: data-file=".travis.yml"}
52
48
53
-
Jobs need to be listed explicitly, i.e., using `jobs.include` (or its alias `matrix.include`), in order to specify conditions for them. Jobs created via [matrix expansion](/user/customizing-the-build/#build-matrix) currently cannot have conditions, but they can be conditionally excluded (see the next section).
49
+
Jobs need to be listed explicitly, i.e., using `jobs.include` (or its alias `matrix.include`), in order to specify conditions for them. Jobs created via [matrix expansion](/user/customizing-the-build/#build-matrix) currently cannot have conditions, but they can be conditionally excluded (see [below](/#conditionally-excluding-jobs)).
54
50
55
51
Jobs that do not match the condition will be skipped silently.
56
52
57
53
## Conditionally Excluding Jobs
58
54
59
-
Configure Travis CI to exclude jobs only when certain conditions are met.
60
-
61
-
For example, this will create two jobs on all branches, but only one job (with the env var `ONE=one`) on the master branch:
55
+
You can configure Travis CI to exclude jobs when certain conditions are met. For example, this will create two jobs on all branches, but only one job (with the env var `ONE=one`) on the `master` branch:
62
56
63
57
```yaml
64
58
env:
@@ -73,9 +67,7 @@ jobs:
73
67
74
68
## Conditionally Allowing Jobs To Fail
75
69
76
-
Configure Travis CI to allow jobs to fail only when certain conditions are met.
77
-
78
-
For example, this will allow the job with the env var `TWO=two` to fail when the build runs on the branch `dev`:
70
+
You can configure Travis CI to allow jobs to fail only when certain conditions are met. For example, this will allow the job with the env var `TWO=two` to fail when the build runs on the branch `dev`:
0 commit comments