Skip to content

Commit f99ee74

Browse files
Merge branch 'master' into new-endpoint-for-trigger-workflows
2 parents e7b2ee8 + 2268f67 commit f99ee74

File tree

8 files changed

+90
-78
lines changed

8 files changed

+90
-78
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
- docs
6363
deploy:
6464
docker:
65-
- image: cibuilds/aws:1.15.44
65+
- image: cibuilds/aws:1.15.73
6666
steps:
6767
- attach_workspace:
6868
at: ./generated-site

jekyll/_cci2/configuration-reference.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,12 +1006,12 @@ ignore | N | String, or List of Strings | Either a single branch specifier, or a
10061006

10071007
###### **`tags`**
10081008
{:.no_toc}
1009-
CircleCI treats tag and branch filters differently when deciding whether a job should run.
10101009

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

10161016
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.
10171017

@@ -1027,6 +1027,8 @@ only | N | String, or List of Strings | Either a single tag specifier, or a list
10271027
ignore | N | String, or List of Strings | Either a single tag specifier, or a list of tag specifiers
10281028
{: class="table table-striped"}
10291029

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

10311033
###### *Example*
10321034

jekyll/_cci2/env-vars.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ Variable | Type | Value
372372
`CIRCLE_PULL_REQUESTS` | List | Comma-separated list of URLs of the current build's associated pull requests.
373373
`CIRCLE_REPOSITORY_URL` | String | The URL of your GitHub or Bitbucket repository.
374374
`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).
376376
`CIRCLE_USERNAME` | String | The GitHub or Bitbucket username of the user who triggered the build.
377377
`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.
378378
`CIRCLE_WORKING_DIRECTORY` | String | The value of the `working_directory` key of the current job.

jekyll/_cci2/executor-types.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This document describes the `docker`, `machine`, and `macos` environments in the
1616
{:toc}
1717

1818
## 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.
2020

2121
For building on Linux, there are tradeoffs to `docker` versus `machine`, as follows:
2222

@@ -61,7 +61,7 @@ In this example, all steps run in the container created by the first image liste
6161

6262
More details on the Docker Executor are available in the [Configuring CircleCI]({{ site.baseurl }}/2.0/configuration-reference/) document.
6363

64-
### Using Machine
64+
## Using Machine
6565

6666
The `machine` option will run your jobs in a dedicated, ephemeral Virtual Machine (VM) with the following technical specifications:
6767

@@ -111,7 +111,7 @@ jobs:
111111
docker_layer_caching: true # default - false
112112
```
113113

114-
### Using macOS
114+
## Using macOS
115115

116116
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.
117117

jekyll/_cci2/language-android.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,3 +247,7 @@ as you change code.
247247
CircleCI runs clean builds,
248248
so pre-dexing actually increases compilation time
249249
and may also increase memory usage.
250+
251+
## Deployment
252+
253+
See the [Deploy]({{ site.baseurl }}/2.0/deployment-integrations/) document for examples of deploy target configurations.

jekyll/_cci2/language-ruby.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ version: 2 # use CircleCI 2.0
4646
jobs: # a collection of steps
4747
build: # runs not using Workflows must have a `build` job as entry point
4848
parallelism: 3 # run three instances of this job in parallel
49-
working_directory: ~/circleci-demo-ruby-rails # directory where steps will run
5049
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
5251
environment: # environment variables for primary container
5352
BUNDLE_JOBS: 3
5453
BUNDLE_RETRY: 3
@@ -164,24 +163,31 @@ Directly beneath `working_directory`, you can specify container images under a `
164163

165164
```yaml
166165
docker:
167-
- image: circleci/ruby:2.4-node
166+
- image: circleci/ruby:2.4.2-jessie-node # language image
168167
environment:
169168
BUNDLE_JOBS: 3
170169
BUNDLE_RETRY: 3
171170
BUNDLE_PATH: vendor/bundle
172171
PGHOST: 127.0.0.1
173172
PGUSER: circleci-demo-ruby
174173
RAILS_ENV: test
175-
- image: circleci/postgres:9.5-alpine
174+
- image: circleci/postgres:9.5-alpine # service image
176175
environment:
177176
POSTGRES_USER: circleci-demo-ruby
178177
POSTGRES_DB: rails_blog
179178
POSTGRES_PASSWORD: ""
180179
```
181180

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

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

186192
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.
187193

@@ -296,10 +302,6 @@ The `--profile` option reports the slowest examples of each run.
296302

297303
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).
298304

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-
303305
## Deployment
304306

305307
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
311313
* [Discourse](https://github.com/CircleCI-Public/discourse/blob/master/.circleci/config.yml), an open source discussion platform.
312314
* [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/).
313315

314-
315-
316316
[fork-demo-project]: https://github.com/CircleCI-Public/circleci-demo-ruby-rails/fork
317317
[rspec-junit-formatter]: https://github.com/sj26/rspec_junit_formatter

jekyll/_cci2/workflows-overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ CircleCI [Workflows]({{ site.baseurl }}/2.0/workflows/) enable you to sequence a
1212

1313
Holding a Workflow for Manual Approval | Using Filters
1414
----------------------------|----------------------
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/#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).
1616

1717
<hr>
1818

jekyll/_cci2/workflows.md

Lines changed: 61 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ workflows:
268268
- test2
269269
```
270270

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

273273
### Branch-Level Job Execution
274274
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
277277

278278
The following `config.yml` snippet is an example of a workflow configured for branch-level job execution:
279279

280-
```
280+
```yaml
281281
workflows:
282282
version: 2
283283
dev_stage_pre-prod:
284284
jobs:
285285
- test_dev:
286-
filters:
286+
filters: # using regex filters requires the entire branch to match
287287
branches:
288-
only:
288+
only: # only branches matching the below regex filters will run
289289
- dev
290290
- /user-.*/
291291
- test_stage:
@@ -298,64 +298,53 @@ workflows:
298298
only: /pre-prod(?:-.+)?$/
299299
```
300300
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.
304305
305-
CircleCI treats tag and branch filters differently when deciding whether a job should run.
306+
### Executing Workflows for a Git Tag
306307
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.
309314
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:
311317
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`.
313320

314-
315-
```
321+
```yaml
316322
workflows:
317323
version: 2
318-
un-tagged-build:
324+
untagged-build:
319325
jobs:
320-
- build:
321-
filters:
322-
tags:
323-
ignore: /^v.*/
326+
- build
324327
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:
340328
jobs:
341329
- build:
342330
filters:
343331
tags:
344-
ignore: /^testing-.*/
332+
only: /^v.*/
345333
```
346334

347-
The following example runs
335+
In the example below,
336+
two jobs are defined within the `build-n-deploy` workflow:
348337

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'.
351340

352-
```
341+
```yaml
353342
workflows:
354343
version: 2
355344
build-n-deploy:
356345
jobs:
357346
- build:
358-
filters:
347+
filters: # required since `deploy` has tag filters AND requires `build`
359348
tags:
360349
only: /.*/
361350
- deploy:
@@ -368,26 +357,26 @@ workflows:
368357
ignore: /.*/
369358
```
370359
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:
374362

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'.
377366

378-
```
367+
```yaml
379368
workflows:
380369
version: 2
381-
build-n-deploy:
370+
build-test-deploy:
382371
jobs:
383372
- build:
384-
filters:
373+
filters: # required since `test` has tag filters AND requires `build`
385374
tags:
386375
only: /^config-test.*/
387376
- test:
388377
requires:
389378
- build
390-
filters:
379+
filters: # required since `deploy` has tag filters AND requires `test`
391380
tags:
392381
only: /^config-test.*/
393382
- deploy:
@@ -398,14 +387,31 @@ workflows:
398387
only: /^config-test.*/
399388
branches:
400389
ignore: /.*/
401-
402390
```
403391
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).
409415

410416
## Using Workspaces to Share Data Among Jobs
411417

0 commit comments

Comments
 (0)