drone-plugins / drone-slack

Drone plugin for sending Slack notifications
http://plugins.drone.io/drone-plugins/drone-slack
Apache License 2.0
61 stars 80 forks source link

Drone <-> Slack integration errors after latest version released #112

Closed sheinbergon closed 2 years ago

sheinbergon commented 4 years ago

Pulling the latest plugins/slack image triggers the following error:

time="2020-09-17T14:31:23Z" level=error msg="execution failed: could not create template message: Evaluation error: Helper since called with argument 0 with type time.Time but it should be int64\nCurrent node:\n\tPath{Original:'build.started', Pos:190}"

drone configuration section:

Reverting back to 1.3.0 fixes the issue

Leen15 commented 4 years ago

The same here. The slack message arrives empty in slack and all the pipelines are failing.

donny-dont commented 4 years ago

@Leen15 are you using since as well or is this something different? The type changed from int64 to time.Time.

Leen15 commented 4 years ago

@donny-dont I'm using this plugin configured as follow:

---
kind: pipeline
name: notify-pipeline-start

steps:
  - name: slack
    image: plugins/slack
    settings:
      webhook:
        from_secret: SLACK_WEBHOOK
      channel:
        from_secret: SLACK_CHANNEL
      link_names: true
      # template source: https://gist.github.com/wzulfikar/e9064862d17467ed36b81d2f2c17389a
      template: >
        {{#if build.pull }}
          *Build started*: {{ repo.owner }}/{{ repo.name }} - <https://github.com/{{ repo.owner }}/{{ repo.name }}/pull/{{ build.pull }}|Pull Request #{{ build.pull }}>
        {{else}}
          *Build started: {{ repo.owner }}/{{ repo.name }} - Build #{{ build.number }}* (type: `{{ build.event }}`)
        {{/if}}
        Commit: <https://github.com/{{ repo.owner }}/{{ repo.name }}/commit/{{ build.commit }}|{{ truncate build.commit 8 }}>
        Branch: <https://github.com/{{ repo.owner }}/{{ repo.name }}/commits/{{ build.branch }}|{{ build.branch }}>
        Author: {{ build.author }}
        <{{ build.link }}|Visit build page ↗>

---
kind: pipeline
name: notify-pipeline-end

steps:
  - name: slack
    image: plugins/slack
    settings:
      webhook:
        from_secret: SLACK_WEBHOOK
      channel:
        from_secret: SLACK_CHANNEL
      link_names: true
      template: >
        {{#if build.pull }}
          *{{#success build.status}}✔{{ else }}✘{{/success}} {{ uppercasefirst build.status }}*: {{ repo.owner }}/{{ repo.name }} - <https://github.com/{{ repo.owner }}/{{ repo.name }}/pull/{{ build.pull }}|Pull Request #{{ build.pull }}>
        {{else}}
          *{{#success build.status}}✔{{ else }}✘{{/success}} {{ uppercasefirst build.status }}: {{ repo.owner }}/{{ repo.name }} - Build #{{ build.number }}* (type: `{{ build.event }}`)
        {{/if}}
        Commit: <https://github.com/{{ repo.owner }}/{{ repo.name }}/commit/{{ build.commit }}|{{ truncate build.commit 8 }}>
        Branch: <https://github.com/{{ repo.owner }}/{{ repo.name }}/commits/{{ build.branch }}|{{ build.branch }}>
        Author: {{ build.author }}
        Duration: {{ since build.created }}
        <{{ build.link }}|Visit build page ↗>

The "notify-pipeline-start" output is:

time="2020-09-17T14:45:27Z" level=info msg="sending message" channel="#********" username=

The "notify-pipeline-end" output is:

time="2020-09-17T14:48:00Z" level=error msg="execution failed: could not create template message: Evaluation error: Helper since called with argument 0 with type time.Time but it should be int64\nCurrent node:\n\tPath{Original:'build.created', Pos:726}"

I have the same steps in most of our repositories so every pipeline is failing due to this issue.

In slack it arrives an empty message (I think for the start step, nothing for the end step):

image

donny-dont commented 4 years ago

K thanks both of you we'll add those to a set of tests to make sure stuff doesn't break next time we try and reland this.

masterkain commented 4 years ago

is this released? still getting empty messages in mattermost. thanks

andyfcx commented 3 years ago

I encountered no response in slack channel, but the drone status shows success