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
+23-9Lines changed: 23 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -7,13 +7,19 @@ 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. 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.
10
+
This document will give you a starting place for migrating from CircleCI 1.0 to 2.0 by using a copy of your existing 1.0 configuration file and replacing the old keys with the new keys if equivalents exist. The migration process may not end with this document, but the goal is to get the majority of keys replaced with the equivalent syntax nesting and to help you get started with adding new functionality.
11
11
12
-
If you already have a `circle.yml` file, this article will help you make a copy your existing file, create the new required keys, 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.
12
+
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.
13
13
14
14
* Contents
15
15
{:toc}
16
16
17
+
## Overview
18
+
19
+
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.
20
+
21
+
If you already have a `circle.yml` file, the following sections describe how to make a copy your existing file, create the new required keys, and then search and replace your 1.0 keys with 2.0 keys.
22
+
17
23
## Steps to Configure Required 2.0 Keys
18
24
19
25
1. Copy your existing `circle.yml` file into a new directory called `.circleci` at the root of your project repository.
@@ -22,12 +28,12 @@ If you already have a `circle.yml` file, this article will help you make a copy
22
28
23
29
3. Add `version: 2` to the top of the `.circleci/config.yml` file.
24
30
25
-
4. Add the following two lines to your `config.yml` file, after the version line. If your configuration includes `machine:`, replace `machine:` with the following two lines, nesting all of the following sections under `build`.
31
+
4. Add the following two lines to your `config.yml` file, after the version line. If your configuration includes `machine:`, replace `machine:` with the following two lines, nesting all of the sections of the old config file under `build`.
26
32
```
27
33
jobs:
28
34
build:
29
35
```
30
-
5. Add the language and version to your configuration using either the `docker:` and `- image:` keys in the example or by setting `machine: true`. If your configuration includes language and version as shown for `ruby:` below, replace it as shown.
36
+
5. Add the language and version you want to run the primary container to your configuration using either the `docker:` and `- image:` keys in the example or by setting `machine: true`. If your configuration includes language and version as shown for `ruby:` below, replace it as shown.
31
37
```
32
38
ruby:
33
39
version: 2.3
@@ -37,7 +43,7 @@ If you already have a `circle.yml` file, this article will help you make a copy
37
43
docker:
38
44
- image: circleci/ruby:2.3
39
45
```
40
-
The primary container is an instance of the first list image listed. Your build commands run in this container and must be declared for each job.
46
+
The primary container is an instance of the first list image listed. Your build commands run in this container and must be declared for each job.
41
47
42
48
6. The `checkout:` step is required to run jobs on your source files. Nest `checkout:` under `steps:` for every job by search and replacing
43
49
```
@@ -50,6 +56,8 @@ If you already have a `circle.yml` file, this article will help you make a copy
50
56
- checkout
51
57
- run:
52
58
```
59
+
If you do not have a `checkout` step, you must add this step to your `config.yml` file.
60
+
53
61
7. Validate your YAML at <http://codebeautify.org/yaml-validator> to check the changes.
54
62
55
63
## Steps to Configure Workflows
@@ -93,7 +101,7 @@ Optionally configure workflows, using the following instructions:
93
101
branches:
94
102
ignore: master
95
103
```
96
-
6. Validate your YAML again at <http://codebeautify.org/yaml-validator> to check the changes.
104
+
6. Validate your YAML again at <http://codebeautify.org/yaml-validator> to check that it is well-formed.
97
105
98
106
## Search and Replace Deprecated 2.0 Keys
99
107
@@ -115,8 +123,8 @@ With the following to load it into your shell (the file $BASH_ENV already exists
- Search and replace the `hosts:` key, for example:
@@ -181,4 +189,10 @@ With the following, nested under `steps:` and customizing for your application a
181
189
182
190
## Validate YAML
183
191
184
-
When you have all the sections in `.circleci/config.yml` we recommend that you validate your YAML syntax using a tool such as <http://codebeautify.org/yaml-validator>. Fix up any issues and commit the updated `.circleci/config.yml` file. When you push a commit the job will start automatically and you can monitor it in the CircleCI app.
192
+
When you have all the sections in `.circleci/config.yml` we recommend that you check that your YAML syntax is well-formed using a tool such as <http://codebeautify.org/yaml-validator>. Then, use the `circleci` CLI to validate that the new configuration is correct with regard to the CircleCI 2.0 schema. See the [Using the CircleCI Command Line Interface (CLI)]({{ site.baseurl }}/2.0/local-jobs/) document for instructions. Fix up any issues and commit the updated `.circleci/config.yml` file. When you push a commit the job will start automatically and you can monitor it in the CircleCI app.
193
+
194
+
## Next Steps
195
+
196
+
- Refer to the [Specifying Container Images]({{ site.baseurl }}/2.0/executor-types/) document for more information about Docker and Machine images in CircleCI 2.0.
197
+
- Refer to the [Writing Jobs With Steps]({{ site.baseurl }}/2.0/configuration-reference/) document for details on the exact syntax of CircleCI 2.0 `jobs` and `steps` and all available options.
0 commit comments