agilepathway / gauge-confluence

Publishes Gauge specifications to Confluence. This is a documentation plugin for Gauge.
Apache License 2.0
3 stars 0 forks source link

Exit with non-zero code if plugin errors #41

Closed johnboyes closed 3 years ago

johnboyes commented 3 years ago

This commit causes the Gauge Confluence plugin to exit with a non-zero exit code if the plugin finds that any specs are not in a valid state for publishing. This is true both for dry run mode and "normal" mode.

It is useful for CI/CD as it means that the CI/CD pipeline can use the exit code (0 for success, not 0 for fail) to pass or fail the build.

So a typical workflow would be to have the plugin run in dry run mode on feature branches, and to fail the build if the plugin exits with a non-zero exit code. Then (once the dry run has succeeded and the change has been successfully merged to the trunk branch) the pipeline can run the plugin in normal mode and again pass or fail the build depending on the exit code. As the plugin has already passed in dry run mode on the feature branch, it should in theory always pass on the trunk branch, which is what we want.

NB Gauge only exits with a non-zero exit code for documentation plugins which return an error since v.1.4.1.