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-8Lines changed: 23 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,10 @@ order: 15
9
9
10
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
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.
12
+
If you already have a `circle.yml` file, this article will help you make a copy your exisiting 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.
13
+
14
+
* Contents
15
+
{:toc}
13
16
14
17
## Steps to Configure Required 2.0 Keys
15
18
@@ -55,13 +58,13 @@ Optionally configure workflows, using the following instructions:
55
58
56
59
2. To persist a job artifact, add the `persist_to_workspace:<directory>` key at the end of the job, under `steps:`. Then, to get the saved artifact for use by another job, add the `attach_workspace:` key with a nested `at:<directory>` key, ideally defined as the directory where the artifact was saved.
57
60
58
-
3. Add lines for `workflows:`, `version: 2` and *<workflow_name>* at the *end* of the master `.circle/config.yml` file, replacing *<workflow_name>* with a unique name for your workflow. **Note:** The Workflows section of the `config.yml` file is not nested in the config. It is best to put the Workflows at the end of the file because the Workflows `version: 2` is in addition to the `version:` key at the top of the `config.yml` file during Beta.
61
+
3. As a best practice, add lines for `workflows:`, `version: 2` and `<workflow_name>` at the *end* of the master `.circle/config.yml` file, replacing `<workflow_name>` with a unique name for your workflow. **Note:** The Workflows section of the `config.yml` file is not nested in the config. It is best to put the Workflows at the end of the file because the Workflows `version: 2` is in addition to the `version:` key at the top of the `config.yml` file during Beta.
59
62
```
60
63
workflows:
61
64
version: 2
62
65
<workflow_name>:
63
66
```
64
-
4. Add a line for the `jobs:` key under <workflow_name> and add a list of all of the job names you want to orchestrate. In this example, `build` and `test` will run in parallel.
67
+
4. Add a line for the `jobs:` key under `<workflow_name>` and add a list of all of the job names you want to orchestrate. In this example, `build` and `test` will run in parallel.
65
68
66
69
```
67
70
workflows:
@@ -71,14 +74,26 @@ Optionally configure workflows, using the following instructions:
71
74
- build
72
75
- test
73
76
```
74
-
5. For Jobs which must run sequentially depending on success of another job, add the `requires:` key with a nested list of Jobs that must succeed for it to start. If you were using a `curl` command to start a Job, Workflows enable you to remove the command and start the job by using Workflows with the `requires:` key.
77
+
5. For jobs which must run sequentially depending on success of another job, add the `requires:` key with a nested list of jobs that must succeed for it to start. If you were using a `curl` command to start a job, Workflows enable you to remove the command and start the job by using the `requires:` key.
75
78
76
79
```
77
-
- <job_name>
78
-
requires:
79
-
- <job_name>
80
+
- <job_name>
81
+
requires:
82
+
- <job_name>
83
+
```
84
+
6. For jobs which must run on a particular branch, add the `filters:` key with a nested `branches` and `only` key. For jobs which must not run on a particular branch, add the `filters:` key with a nested `branches` and `ignore` key.
85
+
80
86
```
81
-
6. Validate your YAML again at <http://codebeautify.org/yaml-validator> to check the changes.
87
+
- <job_name>
88
+
filters:
89
+
branches:
90
+
only: master
91
+
- <job_name>
92
+
filters:
93
+
branches:
94
+
ignore: master
95
+
```
96
+
7. Validate your YAML again at <http://codebeautify.org/yaml-validator> to check the changes.
0 commit comments