My solution to this issue is more rudimentary and consists of 3 custom tasks:
- one at the end of the tasks list which creates a status file, name is arbitrary but consistent, e.g.
build.success
- one at the beginning of the tasks list that deletes the status file (in case workdir directory cleanup is not enabled)
- one task in the beginning of the final tasks list which checks on the existence of
build.success
file and acts accordingly
My use case for the above is sending notifications to IM system not supported by Bamboo plugins (RocketChat). Current limitations:
- final tasks which run after the first one (that consumes the
build.success
file) and fail are not detected
- no detection of stopped runs: the final task is always executed
- complex logic when there are multiple stages, e.g. I add an extra initial stage for sending notifications at build start and an extra stage at the end for sending a "successful build" notification
It's ridiculous that a CI/CD system would not implement some kind of env var like "bamboo.build.result".