Skip to content

Commit 118d81d

Browse files
Merge pull request circleci#1143 from circleci/michelle-luna-patch-1
Michelle luna patch 1
2 parents 9b643e9 + e661919 commit 118d81d

File tree

2 files changed

+29
-9
lines changed

2 files changed

+29
-9
lines changed

jekyll/_cci2/migrating-from-1-2.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ categories: [migration]
77
order: 15
88
---
99

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

1214
## Steps to Configure Required 2.0 Keys
1315

jekyll/_cci2/workflows.md

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ categories: [configuring-jobs]
77
order: 30
88
---
99

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

1212
## Overview
1313

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:
1515

1616
- Run and troubleshoot jobs independently
1717
- 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
3434

3535
![Parallel Job Execution Workflow]({{ site.baseurl }}/assets/img/docs/parallel_jobs.png) 
3636

37-
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.
3838

3939
```
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>
4057
workflows:
4158
version: 2
4259
build-and-test:
@@ -49,7 +66,7 @@ workflows:
4966

5067
## Sequential Job Execution Example
5168

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

5471
![Sequential Job Execution Workflow]({{ site.baseurl }}/assets/img/docs/sequntial_workflow.png)
5572

@@ -74,8 +91,6 @@ workflows:
7491

7592
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.
7693

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-
 
7994
## Running a Workflow from a Failed Job
8095

8196
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:
121136
           - acceptance_test_3
122137
           - acceptance_test_4
123138
```
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+
125141
## Branch-Level Job Execution
126142
The following example shows a workflow configured with jobs on three branches: Dev, Stage, and Pre-Prod.
127143

@@ -148,9 +164,11 @@ workflows:
148164
             only: pre-prod
149165
```
150166

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+
151169
## Using Workspaces to Share Artifacts Among Jobs
152170

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

155173
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.
156174

0 commit comments

Comments
 (0)