Skip to content

Commit 0570622

Browse files
authored
Merge branch 'master' into tjs/2948
2 parents 6a37eea + 70fadfb commit 0570622

File tree

10 files changed

+34
-25
lines changed

10 files changed

+34
-25
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
_site/
88
jekyll/.jekyll-cache/
99
jekyll/environments/
10-
jekyll/assets/js/dist/
1110
jekyll/_includes/app.html
1211
run-results/
1312
node_modules/

jekyll/_cci2/api-job-trigger.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,16 @@ and refers to the name of your branch.
4545
For a complete reference of the API,
4646
see the [CircleCI API Documentation]({{ site.baseurl }}/api/v1-reference/).
4747

48-
**Note:**
49-
It is possible to trigger [workflows]({{ site.baseurl }}/2.0/workflows/) with the CircleCI API, using a new endpoint, see the Trigger a Build by Project section of the [CircleCI API Projects Documentation]({{ site.baseurl }}/api/v1-reference/#new-project-build).
50-
51-
Jobs triggered with the API may contain a `workflows` section.
52-
These workflows do **not** have to reference the job
53-
you trigger with the API.
54-
Jobs triggered with the API do **not** have access to environment variables
55-
created for [a CircleCI Context]({{ site.baseurl }}/2.0/contexts/).
56-
Instead, define these variables at the [Project level]({{ site.baseurl }}/2.0/env-vars/#setting-an-environment-variable-in-a-project).
48+
**Import Considerations When Triggering A Job Via The API**
49+
50+
- Jobs triggered with the API may contain a `workflows` section
51+
- Your workflow does **not** have to reference the job you triggered with the API
52+
- Jobs that are triggered via the API do **not** have access to environment
53+
variables created for [a CircleCI Context]({{ site.baseurl }}/2.0/contexts/)
54+
- If you wish to use environment variables they have to be defined at the [Project level]({{ site.baseurl }}/2.0/env-vars/#setting-an-environment-variable-in-a-project)
55+
- It is currently not possible to trigger a single job if you are using CircleCI 2.1 and Workflows
56+
- It is possible to trigger [workflows]({{ site.baseurl }}/2.0/workflows/) with the CircleCI API, using the [Trigger a Build by Project]({{ site.baseurl}}/api/v1-reference/#new-project-build) endpoint
57+
5758

5859
## Conditionally Running Jobs With the API
5960

jekyll/_cci2/config-intro.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ The CircleCI config syntax is very straight forward. The trickiest part is typi
5050
5151
- Line 1: This indicates the version of the CircleCI platform you are using. 2.0 is the most recent version.
5252
- Line 2-3: The `jobs` level contains a collection of arbitrarily named children. `build` is the first named child in the `jobs` collection. In this case `build` is also the only job.
53-
- Line 4-5: The `steps` collection is an ordered list of `run` directives. Each `run` directive is executed in the order in which it was declared.
54-
- Line 6: The `name` attribute provides useful organizational information when returning warnings, errors, and output. The `name` should be meaningful to you as an action within your build process
55-
- Line 7-9: This is the magic. The `command` attribute is a list of shell commands that represent the work you want done. The initial pipe, `|`, indicates that there will be more than one line of shell commands. Here line 8 will print out `Hello World` in your build shell and line 9 will print out `I’m the new delivery pipeline`
53+
- Line 6-7: The `steps` collection is an ordered list of `run` directives. Each `run` directive is executed in the order in which it was declared.
54+
- Line 8: The `name` attribute provides useful organizational information when returning warnings, errors, and output. The `name` should be meaningful to you as an action within your build process
55+
- Line 9-11: This is the magic. The `command` attribute is a list of shell commands that represent the work you want done. The initial pipe, `|`, indicates that there will be more than one line of shell commands. Here line 10 will print out `Hello World!` in your build shell and line 11 will print out `This is the delivery pipeline`
5656

5757
## Part Two: Info and Preparing to Build
5858
That was nice but let’s get real. Delivery graphs start with code. In this example we will add a few lines that will get your code and then list it. We will also do this in a second run.
@@ -131,11 +131,11 @@ The above two changes to the config significantly affect how you get work done.
131131

132132
- Line 4: Here we see a comment in-line in yml. Like any other unit of code, comments are a useful tool as config gets complicated.
133133
- Line 5-6: These lines indicate that docker image to use for the job. Because you can have more than one job in your config (as we will see next) you can also run different parts of your config in different environments. For example, you could perform a build job in a thin java container and then perform a test job using a container with browsers pre-installed. In this case, it uses a [pre-built container from CircleCI]({{ site.baseurl }}/2.0/circleci-images/) that already has a browser and other useful tools built in.
134-
- Line 9-12: These lines add a run step that returns the version of node available in the container. Try experimenting with different containers from CircleCI’s pre-built convenience images or even public containers from Docker hub.
134+
- Line 19-22: These lines add a run step that returns the version of node available in the container. Try experimenting with different containers from CircleCI’s pre-built convenience images or even public containers from Docker hub.
135135

136136
## Part Four: Approved to Start
137137
So far so good? Let’s spend a moment on orchestration. In this example, we will spend more time doing analysis than step-by-step modification.
138-
The CircleCI workflow model is based on the orchestration of predecessor jobs. This is why the reserved word used for workflow definition is `requires.` Jobs initiation is always defined in terms of the successful completion of prior jobs. For example, a job vector such as [A, B, C] would be implemented with jobs B and C each requiring the job prior. Job A would not have a requires block because it starts immediately. For example, job A starts immediately; B requires A; C requires B.
138+
The CircleCI workflow model is based on the orchestration of predecessor jobs. This is why the reserved word used for workflow definition is `requires`. Jobs initiation is always defined in terms of the successful completion of prior jobs. For example, a job vector such as [A, B, C] would be implemented with jobs B and C each requiring the job prior. Job A would not have a requires block because it starts immediately. For example, job A starts immediately; B requires A; C requires B.
139139

140140
In the example below, an event triggering a build will cause `Hello-World` to start immediately. The remainder of the jobs will wait. When `Hello-World` completes, both `I-Have-Code` and `Run-With-Node` will start. That is because both `I-Have-Code` and `Run-With-Node` require `Hello-World` to complete successfully before they can start. Next, the approval job called `Hold-For-Approval` will become available when both `I-Have-Code` and `Run-With-Node` complete. The `Hold-For-Approval` job is slightly different from the others. It represents a manual intervention to allow the workflow to continue. While the workflow is waiting for a user (through the CircleCI UI or API) to approve the job, all state is preserved based on the original triggering event. CircleCI understands that Approval jobs may take hours or even days before completing - although we suggest hours over days. Once `Hold-For-Approval` completes through a manual intervention, the final job `Now-Complete` will run.
141141

@@ -211,8 +211,8 @@ We now know how to create a workflow including a manual gate that you can use to
211211
- Line 12: The commands to get code are now in a job named `I-Have-Code`
212212
- Line 22: The Node example using the CircleCI pre-built image is now called `Run-With-Node`
213213
- Line 30: There is an additional job that operates similarly to `Hello-World` but it won’t run until the approval is complete - see line 57 in the workflow stanza.
214-
- Line 39-57: The config now has a workflow. In the prior examples the CircleCI engine interpreted the config as having had a single-job workflow. Here we are staying clear and spelling out the workflow we want to execute. This workflow demonstrates several useful capabilities. The `requires` statement represents a list of prior jobs that must complete successfully prior to the job in question starting. In this example, both `I-Have-Code` and `Run-With-Node` must complete before `Hold-For-Approval` becomes active. In addition, both `I-Have-Code` and `Run-With-Node` are dependent on `Hello-World` but not on each other. . This means that those two jobs will run in parallel as soon as `Hello-World` is complete. This is useful if you have multiple jobs that are not directly dependent on one another and you want to improve wall-clock time.
215-
- Line 50-51: Most of the jobs are generic. However, this job has a type. In this case the type is `Approval` and requires a person through the CircleCI API or UI to take an action for the build to complete. Interleaving Approval jobs allows you to create gates that must be approved or managed prior to downstream jobs executing.
214+
- Line 39-57: The config now has a workflow. In the prior examples the CircleCI engine interpreted the config as having had a single-job workflow. Here we are staying clear and spelling out the workflow we want to execute. This workflow demonstrates several useful capabilities. The `requires` statement represents a list of prior jobs that must complete successfully prior to the job in question starting. In this example, both `I-Have-Code` and `Run-With-Node` must complete before `Hold-For-Approval` becomes active. In addition, both `I-Have-Code` and `Run-With-Node` are dependent on `Hello-World` but not on each other. This means that those two jobs will run in parallel as soon as `Hello-World` is complete. This is useful if you have multiple jobs that are not directly dependent on one another and you want to improve wall-clock time.
215+
- Line 50-51: Most of the jobs are generic. However, this job has a type. In this case the type is `approval` and requires a person through the CircleCI API or UI to take an action for the build to complete. Interleaving approval jobs allows you to create gates that must be approved or managed prior to downstream jobs executing.
216216

217217

218218
The examples above were designed to provide a quick starter to the areas of functionality available through CircleCI config. There remains a lot more. Take a look at the rest of the documentation. You will find that scheduled jobs, workspaces, artifacts, and more are all simple variations on the concepts you’ve learned here. Now go forth and automate your CI/CD world!

jekyll/_cci2/contexts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Environment variables are used according to a specific precedence order, as foll
6565
2. Environment variables declared with the `environment` key for a `run` step.
6666
3. Environment variables set with the `environment` key for a job.
6767
4. Environment variables set with the `environment` key for a container.
68-
5. Context environment variables (assuming the user has access to the Context). See the [Contexts]( {{ site.baseurl }}/2.0/contexts/) documentation for instructions.
68+
5. Context environment variables (assuming the user has access to the Context).
6969
6. Project-level environment variables set on the Project Settings page.
7070
7. Special CircleCI environment variables defined in the [CircleCI Environment Variable Descriptions]({{ site.baseurl }}/2.0/env-vars/#built-in-environment-variables) section of this document.
7171

jekyll/_cci2/creating-orbs.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ orbs:
109109
codecov: circleci/[email protected]
110110
my-orb:
111111
executors:
112-
default:
112+
specialthingsexecutor:
113113
docker:
114114
- image: circleci/ruby:1.4.2
115115
commands:
@@ -509,7 +509,10 @@ The animation shows snippets to give you an overview of the following steps for
509509
2. Running `circleci config process .circleci/config.yml` to process the config.
510510
3. Committing the change and checking that the build succeeds in the CircleCI app.
511511
4. Enabling orbs use under Settings > Security in the CircleCI app.
512-
5. Running `circleci namespace create ndintenfass` to create a namespace in which to publish to the [CircleCI Orb Registry](https://circleci.com/orbs/registry/).
512+
5. Running `circleci namespace create ndintenfass github ndintenfass_org` to create
513+
a namespace in which to publish to the [CircleCI Orb
514+
Registry](https://circleci.com/orbs/registry/), using Github as a VCS with
515+
`ndintenfass` as the namespace and `ndintenfass_org` as the org-name. The org-name must exist already as an organization on CircleCI.
513516
6. Creating and committing an `orb.yml` file in a `.circleci/orbs/orb-utils` directory of the project repo with the content of a reusable executor and the `orb-doc-generation` job.
514517
7. Running `circleci orb create ndintenfass orb-utils` to create the orb in the namespace.
515518
8. Running `circleci orb publish dev .circleci/orbs/orb-utils/@orb.yml ndintenfass orb-utils test` to publish the dev:test orb.

jekyll/_cci2/databases.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ To use `pg_dump`, `pg_restore` and similar utilities requires some extra configu
9797
```
9898
steps:
9999
# Add the Postgres 9.6 binaries to the path.
100-
- run: echo '/usr/lib/postgresql/9.6/bin/:$PATH' >> $BASH_ENV
100+
- run: echo 'export PATH=/usr/lib/postgresql/9.6/bin/:$PATH' >> $BASH_ENV
101101
```
102102

103103
### Using Dockerize to Wait for Dependencies

jekyll/_cci2/server-ports.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: classic-docs
3-
title: "Using the Static Installation Scripts"
3+
title: "Server Ports"
44
category: [administration]
55
order: 1
66
description: "Using CircleCI 2.0 static installation scripts."

jekyll/_cci2/using-orbs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ jobs:
104104
executor:
105105
name: my-executor
106106
steps:
107-
-run: echo outside the executor
107+
- run: echo outside the executor
108108
```
109109

110110

jekyll/_cci2/workflows.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,8 +587,6 @@ Go to Settings > Branches in GitHub and click the Edit button on the protected b
587587

588588
- For demonstration apps configured with Workflows, see the [CircleCI Demo Workflows](https://github.com/CircleCI-Public/circleci-demo-workflows) on GitHub.
589589

590-
- For troubleshooting a workflow with Waiting for Status in GitHub, see [Workflows Waiting for Status in GitHub]({{ site.baseurl }}/2.0/workflows-waiting-status).
591-
592590
## Video: Configure Multiple Jobs with Workflows
593591
{:.no_toc}
594592

0 commit comments

Comments
 (0)