-
Suggestion
-
Resolution: Fixed
-
None
Current behavior
- Currently, Artifacts are not uploaded for failed steps.
Suggestion:
- One possible solution could be to provide an option per registered artifact, in which we can decide to have them despite the result, or only if failed or succeeded. The option "only on success" could then be the default option, as this is the behavior as it is today.
Business case:
We use 'cypress' to run our tests, which creates screen-recordings of tests that we want to access if the tests fail. Furthermore, we use the same pipeline to automatically upload the build to our staging environment, which should not happen if the tests fail. Also, a red test indicates that there's something wrong, so I'd like it red (to use bitbuckets notifications for failed tests) but still have access to the artifacts.
Workaround
Bitbucket Pipelines achieves the default behavior of exiting on the first error by prepending your script with the "set -e” bash command. You can "undo” this at any point in your script using the command "set +e”. If you want all the commands in your script to execute regardless of errors then put "set +e” at the top of your script. If you just want to ignore the error for one particular command then put "set +e” before that command and "set -e” after it.
Once the scripts are forcefully successful with the help of the method mentioned above, the artifacts upload part will be executed and they will be available for download later.