appleboy/drone-telegram

Kubernetes: build.status is always success

smnbbrv opened this issue ยท 3 comments

Hi,

using your plugin for a long time. Thank you for your work!

However, on a new cluster I have a weird behaviour - regardless of the build result the status is always "success". Here is the config:

kind: pipeline
type: kubernetes
name: default

steps:
  - name: failure
    image: alpine
    commands:
      - exit 1
  
  - name: telegram
    when:
      status: [success, failure]
    image: appleboy/drone-telegram
    settings:
      debug: true
      token:
        from_secret: telegram_token
      to:
        from_secret: telegram_to
      format: markdown
      message: |
        Build status: {{build.status}}

        {{#success build.status}}๐Ÿš€{{else}}๐Ÿž{{/success}} {{repo.name}}@{{commit.branch}}

        {{commit.message}}
        More at {{build.link}}

        ----------

Here is how it runs

image

And here is the Telegram message:

image

I tried to put debug: true however it does not give any info concerning that issue.

Actually, after some searching in your source code, found that the DRONE_BUILD_STATUS is always success in my config.

Looks like it is a Kubernetes pipelines issue as pointed at https://discourse.drone.io/t/drone-build-status-always-success-in-kubernetes/6627 . One needs to read the file instead of environment variable... They even have an example implementation for Slack in the answer:

image

Could this be implemented in your plugin as well?

@smnbbrv Please try the latest master version.

Thank you very much, it finally works!