Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sheinbergon opened this issue Sep 17, 2020 · 6 comments
Closed

Comments

@sheinbergon
Copy link

sheinbergon commented Sep 17, 2020

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:

  • name: slack
    image: plugins/slack:latest
    settings:
    webhook:
    from_secret: slack_webhook
    channel: drone-notificiations
    template: >
    {{uppercase build.status}}

    Repo: *{{repo.name}}*
    
    Branch: *{{build.branch}}*
    
    Commit: *{{build.commit}}*
    
    Build Number: *{{build.number}}*
    
    Author: *{{build.author}}*
    
    Build duration: *{{since build.started}}*
    
    {{build.link}}
    

    when:
    status: [ success, failure ]

Reverting back to 1.3.0 fixes the issue

@sheinbergon sheinbergon changed the title Drone slack integration errors after latest version released Drone <-> Slack integration errors after latest version released Sep 17, 2020
@Leen15
Copy link

Leen15 commented Sep 17, 2020

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

@donny-dont
Copy link
Contributor

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

@Leen15
Copy link

Leen15 commented Sep 17, 2020

@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
Copy link
Contributor

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
Copy link

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

@andyfcx
Copy link

andyfcx commented Nov 5, 2020

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

@tphoney tphoney closed this as completed Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants