You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Update workflows.adoc
Added the text to include cancelling an approval job. Was not able to an image replacement.
* fix tab formatting
* update image
* remove redundant headers
---------
Co-authored-by: Rosie Yohannan <[email protected]>
Copy file name to clipboardExpand all lines: jekyll/_cci2/workflows.adoc
+30-4Lines changed: 30 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -154,15 +154,18 @@ See the link:https://github.com/CircleCI-Public/circleci-demo-workflows/tree/fan
154
154
[#holding-a-workflow-for-a-manual-approval]
155
155
== Hold a workflow for a manual approval
156
156
157
-
Use an `approval` job to configure a workflow to wait for manual approval before continuing. Anyone who has push access to the repository can approve the job to continue the workflow. Approve either by using the *Approve* button in the CircleCI web app, or via the API.
157
+
Use an `approval` job to configure a workflow to wait for manual approval before continuing. Anyone who has push access to the repository can approve the job to continue the workflow or cancel to end the workflow. Approve or Cancel either by using the buttons in the CircleCI web app, or via the API.
158
158
159
159
Some things to keep in mind when using manual approval in a workflow:
160
160
161
161
* `approval` is a special job type that is configured when listing jobs under the `workflows` key. You do not need to define an `approval` type job in the `jobs` section of your configuration. If you do configure steps for a job that is given the `approval` type in the workflows section, the steps for that job will not be run. An `approval` job is _only_ used to _hold_ the workflow for approval, not to run any work.
162
162
* The `approval` job name must be unique and not used by any other job in your configuration.
163
163
* The name of the approval job is arbitrary. For example, an approval job can be named `hold`, `wait`, `pause`, etc.
164
164
* All jobs that run _after_ a manual approval job **must** `require` the name of the `approval` job.
165
-
* Jobs run in the order defined in the workflow. When the workflow encounters a job with `type: approval`, the workflow pauses until approval is granted. Once approval is granted the workflow continues to process jobs in the order defined in the configuration file.
165
+
* Jobs run in the order defined in the workflow.
166
+
* When the workflow encounters a job with `type: approval`, the workflow pauses until action is taken to approve or cancel.
167
+
* If approval is granted the workflow continues to process jobs in the order defined in the configuration file.
168
+
* If cancel is granted the downstream jobs are not run.
166
169
* Jobs downstream of an `approval` job can be restricted by adding a xref:contexts#approve-jobs-that-use-restricted-contexts[restricted context] to those downstream jobs.
167
170
168
171
The following screenshot demonstrates:
@@ -173,7 +176,7 @@ The following screenshot demonstrates:
173
176
174
177
image::/docs/assets/img/docs/approval-workflow-map.png[A three section image showing workflow map with "Needs approval" job, the approval popup, and the workflow map]
175
178
176
-
By clicking on the `approval` job's name (`hold`, in the screenshot above), an approval dialog box appears. You can approve or close the popup without approving.
179
+
By clicking on the `approval` job's name (`hold`, in the screenshot above), an approval dialog box appears. You can approve, cancel, or close the popup without approving.
177
180
178
181
=== Configure an approval job
179
182
@@ -227,7 +230,30 @@ To approve a job follow these steps:
. Select the `hold` job in the *Workflows* page of the CircleCI web app.
245
+
. Select btn:[Cancel].
246
+
--
247
+
248
+
[.tab.cancel.API]
249
+
--
250
+
. Set up your API authentication. Steps are available in the xref:api-developers-guide#add-an-api-token[API developers guide].
251
+
. You need your job ID (which is the job ID for the job requiring approval) to make the API POST request. Depending on your use case, you might be configuring an approval job in a pipeline, or using an external service to approve a job. You can get the required parameters using xref:variables#[pipeline values or environment variables], or by xref:webhooks#[receiving webhooks] or polling the API. To cancel a job, use the link:https://circleci.com/docs/api/v2/index.html#operation/cancelJobByJobID[cancel a job] endpoint, for example:
0 commit comments