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/configuration-reference.md
+7-5Lines changed: 7 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1006,12 +1006,12 @@ ignore | N | String, or List of Strings | Either a single branch specifier, or a
1006
1006
1007
1007
###### **`tags`**
1008
1008
{:.no_toc}
1009
-
CircleCI treats tag and branch filters differently when deciding whether a job should run.
1010
1009
1011
-
1. For a branch push unaffected by any filters, CircleCI runs the job.
1012
-
2. For a tag push unaffected by any filters, CircleCI skips the job.
1013
-
1014
-
Item two above means that a job **must** have a `filters` `tags` section to run as a part of a tag push and all its transitively dependent jobs **must** also have a `filters` `tags` section. Refer to the [Git Tag Job Execution]({{ site.baseurl }}/2.0/workflows/#git-tag-job-execution) section of the Orchestrating Workflows document for more examples.
1010
+
CircleCI does not run workflows for tags
1011
+
unless you explicitly specify tag filters.
1012
+
Additionally,
1013
+
if a job requires any other jobs (directly or indirectly),
1014
+
you must specify tag filters for those jobs.
1015
1015
1016
1016
Tags can have the keys `only` and `ignore` keys. You may also use regular expressions to match against tags by enclosing them with '/s', or map to a list of such strings. Regular expressions must match the **entire** string.
1017
1017
@@ -1027,6 +1027,8 @@ only | N | String, or List of Strings | Either a single tag specifier, or a list
1027
1027
ignore | N | String, or List of Strings | Either a single tag specifier, or a list of tag specifiers
1028
1028
{: class="table table-striped"}
1029
1029
1030
+
For more information,
1031
+
see the [Executing Workflows For a Git Tag]({{ site.baseurl }}/2.0/workflows/#executing-workflows-for-a-git-tag) section of the Workflows document.
Copy file name to clipboardExpand all lines: jekyll/_cci2/env-vars.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -372,7 +372,7 @@ Variable | Type | Value
372
372
`CIRCLE_PULL_REQUESTS` | List | Comma-separated list of URLs of the current build's associated pull requests.
373
373
`CIRCLE_REPOSITORY_URL` | String | The URL of your GitHub or Bitbucket repository.
374
374
`CIRCLE_SHA1` | String | The SHA1 hash of the last commit of the current build.
375
-
`CIRCLE_TAG` | String | The name of the git tag, if the current build is tagged. For more information, see the [Git Tag Job Execution]({{ site.baseurl }}/2.0/workflows/#git-tag-job-execution).
375
+
`CIRCLE_TAG` | String | The name of the git tag, if the current build is tagged. For more information, see the [Git Tag Job Execution]({{ site.baseurl }}/2.0/workflows/#executing-workflows-for-a-git-tag).
376
376
`CIRCLE_USERNAME` | String | The GitHub or Bitbucket username of the user who triggered the build.
377
377
`CIRCLE_WORKFLOW_ID` | String | A unique identifier for the workflow instance of the current job. This identifier is the same for every job in a given workflow instance.
378
378
`CIRCLE_WORKING_DIRECTORY` | String | The value of the `working_directory` key of the current job.
Copy file name to clipboardExpand all lines: jekyll/_cci2/executor-types.md
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ This document describes the `docker`, `machine`, and `macos` environments in the
16
16
{:toc}
17
17
18
18
## Overview
19
-
This version of CircleCI enables you to run jobs in one of three environments: using Docker images, using a dedicated Linux VM image, or using a macOS VM image.
19
+
This version of CircleCI enables you to run jobs in one of three environments: using Docker images, using a dedicated Linux VM image, or using a macOS VM image.
20
20
21
21
For building on Linux, there are tradeoffs to `docker` versus `machine`, as follows:
22
22
@@ -61,7 +61,7 @@ In this example, all steps run in the container created by the first image liste
61
61
62
62
More details on the Docker Executor are available in the [Configuring CircleCI]({{ site.baseurl }}/2.0/configuration-reference/) document.
63
63
64
-
###Using Machine
64
+
## Using Machine
65
65
66
66
The `machine` option will run your jobs in a dedicated, ephemeral Virtual Machine (VM) with the following technical specifications:
67
67
@@ -111,7 +111,7 @@ jobs:
111
111
docker_layer_caching: true # default - false
112
112
```
113
113
114
-
### Using macOS
114
+
## Using macOS
115
115
116
116
Using the `macos` executor allows you to run your job in a macOS environment on a VM. You can also specify which version of Xcode should be used. See the [Supported Xcode Versions section of the Testing iOS]({{ site.baseurl }}/2.0/testing-ios/#supported-xcode-versions) document for the complete list of version numbers. See the "Installed Software" links in that document for specific information about technical specifications (CPU, RAM, HD) for the VMs running each particular version of Xcode.
Copy file name to clipboardExpand all lines: jekyll/_cci2/language-ruby.md
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -46,9 +46,8 @@ version: 2 # use CircleCI 2.0
46
46
jobs: # a collection of steps
47
47
build: # runs not using Workflows must have a `build` job as entry point
48
48
parallelism: 3# run three instances of this job in parallel
49
-
working_directory: ~/circleci-demo-ruby-rails # directory where steps will run
50
49
docker: # run the steps with Docker
51
-
- image: circleci/ruby:2.4-node # ...with this image as the primary container; this is where all `steps` will run
50
+
- image: circleci/ruby:2.4.2-jessie-node # ...with this image as the primary container; this is where all `steps` will run
52
51
environment: # environment variables for primary container
53
52
BUNDLE_JOBS: 3
54
53
BUNDLE_RETRY: 3
@@ -164,24 +163,31 @@ Directly beneath `working_directory`, you can specify container images under a `
164
163
165
164
```yaml
166
165
docker:
167
-
- image: circleci/ruby:2.4-node
166
+
- image: circleci/ruby:2.4.2-jessie-node # language image
168
167
environment:
169
168
BUNDLE_JOBS: 3
170
169
BUNDLE_RETRY: 3
171
170
BUNDLE_PATH: vendor/bundle
172
171
PGHOST: 127.0.0.1
173
172
PGUSER: circleci-demo-ruby
174
173
RAILS_ENV: test
175
-
- image: circleci/postgres:9.5-alpine
174
+
- image: circleci/postgres:9.5-alpine # service image
176
175
environment:
177
176
POSTGRES_USER: circleci-demo-ruby
178
177
POSTGRES_DB: rails_blog
179
178
POSTGRES_PASSWORD: ""
180
179
```
181
180
182
-
The [official Ruby images](https://hub.docker.com/_/ruby/) are tagged to use the latest patch-level version of `2.4` and with additional packages installed for NodeJS.
181
+
In this example,
182
+
two [CircleCI convenience images]({{ site.baseurl }}/2.0/circleci-images/#image-types) are used:
183
183
184
-
The [official Postgres image](https://hub.docker.com/_/postgres/) is specified for use as the database container.
184
+
- A language image
185
+
that runs on Debian Jessie
186
+
and installs both Ruby 2.4.2 and Node.js.
187
+
188
+
- A service image
189
+
that runs on Alpine Linux
190
+
and installs PostgreSQL 9.5.
185
191
186
192
Then, several environment variables are added to connect the application container with the database for testing purposes. The `BUNDLE_*` environment variables are there to ensure proper caching and improve performance and reliability for installing dependencies with Bundler.
187
193
@@ -296,10 +302,6 @@ The `--profile` option reports the slowest examples of each run.
296
302
297
303
For more on `circleci tests glob` and `circleci tests split` commands, please refer to our documentation on [Parallelism with CircleCI CLI](https://circleci.com/docs/2.0/parallelism-faster-jobs).
298
304
299
-
---
300
-
301
-
Success! You just set up CircleCI 2.0 for a Ruby on Rails app. Check out our [Job page](https://circleci.com/gh/CircleCI-Public/circleci-demo-ruby-rails){:rel="nofollow"} to see how this looks when building on CircleCI.
302
-
303
305
## Deployment
304
306
305
307
See the [Deploy]({{ site.baseurl }}/2.0/deployment-integrations/) document for examples of deploy target configurations.
@@ -311,7 +313,5 @@ This app illustrates the simplest possible setup for a Ruby on Rails web app. Re
311
313
* [Discourse](https://github.com/CircleCI-Public/discourse/blob/master/.circleci/config.yml), an open source discussion platform.
312
314
* [Sinatra](https://github.com/CircleCI-Public/circleci-demo-ruby-sinatra), a demo app for the [simple DSL for quickly creating web applications](http://www.sinatrarb.com/).
Add an [approval job]({{ site.baseurl }}/2.0/workflows/#holding-a-workflow-for-a-manual-approval) to set up a manual gate. | Use [regex]({{ site.baseurl }}/2.0/workflows/#regular-expression-support) to [filter on branches]({{ site.baseurl }}/2.0/workflows/#branch-level-job-execution) or [filter on tags]({{ site.baseurl }}/2.0/workflows/#git-tag-job-execution).
15
+
Add an [approval job]({{ site.baseurl }}/2.0/workflows/#holding-a-workflow-for-a-manual-approval) to set up a manual gate. | Use [regex]({{ site.baseurl }}/2.0/workflows/#using-regular-expressions-to-filter-tags-and-branches) to [filter on branches]({{ site.baseurl }}/2.0/workflows/#branch-level-job-execution) or [filter on tags]({{ site.baseurl }}/2.0/workflows/#executing-workflows-for-a-git-tag).
Copy file name to clipboardExpand all lines: jekyll/_cci2/workflows.md
+61-55Lines changed: 61 additions & 55 deletions
Original file line number
Diff line number
Diff line change
@@ -268,7 +268,7 @@ workflows:
268
268
- test2
269
269
```
270
270
271
-
The environment variables are defined by setting the `context` key as shown to the default name `org-global`. The `test1` and `test2` jobs in this workflows example will use the same shared environment variables when initiated by a user who is part of the organization. By default, all projects in an organization have access to contexts set for that organization.
271
+
The environment variables are defined by setting the `context` key as shown to the default name `org-global`. The `test1` and `test2` jobs in this workflows example will use the same shared environment variables when initiated by a user who is part of the organization. By default, all projects in an organization have access to contexts set for that organization.
272
272
273
273
### Branch-Level Job Execution
274
274
The following example shows a workflow configured with jobs on three branches: Dev, Stage, and Pre-Prod. Workflows will ignore `branches` keys nested under `jobs` configuration, so if you use job-level branching and later add workflows, you must remove the branching at the job level and instead declare it in the workflows section of your `config.yml`, as follows:
@@ -277,15 +277,15 @@ The following example shows a workflow configured with jobs on three branches: D
277
277
278
278
The following `config.yml` snippet is an example of a workflow configured for branch-level job execution:
279
279
280
-
```
280
+
```yaml
281
281
workflows:
282
282
version: 2
283
283
dev_stage_pre-prod:
284
284
jobs:
285
285
- test_dev:
286
-
filters:
286
+
filters:# using regex filters requires the entire branch to match
287
287
branches:
288
-
only:
288
+
only:# only branches matching the below regex filters will run
289
289
- dev
290
290
- /user-.*/
291
291
- test_stage:
@@ -298,64 +298,53 @@ workflows:
298
298
only: /pre-prod(?:-.+)?$/
299
299
```
300
300
301
-
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. Branches matching the value of `ignore` will not run the job. See the [Sample Sequential Workflow config with Branching](https://github.com/CircleCI-Public/circleci-demo-workflows/blob/sequential-branch-filter/.circleci/config.yml) for a full example.
302
-
303
-
### Git Tag Job Execution
301
+
For more information on regular expressions,
302
+
see the [Using Regular Expressions to Filter Tags And Branches](#using-regular-expressions-to-filter-tags-and-branches) section below.
303
+
For a full example of workflows,
304
+
see the [configuration file](https://github.com/CircleCI-Public/circleci-demo-workflows/blob/sequential-branch-filter/.circleci/config.yml) for the Sample Sequential Workflow With Branching project.
304
305
305
-
CircleCI treats tag and branch filters differently when deciding whether a job should run.
306
+
### Executing Workflows for a Git Tag
306
307
307
-
1. For a branch push unaffected by any filters, CircleCI runs the job.
308
-
2. For a tag push unaffected by any filters, CircleCI skips the job.
308
+
CircleCI does not run workflows for tags
309
+
unless you explicitly specify tag filters.
310
+
Additionally,
311
+
if a job requires any other jobs (directly or indirectly),
312
+
you must [use regular expressions](#using-regular-expressions-to-filter-tags-and-branches)
313
+
to specify tag filters for those jobs.
309
314
310
-
Item two above means that a job **must** have a `filters``tags` section to run as a part of a tag push and all its transitively dependent jobs **must** also have a `filters``tags` section.
315
+
In the example below,
316
+
two workflows are defined:
311
317
312
-
Following is a very basic example for building any branch and using tags. The regular expression is a full match rather than a partial match. For example, `only: /^config-test.*/` matches any tag with the prefix `config-test-111` and `only: /^config-test/` matches all tags that match `config-test`. To match the common use case of a semantic versioning, for example, use `/version-2\.1\.[3-7]/` to match `version-2.1.`(3 through 7).
318
+
- `untagged-build` runs the `build` job for all branches.
319
+
- `tagged-build`runs `build` for all branches **and** all tags starting with `v`.
313
320
314
-
315
-
```
321
+
```yaml
316
322
workflows:
317
323
version: 2
318
-
un-tagged-build:
324
+
untagged-build:
319
325
jobs:
320
-
- build:
321
-
filters:
322
-
tags:
323
-
ignore: /^v.*/
326
+
- build
324
327
tagged-build:
325
-
jobs:
326
-
- build:
327
-
filters:
328
-
branches:
329
-
ignore: /.*/
330
-
tags:
331
-
only: /^v.*/
332
-
```
333
-
334
-
The following `build` job example will run for all branches, and all tags, except those starting with `testing-`.
335
-
336
-
```
337
-
workflows:
338
-
version: 2
339
-
build-workflow:
340
328
jobs:
341
329
- build:
342
330
filters:
343
331
tags:
344
-
ignore: /^testing-.*/
332
+
only: /^v.*/
345
333
```
346
334
347
-
The following example runs
335
+
In the example below,
336
+
two jobs are defined within the `build-n-deploy` workflow:
348
337
349
-
1.`build` job for all branches, and all tags.
350
-
2.`deploy` job only for tags marked with a version number.
338
+
- The `build` job runs for all branches and all tags.
339
+
- The `deploy` job runs for no branches and only for tags starting with 'v'.
351
340
352
-
```
341
+
```yaml
353
342
workflows:
354
343
version: 2
355
344
build-n-deploy:
356
345
jobs:
357
346
- build:
358
-
filters:
347
+
filters: # required since `deploy` has tag filters AND requires `build`
359
348
tags:
360
349
only: /.*/
361
350
- deploy:
@@ -368,26 +357,26 @@ workflows:
368
357
ignore: /.*/
369
358
```
370
359
371
-
**Note:** The `build` job **must** also have a `filters``tags` section, as it is a transient dependency of the `deploy` job.
372
-
373
-
The following example runs
360
+
In the example below,
361
+
three jobs are defined with the `build-test-deploy` workflow:
374
362
375
-
1.`build` and `test` jobs for all branches and only `config-test.*` tags.
376
-
2.`deploy` only for `config-test.*` tags.
363
+
- The `build` job runs for all branches and only tags starting with 'config-test'.
364
+
- The `test` job runs for all branches and only tags starting with 'config-test'.
365
+
- The `deploy` job runs for no branches and only tags starting with 'config-test'.
377
366
378
-
```
367
+
```yaml
379
368
workflows:
380
369
version: 2
381
-
build-n-deploy:
370
+
build-test-deploy:
382
371
jobs:
383
372
- build:
384
-
filters:
373
+
filters: # required since `test` has tag filters AND requires `build`
385
374
tags:
386
375
only: /^config-test.*/
387
376
- test:
388
377
requires:
389
378
- build
390
-
filters:
379
+
filters:# required since `deploy` has tag filters AND requires `test`
391
380
tags:
392
381
only: /^config-test.*/
393
382
- deploy:
@@ -398,14 +387,31 @@ workflows:
398
387
only: /^config-test.*/
399
388
branches:
400
389
ignore: /.*/
401
-
402
390
```
403
391
404
-
**Note:** Webhook payloads from GitHub [are capped at 5MB](https://developer.github.com/webhooks/#payloads) and [for some events](https://developer.github.com/v3/activity/events/types/#createevent) a maximum of 3 tags. This means that if you push a lot of tags we may not receive all of them.
405
-
406
-
### Regular Expression Support
407
-
408
-
CircleCI branch and tag filters support the Java variant of regex pattern matching, see the [java.util.regex documentation](https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html) for details.
392
+
**Note:**
393
+
Webhook payloads from GitHub [are capped at 5MB](https://developer.github.com/webhooks/#payloads)
394
+
and [for some events](https://developer.github.com/v3/activity/events/types/#createevent) a maximum of 3 tags.
395
+
If you push several tags at once,
396
+
CircleCI may not receive all of them.
397
+
398
+
### Using Regular Expressions to Filter Tags and Branches
399
+
400
+
CircleCI branch and tag filters support
401
+
the Java variant of regex pattern matching.
402
+
When writing filters,
403
+
CircleCI matches exact regular expressions.
404
+
405
+
For example,
406
+
`only: /^config-test/` only matches the `config-test` tag.
407
+
To match all tags starting with `config-test`,
408
+
use `only: /^config-test.*/` instead.
409
+
Using tags for semantic versioning is a common use case.
410
+
To match patch versions 3-7 of a 2.1 release,
411
+
you could write `/^version-2\.1\.[3-7]/`.
412
+
413
+
For full details on pattern-matching rules,
414
+
see the [java.util.regex documentation](https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html).
0 commit comments