Skip to content

Commit 5d7b035

Browse files
committed
Deploys docs improvements
- Consolidate rollback docs into one page - Consolidate deployment and deploy overview pages into one page - Clarify applications for each method along with advantages and disadvantages - Update deploy markers page to make steps more clear
1 parent 4da6bec commit 5d7b035

File tree

7 files changed

+859
-112
lines changed

7 files changed

+859
-112
lines changed
File renamed without changes.

docs/guides/modules/ROOT/nav.adoc

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,19 +161,16 @@
161161
*** xref:test:troubleshoot-test-splitting.adoc[Troubleshoot test splitting]
162162
163163
* Deploy with CircleCI
164-
** xref:deploy:deployment-overview.adoc[Overview of deployment on CircleCI]
165-
** xref:deploy:deploys-overview.adoc[CircleCI deploys overview]
164+
** xref:deploy:deployment-overview.adoc[Deployment and deploy management]
165+
** Setup
166+
*** xref:deploy:configure-deploy-markers.adoc[Configure deploy markers]
167+
*** xref:deploy:set-up-rollbacks.adoc[Rollbacks]
166168
** Release agent setup
167169
*** xref:deploy:set-up-circleci-deploys.adoc[Set up CircleCI deploys]
168170
*** xref:deploy:set-up-the-release-agent.adoc[Set up the release agent]
169171
*** xref:deploy:configure-your-kubernetes-components.adoc[Configure your Kubernetes components]
170172
*** xref:deploy:update-the-kubernetes-release-agent.adoc[Update the Kubernetes release agent]
171173
*** xref:deploy:manage-deploys.adoc[Manage deploys]
172-
** Agentless setup
173-
*** xref:deploy:configure-deploy-markers.adoc[Configure deploy markers]
174-
*** xref:deploy:set-up-rollbacks.adoc[Set up rollbacks in CircleCI]
175-
*** xref:deploy:rollback-a-project-using-the-rollback-pipeline.adoc[Rollback a project using the rollback pipeline]
176-
*** xref:deploy:rollback-a-project-by-workflow-rerun.adoc[Rollback a project by workflow rerun]
177174
** How-to guides
178175
*** xref:deploy:deploy-to-amazon-sagemaker.adoc[Deploy to Amazon SageMaker]
179176
*** xref:deploy:deploy-android-applications.adoc[Deploy Android applications]

docs/guides/modules/deploy/pages/configure-deploy-markers.adoc

Lines changed: 61 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -9,70 +9,72 @@ This tutorial shows how to add a deploy marker step to your workflow config. Dep
99

1010
Deploy markers provide a lightweight way to log your deployments without requiring a you to install the CircleCI release agent. If you install deploy markers, as described in this guide, you will also be able to use the xref:set-up-rollbacks.adoc[CircleCI rollback feature].
1111

12-
For a full guide to CircleCI's deploys features and functionality, refer to the xref:set-up-circleci-deploys.adoc[Set up CircleCI deploys] guide.
12+
For a full guide to CircleCI's deploys features and functionality, refer to the xref:deployment-overview.adoc[Deployment and deploy management] guide.
13+
14+
You can configure deploy markers as follows:
15+
16+
* To display updated statuses depending of the outcome of your deployments. Steps for this are provided in the <<deploy-markers-with-status-updates>> section.
17+
* Or, you can choose to configure deploy markers to log deployments without status updates. Steps for this are provided in the <<deploy-logs-without-status-updates>> section.
1318

1419
== Prerequisites
1520

1621
* A CircleCI account connected to your code. You can link:https://circleci.com/signup/[sign up for free].
1722
* A CircleCI project with a workflow configured to deploy your code.
1823

19-
== 1. Update the configuration
24+
== Deploy markers with status updates
2025

2126
To create a deployment marker, you will update your CircleCI configuration file.
27+
2228
You will add commands to plan a deploy and then update its status based on the outcome of your deployment script.
2329

30+
NOTE: The `circleci run release` commands are only available in CircleCI builds and are not part of the CircleCI local CLI. You do not need to install the CircleCI local CLI in your CircleCI pipeline to use these commands.
31+
2432
=== 1.1. Plan a deploy
2533

2634
Add a `circleci run release plan` command to your deployment job. This tells CircleCI to plan a new deploy and show it in the link:https://app.circleci.com/deploys[Deploys UI] with `pending` status.
27-
The `target-version` parameter should match the name of the version being deployed.
2835

2936
[,yml]
3037
----
3138
jobs:
3239
deploy-my-service:
3340
executor: some-executor
3441
steps:
35-
- run: circleci run release plan --target-version=<some-version-name>
42+
- run: circleci run release plan <deploy-name> --environment-name=<some-environment-name> --component-name=<some-component-name> --target-version=<some-version-name> --namespace=<some-namespace>
3643
----
3744

38-
If you do not have an environment set up in your organization a new one will be created with the name `default`. This will be set as the target for this deploy. See <<manage-environments>> for more information.
45+
In this example, note the following flags and options:
46+
47+
* The `deploy-name` parameter is used to identify the deployment. `deploy-name` is an arbitrary positional argument that will be used to identify the deployment and should be unique within the workflow. If not specified, the deployment name will be set to `default`. If you are deploying multiple components or to multiple environments from a single workflow, you need to provide the command with a deployment name.
48+
* The `environment-name` parameter sets the target environment. If the specified environment does not exist, it will be created. If you do not specify an environment, CircleCI will create one named `default`.
49+
* The `component-name` parameter sets the name that will be displayed in the Deploys UI. If you do not already have a component in your project a new one will be created with the name of the project. This will be set as the component that is being deployed.
50+
* The `target-version` parameter should match the version being deployed. Some examples are provided <<examples-for-target-version,in the next section>>.
51+
* The `namespace` parameter is optional and can be provided to use a value other than `default`.
52+
53+
Configuring `circleci run release plan` identifies the deployment you are planning so that you can reference it to update its status later on.
3954

40-
If you do not already have a component in your project a new one will be created with the name of the project. This will be set as the component that is being deployed.
55+
==== Examples for target-version
4156

42-
If you already have multiple environments and components you must specify their names manually, as follows:
57+
This section provides some options for setting the `target-version` parameter.
4358

59+
* One option is to use CircleCI's built-in environment variables. For example you could define the target version as follows:
60+
+
4461
[,yml]
4562
----
46-
jobs:
47-
deploy-my-service:
48-
executor: some-executor
49-
steps:
50-
- run: circleci run release plan --environment-name=<some-environment-name> --component-name=<some-component-name> --target-version=<some-version-name> --namespace=<some-namespace>
63+
--target-version="1.0.${CIRCLE_BUILD_NUM}-${CIRCLE_SHA1:0:7}"
5164
----
65+
+
66+
This configuration would yield a value with the following format `1.0.28853-ffdbeb1`.
5267

53-
In this example, note the following:
54-
55-
** The `environment-name` parameter sets the target environment. If the specified environment does not exist, it will be created.
56-
** The `component-name` parameter sets the name that will be displayed in the Deploys UI.
57-
** The `namespace` parameter is optional and can be provided to use a value other than `default`.
58-
59-
If you are deploying multiple components or to multiple environments from a single workflow, you need to provide the command with a deployment name.
60-
This identifies the deployment your are planning so that you can later on reference it to update its status.
61-
This can be done as shown below:
62-
68+
* Another option is to use pipeline values. For example you could define the target version as follows:
69+
+
6370
[,yml]
6471
----
65-
jobs:
66-
deploy-my-service:
67-
executor: some-executor
68-
steps:
69-
- run: circleci run release plan <deploy-name> --environment-name=<some-environment-name> --component-name<=>some-component-name> --target-version=<some-version-name>
72+
--target-version=<< pipeline.number >>
7073
----
74+
+
75+
This configuration would yield a value with the following format `12345`.
7176

72-
In the example the positional argument `deploy-name` is the arbitrary value that will be used to identify the deployment and should be unique within the workflow.
73-
If not specified, the deployment name will be set to `default`.
74-
75-
=== 1.2. Update the deploy status
77+
=== 1.2. Update the deploy status to running
7678

7779
After deploying your application, you can update the status of the deployment to `RUNNING` by running the `circleci run release update` command in a new step.
7880

@@ -88,8 +90,7 @@ jobs:
8890
- run: circleci run release update --status=running
8991
----
9092

91-
If you are deploying multiple components or to multiple environments from a single workflow, you need to provide the command with a deployment name.
92-
This value should match the value you provided when you planned the deploy.
93+
If you are deploying multiple components or to multiple environments from a single workflow, you need to provide the command with a deployment name. The deploy name value should match the value you provided when you planned the deploy.
9394

9495
[,yml]
9596
----
@@ -103,8 +104,10 @@ jobs:
103104
- run: circleci run release update <deploy-name> --status=running
104105
----
105106

106-
Now you can use the `when` attribute to add `on_success` and `on_failure` steps at the end of your deployment job, to handle the final status update of the deploy.
107+
=== 1.3. Update the deploy status to success or failure
108+
You can use the `when` attribute to add `on_success` and `on_failure` steps at the end of your deployment job, to handle the final status update of the deploy.
107109

110+
.Config file example showing deploy status update to success or failure
108111
[,yml]
109112
----
110113
jobs:
@@ -132,21 +135,23 @@ jobs:
132135
when: on_fail
133136
----
134137

135-
This will update the status of the deploy to `SUCCESS` or `FAILED` depending on the outcome of your job.
136-
In this example, the `failure_reason.env` file can be created by a previous step in the job. This can be done, for example, in a step in which we are validating the status of the deployment.
137-
You can do that as shown below:
138+
In this example, the status of the deploy is updated to `SUCCESS` or `FAILED` depending on the outcome of your job.
139+
140+
The `failure_reason.env` file can be created by a previous step in the job. This can be done, for example, in a step in which we are validating the status of the deployment. One way to do this is as follows:
138141

142+
.Create a file to store the failure reason
139143
[,yml]
140144
----
141145
echo "FAILURE_REASON='Deployment was not found'" > failure_reason.env
142146
----
143147

144148
CAUTION: Trying to update the status of the deploy after updating it to a terminal status such as `SUCCESS`, `FAILED` or `CANCELED` is not supported and will result in an error.
145149

146-
=== 1.3 Update the deploy status to canceled
150+
=== 1.4 Update the deploy status to canceled
147151

148152
If you want to update your deployment to `canceled` when the deploy job is canceled, you can do so by adding the following job to your configuration.
149153

154+
.Job configuration for updating the deploy status to canceled
150155
[,yml]
151156
----
152157
jobs:
@@ -166,6 +171,7 @@ jobs:
166171

167172
Then you can add it to your workflow as shown below.
168173

174+
.Workflow configuration for updating the deploy status to canceled. The cancel-deploy job only runs when the deploy job is canceled
169175
[,yml]
170176
----
171177
workflows:
@@ -178,9 +184,9 @@ workflows:
178184
- canceled
179185
----
180186

181-
This will make it sot that the job will be run only when the `deploy` job is canceled, thus updating the deployment to the `canceled` status.
187+
In this example, the `cancel-deploy` job will be run only when the `deploy` job is canceled, thus updating the deployment to the `canceled` status.
182188

183-
=== 1.4. Full config example
189+
=== 1.5. Full config example
184190

185191
For reference, here is a full example of a CircleCI config that makes use of the deployment tracking feature.
186192

@@ -239,7 +245,7 @@ workflows:
239245
- canceled
240246
----
241247

242-
== 2. Deploy logs
248+
== Deploy logs without status updates
243249

244250
Sometimes you might not want your deployment marker to have any specific status, but still want it to be logged in the deploys UI.
245251
In those cases you can use the `release log` command in place of `release plan` as shown in the example below.
@@ -273,29 +279,30 @@ jobs:
273279

274280
** The `environment-name` specifies the target environment. If the environment does not exist, it will be created.
275281
** The `component-name` parameter sets the name that will be displayed in the CircleCI UI.
276-
** The `target-version` parameter should match the name of the version being deployed.
282+
** The `target-version` parameter should match the name of the version being deployed. Some examples are provided <<examples-for-target-version,above>>.
277283
** (Optional) You can provide the following parameter if required:
278284
*** The `namespace` parameter can be provided to use a value other than `default`.
279285

280-
[#manage-environments]
281-
== 3. Manage environments
286+
== Manage environments
287+
288+
In this guide we created an environment integration by supplying a name with the `--envionment-name` flag. This was an optional step. If you did not specify an environment CircleCI will have created one for you with the name `default`.
289+
290+
You can also create an environment integration manually in the CircleCI web app.
282291

283-
Configuring deploy markers will automatically create an environment integration in the link:https://app.circleci.com/deploys[CircleCI deploys UI] with the name you specified or with the `default` name if you didn't specify any.
284-
You can then use the link:https://app.circleci.com/deploys/github/circleci#environments[CircleCI UI] to manage your environments, by creating, deleting or updating them.
285-
To manually create an environment integration, follow these steps:
292+
=== Create an environment integration
286293

287-
. In the CircleCI web app, select **Deploys** in the sidebar.
288-
. If this is your first environment setup, select btn:[Create your first Environment Integration]. If you already have environments set up, choose the **Environments** tab and select btn:[Create Environment Integration].
294+
. In the link:https://app.circleci.com[CircleCI web app], select your org from the org cards on your user homepage.
295+
. Select **Deploys** in the sidebar.
296+
. Select the **Environments** tab.
297+
. Select btn:[Create Environment Integration].
289298
. Enter a name for your environment, and a description if you would like.
290-
. Use the dropdown menu to choose your environment integration type, then select btn:[Next: Release Agent Setup].
291-
If you plan to only use deploy markers, as opposed to the Kubernetes agent, feel free to choose the `custom` type.
292-
**You do not need to continue with installing a release agent at this point**, but you will need to reference this environment integration name as part of your config when adding the `log release` step below.
299+
. Use the dropdown menu to choose your environment integration type. Choose the "Custom" option to follow along with this guide,. If you are deploying to your Kubernetes cluster you can or if you want to use the CircleCI release agent, then choose "Kubernetes Cluster" and head over to the xref:set-up-circleci-deploys.adoc[Release agent setup] page.
300+
. Select btn:[Save and Continue].
293301

294302
== Next steps
295303

296304
By following the steps in this guide, you have added a deploy marker to your CircleCI configuration.
297305
You can now track the status of your deployments across your configured environments in the CircleCI deploys UI and in the project home page.
298306
You can now:
299307

300-
* xref:set-up-the-release-agent.adoc[Set up a release agent on your Kubernetes cluster].
301-
* xref:configure-deploy-markers.adoc[Learn about deploy markers]
308+
* xref:set-up-rollbacks.adoc[Set up rollbacks].

0 commit comments

Comments
 (0)