In practice we have found that there are cases where an individual build step should not be fail the entire build.
Examples
It would be nice to have a standard way to enumerate steps within a drone.yml that can fail but won't fail the build.
pipeline:
notify:
...
allow_failure: true
pipeline:
notify:
...
allow_failure:
- notify
+1
I would also love to see this feature. Furthermore, it would be nice if we could both allow failure, and also catch that failure in a subsequent step. I can provide a use-case if desired.
I have a similar request but different use case.
pipeline:
build:
...
allow_failure: true
notify_build_failed:
message: "build failed"
when: failure
deploy:
...
allow_failure: true
notify_deploy_failed:
message: "deployment failed"
when: failure
integration_test:
...
allow_failure: true
notify_test_failed:
message: "integration tests failed"
when: failure
You can see in this use case, I don't necessarily want failures to continue the pipeline PAST the next step.
The way when: conditionals are implemented right now means all 3 notifications will get sent out all the same time when any part of the pipeline fails. I would like to tailor the notifications for each specific failure.
+1 to the ability to allow failure. My use case is similar to @donny-dont's: The telegram, slack, etc plugins should not fail the build, necessarily. The ability to do this with any build step would be pretty powerful I think.
@tonglil for your use case I think the better solution would be to provide pipeline meta data at runtime. For example, current step name, previous step name, name of step that failed the pipeline, etc. You could then use this information inside your notification template. I think we should therefore expand https://github.com/drone/drone/issues/1740
@donny-dont in terms of the cache plugins, I do not believe these plugins should return non-zero exit codes, since a broken cache has the ability to block all builds without manual intervention. I think this should be controlled at the plugin level, by default, as opposed to at the yaml level.
@jacobrichard the Slack plugin (for example) returns a non-zero exit code when the Slack API call fails. You could always create a Slack plugin that always returns a non-zero exit code, even on failure.
Personally I am not in favor of adding such a flag to the YAML at this time.
closed by https://github.com/drone/drone-runtime/commit/3e8bd99f60f4032226523320cd2b2321f9525159, will be included in 0.9
Most helpful comment
closed by https://github.com/drone/drone-runtime/commit/3e8bd99f60f4032226523320cd2b2321f9525159, will be included in 0.9