Reputation: 12730
I want to execute an arbitrary shell script, but I only want it to run on build failure. Is there some way to either:
Thoughts and ideas appreciated!
Upvotes: 5
Views: 3200
Reputation: 1639
My solution to this issue is more rudimentary and consists of 3 custom tasks:
build.success
build.success
file and acts accordinglyMy use case for the above is sending notifications to IM system not supported by Bamboo plugins (RocketChat). Current limitations:
build.success
file) and fail are not detectedIt's ridiculous that a CI/CD system would not implement some kind of env var like "bamboo.build.result".
Upvotes: 1
Reputation: 4589
bamboo unfortunately lacks a way to trigger something on failure. You can not launch other plan, other stage and so on - you can only send basic notification.
As some workaround, you can move all the jobs to one stage, and have the script in the Final section. You can pass ${bamboo.buildNumber}
to your script, and based on that number request status data from https://user:[email protected]/builds/rest/api/latest/result/PROJECT/BUILD_NUMBER.json?expand=stages.stage.results - then you only have to parse the json and get your build state from json['stages']['stage'][0]['state']
Upvotes: 6