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: jekyll/_cci2/defining-multiple-jobs.md
+46Lines changed: 46 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -53,3 +53,49 @@ A few notes about this example:
53
53
54
54
-`CIRCLE_API_TOKEN` should be the API token from your project's setting page.
55
55
-`<vcs-type>/<org>/<repo>` should be replaced with your own VCS and org/repo names; at time of writing, `<vcs-types>` must be either `github` or `bitbucket`.
56
+
57
+
## Conditionally triggering jobs
58
+
59
+
Building on the previous example, suppose you want to build docker images with `setup_remote_docker` only for builds that should be deployed. You can use a config such as the following:
60
+
61
+
```YAML
62
+
build:
63
+
docker:
64
+
- image: ruby:2.4.0
65
+
environment:
66
+
- LANG: C.UTF-8
67
+
working_directory: /my-project
68
+
parallelism: 2
69
+
steps:
70
+
- checkout
71
+
72
+
- run:
73
+
name: Tests
74
+
command: |
75
+
echo "run some tests"
76
+
77
+
- deploy:
78
+
name: conditionally run a deploy job
79
+
command: |
80
+
# replace this with your build/deploy check (i.e. current branch is "release")
- Using the `deploy` step in the build job is important so that you don't trigger N builds, where N is your parallelism level.
100
+
- We use an API call with `build_parameters[CIRCLE_JOB]=deploy_docker` so that only the `deploy_docker` job will be run.
101
+
- **This approach is a temporary workaround for the current features available during Beta.** Soon we'll be adding a much more elegant way to manage multiple jobs.
0 commit comments