I’m using the Slack plugin to send messages after a pipeline succeeds/fails. I’m noticing that sometimes, incorrect statuses are shown (i.e., if a pipeline succeeds, Slack shows a “failed” notification).
Here’s a stripped down .drone.yml – I’ve omitted all of the various steps except the Slack notification at the end of each:
The Slack notifications, however, don’t reflect this. Since I’m a new user and can only put one image per post, I’ll follow up with a screenshot of Slack.
if a pipeline succeeds, Slack shows a “failed” notification
The screenshot shows that the Home Assistant step failed in the Linting pipeline, in which case I would expect the Slack notification for the Linting pipeline to have a failed status.
Any pipeline that is started after Linting is complete will reflect the fact that the overall build has failed because the Linting pipeline has failed. The Slack plugin uses the overall build status when posting the message, not the individual pipeline status. This is not a requirement, but is a deliberate design decision made by the plugin authors. One could create a plugin that uses the individual pipeline status instead.
I hope this helps clarify. I am not sure there is not enough detail for me to conclude there is an issue with Drone or with the plugin. I do apologize if I am misunderstanding, however, if that is the case perhaps you could provide a more detailed report with steps to reproduce?
per my previous comment this could be the expected behavior:
Any pipeline that is started after Linting is complete will reflect the fact that the overall build has failed because the Linting pipeline has failed. The Slack plugin uses the overall build status when posting the message, not the individual pipeline status. This is not a requirement, but is a deliberate design decision made by the plugin authors. One could create a plugin that uses the individual pipeline status instead.
While I appreciate that you simplified the yaml that you posted to this thread, it also has the potential to leave out important details that are required to troubleshoot, and has me asking questions and wondering what I could be missing.
The best way to get further assistance with this matter is to provide a simple, stripped down, yaml file that I can use (with the least amount of effort) to reproduce the problem.
@bradrydzewski Apologies for the disjointed and incomplete communications – my being a new user limited me to one post until my account was authorized.
This makes total sense – if the plugin was defined this way, I shouldn’t expect different results.
It’s going to be hard to provide a simple, stripped-down YAML that also includes all crucial details. All that said, let’s make sure there’s an actual problem and not just a misunderstanding from me: does my Slack message lead you to believe that the plugin isn’t acting as it should?
there is not enough details here for me to reach that conclusion. I would need to see a more complete yaml file that is confirmed to reproduce the behavior you have described above.
Got it. If you’re willing, below is my full, production YAML (note that it now has a separate pipeline for Slack notifications, per your recommendation thus far).
Linting: this pipeline just runs a bunch of linters against various sections of my repo
Home Assistant: runs configuration checks on various versions of Home Assistant
ESPHome: runs configuration checks on various versions of ESPHome
NGINX: runs configuration checks against my NGINX config
Build Notification: Sends the final build notification to Slack
I noticed in your yaml that you have not added depends_on to ensure you notification pipeline is executed after all other pipelines complete. As a result, the notification pipeline is scheduled to execute immediately, at the same time as all your other pipelines. The slack message therefore reflects the overall build status (passing) at the time the notification pipeline was started.
Didn’t know that existed – great! I’ll give it a shot.
One thing from the docs that I’m curious about (bolded reference mine):
In the below example, the first two pipelines execute in parallel. On successful completion a third pipeline is executed that sends a Slack notification indicating the workflow is complete.
Does this mean the final pipeline only runs if the first two are successful? Or does it mean that regardless of final status, the final pipeline merely waits for those first two to be done before executing?