Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit684e77d

Browse files
authored
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
1 parentf4f7430 commit684e77d

File tree

9 files changed

+74
-54
lines changed

9 files changed

+74
-54
lines changed

‎_docs/pipelines/advanced-workflows.md‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ Running different types of tests (unit/integration/load/acceptance) in parallel
231231

232232
###Defining success criteria for a parallel step
233233

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.
235235

236236
You can define steps that will be used to decide if a parallel step succeeds with this syntax:
237237

@@ -557,7 +557,8 @@ of matrix variations can quickly grow if you add too many dimensions.
557557
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.
558558

559559
##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_.
561562

562563
To activate advanced parallel mode for the whole pipeline, you need to declare it explicitly at the root of the`codefresh.yml` file:
563564

@@ -695,7 +696,8 @@ steps:
695696

696697
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.
697698

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.
699701

700702

701703
###Multiple step dependencies
@@ -935,15 +937,19 @@ steps:
935937

936938
##Handling error conditions in a pipeline
937939

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.
939941

940942
By default,*any* failed step in a pipeline will abort the whole pipeline and mark it as failure.
941943

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
944948
* At the root level of the pipeline if you want to apply it to all steps
945949

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:
947953

948954
```
949955
version: '1.0'

‎_docs/pipelines/steps/approval.md‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ step_name:
5555
|`description`| A basic, free-text description of the step.| Optional|
5656
|`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|
5757
|`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|
5960
|`stage`| Parent group of this step. See[using stages]({{site.baseurl}}/docs/pipelines/stages/) for more information.| Optional|
6061
|`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|
6162

@@ -153,11 +154,11 @@ max-width="90%"
153154
>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
154155
is scheduled in the same node once the pipeline resumes. Otherwise the volume will not be reused.
155156

156-
##Controlling theRejection Behavior
157+
##Controlling therejection behavior
157158

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.
159160

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.
161162

162163
`codefresh.yml`
163164
{% highlight yaml %}
@@ -166,12 +167,13 @@ version: '1.0'
166167
steps:
167168
waitForInputBeforeProduction:
168169
fail_fast: false
170+
strict_fail_fast: true
169171
type: pending-approval
170172
title: Deploy to Production?
171173
{% endraw %}
172174
{% endhighlight %}
173175

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).
175177

176178

177179
##Getting the Approval Result
@@ -201,8 +203,8 @@ steps:
201203
{% endraw %}
202204
{% endhighlight %}
203205

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.
206208

207209
You can follow the same pattern for running steps when an approval step was rejected.
208210
Here is a full example with both cases.
@@ -295,7 +297,7 @@ it, the other two steps will be ignored.
295297

296298
##Define Concurrency Limits
297299

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.
299301

300302
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.
301303

‎_docs/pipelines/steps/build.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ step_name:
9898
| `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 |
9999
| `target` | The target stage at which to stop the build in a multistage build. | Optional |
100100
|`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 |
102103
| `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 |
103104
| `metadata` | Annotate the built image with [key-value metadata]({{site.baseurl}}/docs/pipelines/docker-image-metadata/). | Optional |
104105
| `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 |
@@ -150,6 +151,7 @@ step_name:
150151
tag_policy:original
151152
timeout:45m
152153
fail_fast:false
154+
strict_fail_fast:true
153155
metadata:
154156
set:
155157
-qa:pending

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp