Skip to content

Commit 3f75922

Browse files
Agentless rollback setup and usage (#9419)
* agentless rollbacks pages draft 1 * tidy up setup page and add screenshot * add pipeline values to list * update performing a rollback doc * minor clarifications * clarify workflow rerun doesn't require GitHub App
1 parent 0f4b01a commit 3f75922

File tree

12 files changed

+286
-33
lines changed

12 files changed

+286
-33
lines changed

jekyll/_cci2/deploy/configure-deploy-markers.adoc

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,15 @@ contentTags:
1212

1313
This tutorial shows how to add a deploy marker step to your workflow config. Deploy markers allow you to log all new deployments in one place, update their status and link back to the CI/CD pipelines that triggered them.
1414

15-
Unless you opt out of the feature, CircleCI autodetects potential deployments and creates deploy markers for you. This guide is for you if you would rather create deploy markers yourself. For more information see the xref:deploys-overview#[Deploys overview] page.
15+
Unless you opt out of the feature, CircleCI autodetects potential deployments and creates deploy markers for you.
1616

17-
Deploy markers provide a lightweight way to log your deployments without requiring a full CircleCI deploys setup. You can use deploy markers independently, without installing the release agent. If you are interested in comprehensive deployment visibility and management features, refer to the xref:set-up-circleci-deploys#[Set up CircleCI deploys] guide for more information.
17+
This guide is for you if you would rather create deploy markers yourself. For more information see the xref:deploys-overview#[Deploys overview] page.
18+
19+
== Introduction
20+
21+
Autodetected or manually configured 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 manually, as described in this guide you will also be able to use the xref:set-up-rollbacks#[CircleCI rollback feature].
22+
23+
For a full guide to CircleCI's deploys features and functionality, refer to the xref:set-up-circleci-deploys#[Set up CircleCI deploys] guide.
1824

1925
== Prerequisites
2026

@@ -123,8 +129,8 @@ jobs:
123129
name: Update planned release to SUCCESS
124130
command: |
125131
circleci run release update \
126-
--status=SUCCESS
127-
when: on_success
132+
--status=SUCCESS
133+
when: on_success
128134
- run:
129135
name: Update planned release to FAILED
130136
command: |
@@ -134,7 +140,7 @@ jobs:
134140
circleci run release update \
135141
--status=FAILED \
136142
--failure-reason="$FAILURE_REASON"
137-
when: on_fail
143+
when: on_fail
138144
----
139145

140146
This will update the status of the deploy to `SUCCESS` or `FAILED` depending on the outcome of your job.
@@ -160,13 +166,13 @@ jobs:
160166
(deploy job steps)
161167
...
162168
cancel-deploy:
163-
executor: go
164-
steps:
169+
executor: go
170+
steps:
165171
- run:
166172
name: Update planned release to CANCELED
167173
command: |
168174
circleci run release update \
169-
--status=CANCELED
175+
--status=CANCELED
170176
----
171177

172178
Then you can add it to your workflow as shown below.
@@ -180,7 +186,7 @@ workflows:
180186
- cancel-deploy:
181187
requires:
182188
- deploy:
183-
- canceled
189+
- canceled
184190
----
185191

186192
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.
@@ -214,8 +220,8 @@ jobs:
214220
name: Update planned deployment to SUCCESS
215221
command: |
216222
circleci run release update \
217-
--status=SUCCESS
218-
when: on_success
223+
--status=SUCCESS
224+
when: on_success
219225
- run:
220226
name: Update planned deployment to FAILED
221227
command: |
@@ -225,23 +231,23 @@ jobs:
225231
circleci run release update \
226232
--status=FAILED \
227233
--failure-reason="$FAILURE_REASON"
228-
when: on_fail
234+
when: on_fail
229235
cancel-deploy:
230-
executor: go
231-
steps:
236+
executor: go
237+
steps:
232238
- run:
233239
name: Update planned release to CANCELED
234240
command: |
235241
circleci run release update \
236-
--status=CANCELED
242+
--status=CANCELED
237243
workflows:
238244
deploy-workflow:
239245
jobs:
240246
- deploy
241247
- cancel-deploy:
242248
requires:
243249
- deploy:
244-
- canceled
250+
- canceled
245251
----
246252

247253
== 2. Deploy logs
@@ -292,13 +298,13 @@ To manually create an environment integration, follow these steps:
292298
. In the CircleCI web app, select **Deploys** in the sidebar.
293299
. 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].
294300
. Enter a name for your environment, and a description if you would like.
295-
. Use the dropdown menu to choose your environment integration type, then select btn:[Next: Release Agent Setup].
301+
. Use the dropdown menu to choose your environment integration type, then select btn:[Next: Release Agent Setup].
296302
If you plan to only use deploy markers, as opposed to the Kubernetes agent, feel free to choose the `custom` type.
297303
**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.
298304

299305
== Next steps
300306

301-
By following the steps in this guide, you have added a deploy marker to your CircleCI configuration.
307+
By following the steps in this guide, you have added a deploy marker to your CircleCI configuration.
302308
You can now track the status of your deployments across your configured environments in the CircleCI deploys UI and in the project home page.
303309
You can now:
304310

jekyll/_cci2/deploy/deploys-overview.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ When setting up deploys you can choose one of two options:
2020

2121
* *Release agent*: Choose to use the CircleCI release agent, which you install in your cluster to enable you to manage your deployments through CircleCI.
2222

23-
* *Agentless*: Add CLI commands to your config to enable logging and tracking of deploys and deployment status in the CircleCI UI.
23+
* *Agentless*: Add CLI commands to your config to enable logging and tracking of deploys and deployment status in the CircleCI UI. Use rollbacks to rollback to a previous version of a component.
2424

2525
If you choose the release agent approach, you will have access to the following deploy management tools from CircleCI:
2626

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
contentTags:
3+
platform:
4+
- Cloud
5+
---
6+
= Rollback a project by workflow rerun
7+
:page-layout: classic-docs
8+
:page-liquid:
9+
:page-description:
10+
:icons: font
11+
:experimental:
12+
13+
This guides covers how to rollback a project by workflow rerun.
14+
15+
== Prerequisites
16+
17+
Before performing a rollback by workflow rerun, ensure you have configured deploy markers in your CircleCI workflows. Deploy markers track when deployments occur and are essential for rollback functionality. Follow the xref:configure-deploy-markers#[Configure Deploy Markers] guide to set this up. Autodetected deploy markers are *not* supported for use with rollbacks.
18+
19+
== Performing a rollback by workflow rerun
20+
21+
Workflow rerun rollbacks do not need any additional configuration beyond setting up deploy markers. To perform a rollback using workflow rerun:
22+
23+
. In the link:https://app.circleci.com[CircleCI web app], select your org from the org cards on your user homepage.
24+
. Select **Projects** from the sidebar and locate your project from the list. You can use the search to help.
25+
. Select the *Overview* link for your project.
26+
. Select btn:[Rollback].
27+
. Select btn:[Rollback by workflow re-run].
28+
29+
.Rollback options on project overview page
30+
image::deploy/project-overview-rollback.png[Rollback button on project overview page]
31+
32+
This will open the workflow re-run modal with the following options:
33+
34+
* *Choose a version*. Select the version you want to roll back to from the list of available versions.
35+
* *Confirm rollback*. Select btn:[Next], confirm rollback to proceed.
36+
37+
The workflow that originally deployed the selected version will be re-run, effectively performing a rollback to that version.
38+
39+
=== Important considerations
40+
41+
* *Advantage*: No setup required. This rollback method works immediately after configuring deploy markers.
42+
* *Disadvantage*: The entire workflow will be re-run, which may not always be desirable depending on your workflow complexity and duration
43+
* For complete control over the rollback process and to avoid re-running entire workflows, consider using the custom rollback pipeline approach described in the Setting Up Rollbacks in CircleCI section.
44+
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
contentTags:
3+
platform:
4+
- Cloud
5+
---
6+
= Rollback a project using the rollback pipeline
7+
:page-layout: classic-docs
8+
:page-liquid:
9+
:page-description:
10+
:icons: font
11+
:experimental:
12+
13+
This guide covers how to rollback a project using the rollback pipeline.
14+
15+
== Prerequisites
16+
17+
Before performing a rollback, ensure you have completed the rollback setup process and merged the rollback configuration pull request.
18+
19+
== Performing a Rollback
20+
21+
To perform a rollback using the rollback pipeline follow these steps::
22+
23+
. In the link:https://app.circleci.com[CircleCI web app], select your org from the org cards on your user homepage.
24+
. Select **Projects** from the sidebar and locate your project from the list. You can use the search to help.
25+
. Select the *Overview* link for your project.
26+
. Select btn:[Rollback].
27+
. Select btn:[Rollback by running rollback pipeline]. This opens the rollback execution modal.
28+
+
29+
image::deploy/rollback-execution-modal.png[Rollback execution modal]
30+
+
31+
The modal displays several configuration options with parameters auto-filled based on your rollback configuration. The following sections explain each required property:
32+
+
33+
* *Component Name*. This is the name of the component you wish to rollback. If your project deploys multiple components, this helps you choose a specific component you want to rollback.
34+
* *Environment Name*. This is the environment in which you wish to perform the rollback.
35+
* *Current Version*. Once you choose the component name and environment name, this will display all possible current versions. More often than not there should be just one current version available. You could have two in case a new progressive release is ongoing. Choose the version you believe is the current version of your component. To help you out, the relevant commit information is also displayed alongside the version.
36+
* *Target Version*. Choose the version you wish to rollback to. To help you out, the relevant commit information is also displayed alongside the version.
37+
* *Namespace*. This is optional. In case you use Kubernetes and do your deployments to a specific namespace, mention your namespace here, otherwise leave it empty.
38+
+
39+
The Parameters section shows the auto-filled parameters from your configuration file, which you can modify as needed for the specific rollback operation.
40+
41+
. *Execute*. Select btn:[Rollback] to trigger the rollback pipeline
42+
43+
The rollback pipeline will now execute and perform the rollback operation according to your configuration.
44+
45+
== Change Rollback Pipeline
46+
47+
If you have configured a new pipeline and want to trigger this pipeline when performing rollbacks, you can change which pipeline is used for rollback operations.
48+
49+
To select a different pipeline for rollbacks, follow these steps:
50+
51+
. Navigate to your project's Overview page.
52+
. Go to Settings.
53+
. Select the Deploys tab.
54+
. In the Rollback Pipeline section, choose the pipeline you want to be selected as the rollback pipeline from the dropdown.
55+
56+
This process allows you to switch between different rollback pipeline configurations as needed for your project.
57+
58+
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
---
2+
contentTags:
3+
platform:
4+
- Cloud
5+
---
6+
= Set up rollbacks in CircleCI
7+
:page-layout: classic-docs
8+
:page-liquid:
9+
:page-description:
10+
:icons: font
11+
:experimental:
12+
13+
Rollbacks allow you to quickly revert your application to a previous stable version when issues are detected in production. This guide covers how to configure your CircleCI pipeline to support manual rollback capabilities.
14+
15+
== Prerequisites
16+
17+
* A CircleCI account connected to your code. You can link:https://circleci.com/signup/[sign up for free].
18+
* A CircleCI project with a workflow configured to deploy your code.
19+
* Read through the xref:deploys-overview#[CircleCI deploys overview] guide.
20+
21+
== Set up rollbacks
22+
23+
=== 1. Manually configure deploy markers
24+
If not already set up, you must configure deploy markers in your CircleCI workflows. Deploy markers track when deployments occur and are essential for rollback functionality. Follow the xref:configure-deploy-markers#[Configure Deploy Markers] guide to set this up. Autodetected deploy markers are *not* supported for use with rollbacks.
25+
26+
The rest of this guide covers how to set up rollbacks using a custom rollback pipeline. At this point, after deploy markers are configured, you can use the xref:rollback-a-project-by-workflow-rerun#[Rollback by workflow rerun] method.
27+
28+
=== 2. Navigate to project overview
29+
30+
. In the CircleCI dashboard, navigate to *Organization Home* from the sidebar.
31+
. Select the *Overview* link for your project.
32+
33+
You will see a red Rollback button with a dropdown option on the project overview page.
34+
35+
.Rollback options on project overview page
36+
image::deploy/project-overview-rollback.png[Rollback button on project overview page]
37+
38+
=== 2. Start the rollback setup
39+
40+
. Select the btn:[Rollback] dropdown.
41+
. Select *Set up custom rollback pipeline* from the dropdown menu. This launches the rollback setup wizard.
42+
+
43+
NOTE: To use the rollback by pipeline method, your organization must be connected to the *CircleCI GitHub App*. If the GitHub App is not installed in your org, the rollback setup process will automatically prompt you to install it during setup.
44+
45+
The setup wizard guides you through configuring your custom rollback pipeline.
46+
47+
image::deploy/set-up-a-rollback-pipeline.png[Set up a rollback pipeline]
48+
49+
=== 3. Configure the rollback pipeline
50+
51+
. From the "What repo are you deploying?" dropdown, select the repository you want to create rollbacks for.
52+
. Select *Create pipeline definition* to proceed.
53+
54+
CircleCI creates a pipeline definition called rollback-pipeline and use the selected repository to store your rollback configuration.
55+
56+
=== 4. Review the generated configuration
57+
After creating the pipeline definition, the modal will display a pre-generated configuration file for performing rollbacks.
58+
59+
. Review the generated YAML configuration template to ensure you understand the rollback pipeline.
60+
. Select btn:[Commit Config] to create this rollback configuration template in your repository. The configuration will be committed to a new branch called `rollback-pipeline-setup` in your selected repository.
61+
62+
This config is a template rollback pipeline that includes the following:
63+
64+
* *Parameters section*: Placeholder parameters that you can customize for your specific deployment needs
65+
* *Jobs section*: A basic rollback job structure with common rollback configuration setups included (but commented out)
66+
67+
After committing, you can modify the configuration according to your needs by setting your own parameters and rollback logic. You can uncomment the included common rollback setups or write your own custom rollback implementation.
68+
69+
=== 5. Create pull request
70+
After committing the configuration template, the final step is to create a pull request:
71+
72+
. Select btn:[Create PR] to generate a pull request with your rollback configuration.
73+
+
74+
image::deploy/rollback-create-pr.png[Create PR for rollback pipeline]
75+
. Navigate to the pull request in your repository and modify the rollback configuration according to your specific deployment needs.
76+
. Once you have customized the configuration, merge the pull request to complete the rollback setup.
77+
78+
CAUTION: Until the pull request is merged, the rollback setup will not be complete and rollback functionality will not be available.
79+
80+
==== Configuration tips
81+
82+
When customizing your rollback configuration, you can use the following pipeline values to access rollback values:
83+
84+
* `pipeline.deploy.component_name`
85+
* `pipeline.deploy.environment_name`
86+
* `pipeline.deploy.target_version`
87+
* `pipeline.deploy.namespace`
88+
89+
==== Deploy markers for rollbacks
90+
You can use deploy markers with the `--rollback` flag to indicate rollback deployment:
91+
92+
[source,bash]
93+
----
94+
circleci run release plan \
95+
--environment-name=${ENVIRONMENT_NAME} \
96+
--namespace=${NAMESPACE} \
97+
--component-name=${COMPONENT_NAME} \
98+
--target-version=${TARGET_VERSION} \
99+
--rollback
100+
----
101+
102+
You can also update the status of the rollback deployment as mentioned in the xref:configure-deploy-markers#[Configure Deploy Markers] guide to reflect the state of the rollback accurately in the CircleCI UI.
103+
104+
=== 6. Access rollback functionality
105+
Once the pull request is merged, the rollback setup is complete. You can now use the rollback functionality in the CircleCI UI. For a full guide, see the xref:rollback-a-project-using-the-rollback-pipeline#[Rollback a project using the rollback pipeline] guide.
106+
107+
108+

jekyll/_data/sidenav.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -376,26 +376,34 @@ en:
376376
children:
377377
- name: Overview
378378
children:
379-
- name: Deploys overview
380-
link: deploy/deploys-overview
381379
- name: Overview of deployment on CircleCI
382380
link: deployment-overview
383-
- name: Set up
381+
- name: CircleCI deploys overview
382+
link: deploy/deploys-overview
383+
- name: Set up - Release agent
384384
children:
385385
- name: Set up CircleCI deploys
386386
link: deploy/set-up-circleci-deploys
387387
- name: Manual install - Set up the release agent
388388
link: deploy/set-up-the-release-agent
389389
- name: Manual install - Configure your Kubernetes components
390390
link: deploy/configure-your-kubernetes-components
391-
- name: How to
392-
children:
391+
- name: Update the Kubernetes release agent
392+
link: deploy/update-the-kubernetes-release-agent
393393
- name: Manage deploys
394394
link: deploy/manage-deploys
395+
- name: Set up - Agentless
396+
children:
395397
- name: Configure deploy markers
396398
link: deploy/configure-deploy-markers
397-
- name: Update the Kubernetes deploy agent
398-
link: deploy/update-the-kubernetes-release-agent
399+
- name: Set up rollbacks in CircleCI
400+
link: deploy/set-up-rollbacks
401+
- name: Rollback a project using the rollback pipeline
402+
link: deploy/rollback-a-project-using-the-rollback-pipeline
403+
- name: Rollback a project by workflow rerun
404+
link: deploy/rollback-a-project-by-workflow-rerun
405+
- name: How to
406+
children:
399407
- name: Deploy to Amazon SageMaker
400408
link: deploy-to-amazon-sagemaker
401409
- name: Deploy Android applications

0 commit comments

Comments
 (0)