Module
- Drone
Environment
- Infrastructure: Drone Cloud
- OS: Linux, Windows
Issue
Why Did The Notification Show The Build Was Success Though The Pipeline Step Failed On Drone?
This is the my .drone.yml file
kind: pipeline
type: exec
name: Deploy to UAT
trigger:
branch:
- master
clone:
disable: true
steps:
- name: Deploy to UAT
failure: ignore
commands:
- cd /var/www/website
- git pull origin master
- yarn build
- export PM2_HOME=/home/ubuntu/.pm2
- pm2 reload 1
---
kind: pipeline
type: docker
name: Notify
trigger:
branch:
- master
clone:
disable: true
steps:
- name: Send Telegram Notification
image: appleboy/drone-telegram
settings:
token:
from_secret: TELEGRAM-TOKEN
to:
from_secret: TELEGRAM-CHANNEL-ID
- name: Send Email Notification
image: drillster/drone-email
settings:
host:
from_secret: SMTP-HOST
username:
from_secret: SMTP-USERNAME
password:
from_secret: SMTP-PASSWORD
from:
from_secret: SMTP-USERNAME
depends_on:
- Deploy to UAT
Resolution
If you want to allow a step to fail without failing the entire pipeline, you can provide failure: ignore
attribute. In this way, you are instructing Drone to ignore the failure of an individual step. As per the .drone.yml file, you have defined this attribute. So, the step failure didn’t reflect in the notification. You can also use when
clause to specify that a step should run on success/failure.
when:
status:
- success
- failure