Cirrus CI notify email on failed build

135 Views Asked by At

I have hosted my source code on github and added a trigger on each check in. When the trigger is triggered, the Cirrus-CI build tool starts to build my component. to achive this, github must be setup properly and each component must have a valid .cirrus.yml file, who is responsible for the build setup.

how can i change my config file so that i get a notification whenever my build fails?

Here is my .cirrus.yml file:

container:
  image: maven:latest

build_task:
  build_script: mvn clean compile test sonar:sonar

yes, it is rather short and on the Cirrus-CI help page are explanations concering email notification and writing conditional tasks but I don't see how i can get the build result and create a condition on that.

1

There are 1 best solutions below

0
On BEST ANSWER

the solution is simple as can be:

container:
  image: maven:latest

build_task:
  build_script: mvn clean compile test sonar:sonar
  on_failure:
    mail_script: mvn postman:send-mail

this requires the postman mail plugin in your pom.xml.