Skip to content

Commit 8260a1c

Browse files
authored
Merge pull request circleci#3750 from circleci/config-reference-updated-0923
[WIP]Update configuration-reference.md
2 parents b750c08 + 3c5575b commit 8260a1c

File tree

1 file changed

+60
-2
lines changed

1 file changed

+60
-2
lines changed

jekyll/_cci2/configuration-reference.md

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,9 +503,24 @@ Class | vCPUs | Memory (GiB) | GPUs | GPU Memory (*GiB)
503503
{: class="table table-striped"}
504504

505505
**Note**: Java, Erlang and any other languages that introspect the `/proc` directory for information about CPU count may require additional configuration to prevent them from slowing down when using the CircleCI 2.0 resource class feature. Programs with this issue may request 32 CPU cores and run slower than they would when requesting one core. Users of languages with this issue should pin their CPU count to their guaranteed CPU resources.
506-
507506
If you want to confirm how much memory you have been allocated, you can check the cgroup memory hierarchy limit with `grep hierarchical_memory_limit /sys/fs/cgroup/memory/memory.stat`.
508507

508+
509+
#### **`project_slug`**
510+
511+
**What is a Project Slug?**
512+
513+
The CircleCI v2 API is backwards compatible with previous API versions in the way it identifies your projects using repository name. For example, if you want to pull information from CircleCI about the GitHub repository https://github.com/CircleCI-Public/circleci-cli you can refer to that in the CircleCI API as `gh/CircleCI-Public/circleci-cli`, which is a "triplet" of the project type, the name of your "organization", and the name of the repository.
514+
515+
For the project type you can use github or bitbucket as well as the shorter forms `gh` or `bb`, which are now supported in API v2. The organization is your username or organization name in your version control system.
516+
517+
With API v2, CircleCI has introduced a string representation of the triplet called the `project_slug`, and takes the following form:
518+
519+
`<project_type>/<org_name>/<repo_name>`
520+
521+
The `project_slug` is included in the payload when pulling information about a project as well as when looking up a pipeline or workflow by ID. It is important to note that the `project_slug` is just a new name for the existing format, and not a new shape of the URLS that can then be used to retrieve information about a project. It is possible in the future CircleCI may change the shape of a `project_slug`, but in all cases it would be usable as a human-readable identifier for a given project.
522+
523+
509524
#### **`steps`**
510525

511526
The `steps` setting in a job should be a list of single key/value pairs, the key of which indicates the step type. The value may be either a configuration map or a string (depending on what that type of step requires). For example, using a map:
@@ -800,7 +815,6 @@ version | N | String | Version string of Docker you would like to use (de
800815
- `setup_remote_docker` is not compatible with the `machine` executor. See [Docker Layer Caching in Machine Executor]({{ site.baseurl }}/2.0/docker-layer-caching/#machine-executor) for information on how to enable DLC with the `machine` executor.
801816
- The `version` key is not currently supported on CircleCI installed in your private cloud or datacenter. Contact your system administrator for information about the Docker version installed in your remote Docker environment.
802817

803-
804818
##### **`save_cache`**
805819

806820
Generates and stores a cache of a file or directory of files such as dependencies or source code in our object storage. Later jobs can [restore this cache](#restore_cache). Learn more in [the caching documentation]({{ site.baseurl }}/2.0/caching/).
@@ -1290,6 +1304,50 @@ ignore | N | String, or List of Strings | Either a single tag specifier, or a li
12901304

12911305
For more information, see the [Executing Workflows For a Git Tag]({{ site.baseurl }}/2.0/workflows/#executing-workflows-for-a-git-tag) section of the Workflows document.
12921306

1307+
##### **`when` in Workflows**
1308+
1309+
## Using 'when' in Workflows
1310+
1311+
When using CircleCI API v2, you may use a `when` clause (the inverse clause is also supported) under a workflow declaration with a boolean value to determine whether or not to run that workflow. The most common use of `when` in API v2 is to use a pipeline parameter as the value, allowing an API trigger to pass that parameter to determine which workflows to run.
1312+
1313+
The example below shows an example configuration using two different pipeline parameters. You may use one of the parameters to drive a particular workflow, while you may use the other parameter to determine whether a particular step will run.
1314+
1315+
```yaml
1316+
version: 2.1
1317+
1318+
parameters:
1319+
run_integration_tests:
1320+
type: boolean
1321+
default: false
1322+
deploy:
1323+
type: boolean
1324+
default: false
1325+
1326+
workflows:
1327+
version: 2
1328+
integration_tests:
1329+
when: << pipeline.parameters.run_integration_tests >>
1330+
jobs:
1331+
- mytestjob
1332+
- when:
1333+
condition: << pipeline.parameters.deploy >>
1334+
steps:
1335+
- deploy
1336+
1337+
jobs:
1338+
...
1339+
```
1340+
1341+
This example prevents the workflow `integration_tests` from being triggered unless the tests were invoked explicitly when the pipeline is triggered with the following in the `POST` body:
1342+
1343+
```
1344+
{
1345+
"parameters": {
1346+
"run_integration_tests": true
1347+
}
1348+
}
1349+
```
1350+
12931351
###### *Example*
12941352

12951353
```

0 commit comments

Comments
 (0)