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
Add fail_fast and strict_fail_fast to steps (#862)
* Add fail_fast and strict_fail_fast to stepsUpdated existing description of fail_fast and added strict_fail_fast* Update approval.md* Update approval.md* Update fail_fast and strict_fail_fastUpdated and added descriptions for fail_fast and strict_fail_fast to all pipeline step types
Copy file name to clipboardExpand all lines: _docs/pipelines/advanced-workflows.md
+13-7Lines changed: 13 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -231,7 +231,7 @@ Running different types of tests (unit/integration/load/acceptance) in parallel
231
231
232
232
###Defining success criteria for a parallel step
233
233
234
-
By default, any failed step in a Codefresh pipeline will fail the whole pipeline.There are ways to change this behavior(the`fail_fast`property is explained later in this page), but specifically for parallel steps you can define exactly when the whole step succeeds or fails.
234
+
By default, any failed step in a Codefresh pipeline will fail the whole pipeline.You can change the default execution behaviorthroughthe`fail_fast`field, but specifically for parallel steps you can define exactly when the whole step succeeds or fails.
235
235
236
236
You can define steps that will be used to decide if a parallel step succeeds with this syntax:
237
237
@@ -557,7 +557,8 @@ of matrix variations can quickly grow if you add too many dimensions.
557
557
Notice that, as with the`scale` syntax, the defined values/properties are merged between parent step (`MyUnitTests` in the example above) and children steps. For example, if you set an environment variable on the parent and also on child matrix steps , the result will a merged environment where all values are available.
558
558
559
559
##Parallel pipeline execution
560
-
>If you use parallel execution mode for pipelines, you_cannot_ use_implicit parallel steps_.
560
+
>**NOTE**:
561
+
If you use parallel execution mode for pipelines, you_cannot_ use_implicit parallel steps_.
561
562
562
563
To activate advanced parallel mode for the whole pipeline, you need to declare it explicitly at the root of the`codefresh.yml` file:
563
564
@@ -695,7 +696,8 @@ steps:
695
696
696
697
If you run the pipeline you will see that Codefresh automatically understands that`MyIntegrationTests` and`MyCleanupPhase` can run in parallel right after the unit tests finish.
697
698
698
-
Also notice the`fail_fast: false` line in the unit tests. By default, if*any* steps fails in a pipeline the whole pipeline is marked as a failure. With the`fail_fast` directive we can allow the pipeline to continue so that other steps that depend on the failed step can still run even.
699
+
Also notice the`fail_fast: false` line in the unit tests.
700
+
By default, if*any* step fails in a pipeline, the whole pipeline is marked as a failure. With`fail_fast` set to`false` as in the example, we can allow the pipeline to continue and complete execution.
699
701
700
702
701
703
###Multiple step dependencies
@@ -935,15 +937,19 @@ steps:
935
937
936
938
##Handling error conditions in a pipeline
937
939
938
-
It is important to understand the capabilities offered by Codefresh when it comes to error handling. You have several optionsin different levels of granularity to select what constitutes a failure and what not.
940
+
It is important to understand the capabilities offered by Codefresh when it comes to error handling. You have several optionsat different levels of granularity to select what constitutes a failure and what not.
939
941
940
942
By default,*any* failed step in a pipeline will abort the whole pipeline and mark it as failure.
941
943
942
-
You can use the directive`fail_fast: false`:
943
-
* In a specific step to mark it as ignored if it fails
944
+
**`fail_fast` with`strict_fail_fast`**
945
+
946
+
You can use the f`lag`fail_fast: false`:
947
+
* In a specific step to ignore it if it fails and continue execution
944
948
* At the root level of the pipeline if you want to apply it to all steps
945
949
946
-
Therefore, if you want your pipeline to keep running to completion regardless of errors the following syntax is possible:
950
+
If a parallel step has`fail_fast: false` in its definition, adding`strict_fail_fast: true` does not change the Build status returned even if a child step fails. This is because the parallel step itself is considered successful regardless of errors in child steps.
951
+
952
+
Therefore, if you want your pipeline to keep running to completion regardless of errors, you can add the following:
Copy file name to clipboardExpand all lines: _docs/pipelines/steps/approval.md
+10-8Lines changed: 10 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,7 +55,8 @@ step_name:
55
55
|`description`| A basic, free-text description of the step.| Optional|
56
56
|`timeout`| Defines an automatic approval/rejection if a specified amount of time has passed. The`duration` field is hours. By default it is set to 168 (i.e, 7 days). The`finalState` field defines what will happen after the duration time has elapsed. Possible values are`approved`/`denied`/`terminated`| Optional|
57
57
|`timeUnit` | This field defines possible options of`minutes`, or`hours`. If the field is not set, the default is`hours` | Optional
58
-
|`fail_fast`| If set to false, the pipeline will continue even when the step is rejected| Optional|
58
+
|`fail_fast`| Determines pipeline execution behavior in case of step failure. {::nomarkdown}<ul><li><codeclass="highlighter-rouge">true</code>: The default, terminates pipeline execution upon step failure. The Build status returns`Failed to execute`.</li><li><codeclass="highlighter-rouge">false</code>: Continues pipeline execution upon step failure. The Build status returns <codeclass="highlighter-rouge">Build completed successfully</code>. <br>To change the Build status, set <codeclass="highlighter-rouge">strict_fail_fast</code> to <codeclass="highlighter-rouge">true</code>.</li></ul>{:/}| Optional|
59
+
|`strict_fail_fast`| Specifies how to report the Build status`fail_fast` is set to`false`. {::nomarkdown}<ul><li><codeclass="highlighter-rouge">true</code>: Returns a Build status of failed on step failure.</li> <li><codeclass="highlighter-rouge">false</code>: Returns a Build status of successful regardless of step failures.</li></ul>{:/}**NOTE**: <codeclass="highlighter-rouge">strict_fail_fast</code> does not impact the Build status reported for parallel steps with <codeclass="highlighter-rouge">fail_fast</code> enabled. Even if a child step fails, the parallel step itself is considered successful. See also[Handling error conditions in a pipeline]({{site.baseurl}}/docs/pipelines/advanced-workflows/#handling-error-conditions-in-a-pipeline).| Optional|
59
60
|`stage`| Parent group of this step. See[using stages]({{site.baseurl}}/docs/pipelines/stages/) for more information.| Optional|
60
61
|`when`| Define a set of conditions that need to be satisfied in order to execute this step. You can find more information in the[conditional execution of steps]({{site.baseurl}}/docs/pipelines/conditional-execution-of-steps/) article.| Optional|
61
62
@@ -153,11 +154,11 @@ max-width="90%"
153
154
>Notice also that you if you use the[Codefresh Runner]({{site.baseurl}}/docs/installation/behind-the-firewall/) and your[Runner]({{site.baseurl}}/docs/installation/codefresh-runner/) is set up with local volumes, then the volume will only be present if the dind pod
154
155
is scheduled in the same node once the pipeline resumes. Otherwise the volume will not be reused.
155
156
156
-
##Controlling theRejection Behavior
157
+
##Controlling therejection behavior
157
158
158
-
By default if you reject a pipeline, it will stop right away and it will be marked as failed. All subsequent steps after the approval one will not run at all.
159
+
By default if you reject a pipeline, it will stop right away and it will be marked as failed. All subsequent steps after the`approval` one will not run at all.
159
160
160
-
You might want to continue running the pipeline even whenit is rejectedby adding the`fail_fast` property in the approval step:
161
+
You might want to continue running the pipeline even whenone of the steps fail executionby adding the`fail_fast` property in the`approval` step. In this case, you can also add the`strict-fail_fast` flag to specify if the build status at the end of execution should return failed instead of successful which is the default.
161
162
162
163
`codefresh.yml`
163
164
{% highlight yaml %}
@@ -166,12 +167,13 @@ version: '1.0'
166
167
steps:
167
168
waitForInputBeforeProduction:
168
169
fail_fast: false
170
+
strict_fail_fast: true
169
171
type: pending-approval
170
172
title: Deploy to Production?
171
173
{% endraw %}
172
174
{% endhighlight %}
173
175
174
-
In this case you can also read the approval result and make the pipeline work differently according to each choice (demonstrated in the following section).
176
+
You can also read the approval result and make the pipeline work differently according to each choice (demonstrated in the following section).
175
177
176
178
177
179
##Getting the Approval Result
@@ -201,8 +203,8 @@ steps:
201
203
{% endraw %}
202
204
{% endhighlight %}
203
205
204
-
In this example the second step thatis destroying an environment will only run if the user
205
-
approves the first step. In case of rejection the second stepwill be skipped.
206
+
In this example, the second step thatdestroys an environment will only run if the user
207
+
approves the first step. In case of rejection the second stepis skipped.
206
208
207
209
You can follow the same pattern for running steps when an approval step was rejected.
208
210
Here is a full example with both cases.
@@ -295,7 +297,7 @@ it, the other two steps will be ignored.
295
297
296
298
##Define Concurrency Limits
297
299
298
-
Codefresh has the ability to limit the amount of running builds for a specific pipeline with several concurrency policies in the pipeline settings. You can choose if a buildthat is in apending approval statewill count against the concurrency limits or not.
300
+
Codefresh has the ability to limit the amount of running builds for a specific pipeline with several concurrency policies in the pipeline settings. You can choose if a build pending approval statecounts against the concurrency limits or not.
299
301
300
302
As an example let's say that the concurrency limit for a specific pipeline is set to 2. Currently there is one active/running build and a second build that is pending approval.
Copy file name to clipboardExpand all lines: _docs/pipelines/steps/build.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,7 +98,8 @@ step_name:
98
98
| `build_arguments` | The set of [Docker build arguments](https://docs.docker.com/engine/reference/commandline/build/#set-build-time-variables-build-arg){:target="\_blank"} to pass to the build process. | Optional |
99
99
| `target` | The target stage at which to stop the build in a multistage build. | Optional |
100
100
|`timeout` | The maximum duration permitted to complete step execution in seconds (`s`), minutes (`m`), or hours (`h`), after which to automatically terminate step execution. For example, `timeout:1.5h`. <br>The timeout supports integers and floating numbers, and can be set to a maximum of 2147483647ms (approximately 24.8 days). <br><br>If defined and set to either `0s/m/h` or `null`, the timeout is ignored and step execution is not terminated.<br>See [Add a timeout to terminate step execution](#add-a-timeout-to-terminate-step-execution). |Optional|
101
-
| `fail_fast` | Define the build behavior on step failure. When set to `true`, the default, ff a step fails, the build is stopped as well. To continue the build on step failure, set to `false`. | Default |
101
+
| `fail_fast` | Determines pipeline execution behavior in case of step failure. {::nomarkdown}<ul><li><code class="highlighter-rouge">true</code>:The default, terminates pipeline execution upon step failure. The Build status returns `Failed to execute`.</li><li><code class="highlighter-rouge">false</code>: Continues pipeline execution upon step failure. The Build status returns <code class="highlighter-rouge">Build completed successfully</code>. <br>To change the Build status, set <code class="highlighter-rouge">strict_fail_fast</code> to <code class="highlighter-rouge">true</code>.</li></ul>{:/}| Optional |
102
+
| `strict_fail_fast` | Specifies how to report the Build status `fail_fast` is set to `false`. {::nomarkdown}<ul><li><code class="highlighter-rouge">true</code>:Returns a Build status of failed on step failure.</li> <li><code class="highlighter-rouge">false</code>: Returns a Build status of successful regardless of step failures.</li></ul>{:/}**NOTE**: <code class="highlighter-rouge">strict_fail_fast</code> does not impact the Build status reported for parallel steps with <code class="highlighter-rouge">fail_fast</code> enabled. Even if a child step fails, the parallel step itself is considered successful. See also [Handling error conditions in a pipeline]({{site.baseurl}}/docs/pipelines/advanced-workflows/#handling-error-conditions-in-a-pipeline).| Optional |
102
103
| `when` | The set of conditions that need to be satisfied in order to execute this step.<br>For more information, see [Conditional execution of steps]({{site.baseurl}}/docs/pipelines/conditional-execution-of-steps/) . | Optional |
103
104
| `metadata` | Annotate the built image with [key-value metadata]({{site.baseurl}}/docs/pipelines/docker-image-metadata/). | Optional |
104
105
| `on_success`, `on_fail` and `on_finish` | Define operations to perform upon step completion using a set of predefined [Post-step operations]({{site.baseurl}}/docs/pipelines/post-step-operations/). | Optional |