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/migrating-from-1-2.md
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,9 @@ categories: [migration]
7
7
order: 15
8
8
---
9
9
10
-
CircleCI 2.0 introduces the requirement that you create a configuration file (`.circleci/config.yml`) and it adds new required keys for which values must be defined. If you already have a `circle.yml` file, this article will help you add the new required keys and values and then search and replace your 1.0 keys with 2.0 keys. If you do not have a `circle.yml` file, refer to the [Sample 2.0 `config.yml` File]({{ site.baseurl }}/2.0/sample-config) to get started from scratch.
10
+
CircleCI 2.0 introduces the requirement that you create a configuration file (`.circleci/config.yml`), and it adds new required keys for which values must be defined. This release also allows you to use multiple jobs in your configuration. **Note:** If you configure multiple jobs, it is important to have parallelism set to `1` to prevent duplication of job runs.
11
+
12
+
If you already have a `circle.yml` file, this article will help you add the new required keys and values and then search and replace your 1.0 keys with 2.0 keys. If you do not have a `circle.yml` file, refer to the [Sample 2.0 `config.yml` File]({{ site.baseurl }}/2.0/sample-config) to get started from scratch.
Copy file name to clipboardExpand all lines: jekyll/_cci2/workflows.md
+26-8Lines changed: 26 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -7,11 +7,11 @@ categories: [configuring-jobs]
7
7
order: 30
8
8
---
9
9
10
-
This section describes the Workflows feature and provides examples for parallel, sequential, fan-in, fan-out, and branch-level workflows. To enable Workflows, you must first split the single job in your `config.yml` file into multiple jobs, if you have not already done so. Job names must be unique within a `config.yml` file.
10
+
This section describes the Workflows feature and provides examples for parallel, sequential, fan-in, fan-out, and branch-level workflows. To enable Workflows, you must first split the single job in your CircleCI 2.0 `config.yml` file into multiple jobs with unique names, if you have not already done so. Job names must be unique within a `config.yml` file. See [Migrating from 1.0 to 2.0]({{ site.baseurl }}/2.0/migrating-from-1-2/) for instructions.
11
11
12
12
## Overview
13
13
14
-
A workflow is a set of rules for defining a collection of jobs and their run order. The Workflows feature is designed with a flexible algorithm to support very complex job scheduling and orchestration using a simple set of new configuration keys. Consider configuring workflows if you need to meet any of the following requirements:
14
+
A workflow is a set of rules for defining a collection of jobs and their run order. The Workflows feature is designed with a flexible algorithm to support very complex job scheduling and orchestration using a simple set of new configuration keys. Consider configuring Workflows if you need to meet any of the following requirements:
15
15
16
16
- Run and troubleshoot jobs independently
17
17
- Fan-out to run multiple jobs in parallel for testing various versions
@@ -34,9 +34,26 @@ The basic Workflows configuration runs all jobs in parallel. That is, jobs liste
To run a set of parallel jobs, add a new `workflows:` section to the end of your existing configuration file with the version and a unique name for the workflow. The following `.circleci/config.yml` file snippet shows an example workflow with four parallel jobs. It is defined by using the `workflows:` key named `build-and-test` and by nesting the `jobs:` key with a list of job names. The jobs have no dependencies defined, therefore they will run in parallel.
37
+
To run a set of parallel jobs, add a new `workflows:` section to the end of your existing `.circleci/config.yml` file with the version and a unique name for the workflow. The following sample `.circleci/config.yml` file shows the default workflow orchestration with four parallel jobs. It is defined by using the `workflows:` key named `build-and-test` and by nesting the `jobs:` key with a list of job names. The jobs have no dependencies defined, therefore they will run in parallel.
38
38
39
39
```
40
+
version: 2
41
+
jobs:
42
+
build:
43
+
working_directory: ~/<project root directory>
44
+
docker:
45
+
- image: circleci/<language>:<version TAG>
46
+
steps:
47
+
- checkout
48
+
test1:
49
+
steps:
50
+
- run: <command>
51
+
test2:
52
+
steps:
53
+
- run: <command>
54
+
test3:
55
+
steps:
56
+
- run: <command>
40
57
workflows:
41
58
version: 2
42
59
build-and-test:
@@ -49,7 +66,7 @@ workflows:
49
66
50
67
## Sequential Job Execution Example
51
68
52
-
The following example shows a workflow with four sequential jobs. The jobs run according to configured requirements, each job waiting to start until the required job finishes successfully as illustrated in the diagram.
69
+
The following example shows a workflow with four sequential jobs. The jobs run according to configured requirements, each job waiting to start until the required job finishes successfully as illustrated in the diagram.
The dependencies are defined by setting the `requires:` key as shown. The `deploy:` job will not run until the `build` and `test1` and `test2` jobs complete successfully. A job must wait until all upstream jobs in the dependency graph have run. So, the `deploy` job waits for the `test2` job, the `test2` job waits for the `test1` job and the `test1` job waits for the `build` job.
76
93
77
-
The Workflows feature also enables you to limit the job execution to a branch with the `filters` key. See the Branch-Level Job Execution section for instructions.
78
-
79
94
## Running a Workflow from a Failed Job
80
95
81
96
It is possible to rerun a job that failed in the middle of a workflow and continue the rest of the workflow using the Rerun button on the Workflows page of the CircleCI application.
@@ -121,7 +136,8 @@ workflows:
121
136
- acceptance_test_3
122
137
- acceptance_test_4
123
138
```
124
-
139
+
In this example, as soon as the `build` job finishes successfully, all four acceptance test jobs start. The `deploy` job must wait for all four acceptance test jobs to complete successfully before it starts.
140
+
125
141
## Branch-Level Job Execution
126
142
The following example shows a workflow configured with jobs on three branches: Dev, Stage, and Pre-Prod.
127
143
@@ -148,9 +164,11 @@ workflows:
148
164
only: pre-prod
149
165
```
150
166
167
+
In the example, `filters` is set with the `branches` key and the `only` key with the branch name. Any branches that match the value of `only` will run the job.
168
+
151
169
## Using Workspaces to Share Artifacts Among Jobs
152
170
153
-
Workflows that include jobs running on multiple branches may require artifacts to be shared using workspaces. Workspace are also useful for projects in which compiled artifacts are used by test containers. For example, Scala projects typically require lots of CPU for compilation in the build job. In contrast, the Scala test jobs are not CPU-intensive and may be parallelised across containers well. Using a larger container for the build job and saving the compiled artifacts into the workspace enables the test containers to use the compiled Scala from the build job.
171
+
Workflows that include jobs running on multiple branches may require artifacts to be shared using workspaces. Workspaces are also useful for projects in which compiled artifacts are used by test containers. For example, Scala projects typically require lots of CPU for compilation in the build job. In contrast, the Scala test jobs are not CPU-intensive and may be parallelised across containers well. Using a larger container for the build job and saving the compiled artifacts into the workspace enables the test containers to use the compiled Scala from the build job.
154
172
155
173
To persist an artifact from a job and make it available to other jobs, configure the job to use the `persist_to_workspace` key where the value is a directory inside the project’s working directory. Artifacts of the job will be saved to this directory until the job is rerun and new artifacts are created.
0 commit comments