Notification plugins always reports success

Hi

After an update months ago (not sure which one) I started to see this bug were all my builds were reported as success regardless of build status.

I currently use the Discord plugin, but this also happens with the Email plugin that I use on some jobs. I’m sure it is just some configuration silliness from my side, but I really cannot see it.

For example, I pack up my dotfiles using Drone and it has been failing lately:

But the notification sent to Discord reports a success.

It strangely also reports a 0s buildtime which make me suspect that it actually use the information (status and build duration) from the actual notification step and not the pipeline.

The pipeline looks as follows:

---
{
   "kind": "pipeline",
   "name": "Kubernetes",
   "node_selector": {
      "drone": true
   },
   "steps": [
      {
         "commands": [
            "pwd",
         ],
         "environment": {
            "DEBIAN_FRONTEND": "noninteractive",
            "DISPLAY": ":9.0",
            "HOME": "/home/ubuntu"
         },
         "image": "ubuntu:latest",
         "name": "Build",
         "pull": "always"
      },
      {
         "environment": {
            "SSH_KEY": {
               "from_secret": "ssh_key"
            }
         },
         "image": "appleboy/drone-scp",
         "name": "Deploy to builds",
         "pull": "always",
         "settings": {
            "host": "storage.terra.fap.no",
            "rm": true,
            "source": [
               "dist/*"
            ],
            "strip_components": 1,
            "target": "/storage/nfs/k8s/builds/dotfiles",
            "username": "deploy"
         },
         "when": {
            "branch": [
               "master"
            ],
            "event": [
               "push"
            ]
         }
      },
      {
         "image": "appleboy/drone-discord",
         "name": "Notify Discord",
         "pull": "always",
         "settings": {
            "message": "{{#success build.status}} ✅  Build #{{build.number}} of `{{repo.name}}` succeeded.\n\n📝 Commit by {{commit.author}} on `{{commit.branch}}`:\n``` {{commit.message}} ```\n🌐 {{ build.link }}\n\n ✅ duration: {{duration build.started build.finished}} \n\n ✅ started: {{datetime build.started \"2006/01/02 15:04\" \"UTC\"}} \n\n ✅ finished: {{datetime build.finished \"2006/01/02 15:04\" \"UTC\"}} {{else}} ❌  Build #{{build.number}} of `{{repo.name}}` failed.\n\n📝 Commit by {{commit.author}} on `{{commit.branch}}`:\n``` {{commit.message}} ```\n🌐 {{ build.link }}\n\n ✅ duration: {{duration build.started build.finished}} \n\n ✅ started: {{datetime build.started \"2006/01/02 15:04\" \"UTC\"}} \n\n ✅ finished: {{datetime build.finished \"2006/01/02 15:04\" \"UTC\"}}{{/success}}\n",
            "webhook_id": {
               "from_secret": "discord_webhook_id"
            },
            "webhook_token": {
               "from_secret": "discord_webhook_token"
            }
         },
         "when": {
            "status": [
               "success",
               "failure"
            ]
         }
      }
   ],
   "type": "kubernetes"
}

Link to not stripped down: dotfiles/.drone.yml at 10a5049972d1e24704978cdf0a2641a7e7d071ec · kradalby/dotfiles · GitHub

In this version above I use when to figure out if it fails or not, because when I try trigger, the step does not run at all.


Kristoffer

notification plugins need to be patched in order to work with kubernetes pipelines. see:
https://docs.drone.io/runner/kubernetes/overview/#known-issues--differences

ah, thanks @bradrydzewski.

Sorry I didnt come over that part of the docs. I have filed an issue with the plugin and if times allow ill see if I can fix it.