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

Create a tag and push into my repository. Trigger slack notification, but got 'panic: runtime error: slice bounds out of range' #100

Closed liu-weihao closed 4 years ago

liu-weihao commented 4 years ago

when i create tag and push:

git tag -a '1.0.0' -m '1.0.0'
git push origin 1.0.0

step config below:

- name: prenotify
  image: plugins/slack
  pull: if-not-exists
  failure: ignore
  detach: true
  settings:
    webhook: https://hooks.slack.com/services/Txxjfoi892SA
    channel: proj-cicd
    username: ${DRONE_COMMIT_AUTHOR}
    icon_url: https://unsplash.it/256/256/?random
    template: >
        Hi, I'm starting <{{build.link}}|build#{{build.number}}> at <https://git.pm.bwoilmarine.com/${DRONE_REPO}|{{repo.name}}> due to {{build.event}}. DO NOT repeat that again untill its completion.

error logs below:

panic: runtime error: slice bounds out of range

goroutine 1 [running]: main.message(0xc00001e041, 0x1d, 0xc000016590, 0x8, 0xc0000161ea, 0x7, 0xc000016552, 0x3, 0x8, 0xc0000164a0, ...) /drone/src/plugin.go:112 +0x240 main.Plugin.Exec(0xc00001e041, 0x1d, 0xc000016590, 0x8, 0xc0000161ea, 0x7, 0xc000016552, 0x3, 0x8, 0xc0000164a0, ...) /drone/src/plugin.go:71 +0xb4 main.run(0xc0000dc9a0, 0xc0000dc9a0, 0xc0000bb42f) /drone/src/main.go:223 +0xacf github.com/urfave/cli.HandleAction(0x73b280, 0x7c3498, 0xc0000dc9a0, 0xc0000d0fc0, 0x0) /go/pkg/mod/github.com/urfave/cli@v1.20.0/app.go:490 +0xc8 github.com/urfave/cli.(*App).Run(0xc0000d89c0, 0xc0000be190, 0x1, 0x1, 0x0, 0x0) /go/pkg/mod/github.com/urfave/cli@v1.20.0/app.go:264 +0x59d main.main() /drone/src/main.go:175 +0x171d

if i commit, not tag, everything goes well. e.g:

git add .
git commit -m 'balabala'
git push
tboerger commented 4 years ago

I think you are not using the latest plugin version, referenced line 112 doesn't match today's code.

liu-weihao commented 4 years ago

I think you are not using the latest plugin version, referenced line 112 doesn't match today's code.

i cannot find any more images at Docker Hub. u mean building from source code by myself, right?

tboerger commented 4 years ago

Are you sure you are using really latest? You have defined if-not-exists which doesn't update the slack plugin.

Beside that you are missing more information like which source provider is used to check if this is simply missing an important value.

liu-weihao commented 4 years ago

i am defintely sure i am using the latest plugins/slack. Here is a .drone.yml file below:

kind: pipeline
type: docker
name: mol-i18n
clone:
  disable: true

steps:        
- name: clone
  image: alpine/git
  pull: if-not-exists
  commands:
  - git config --global http.sslVerify "false" 
  - git clone https://$${username}:$${password}@git.pm.bwoilmarine.com/${DRONE_REPO} .
  - git checkout $DRONE_COMMIT

- name: prenotify
  image: plugins/slack
  pull: always
  settings:
    webhook: https://hooks.slack.com/services/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
    channel: working_topic
    username: ${DRONE_COMMIT_AUTHOR}
    template: >
        Hi, I am starting <{{build.link}}|build#{{build.number}}> at <https://git.pm.bwoilmarine.com/${DRONE_REPO}|{{repo.name}}> due to {{build.event}}. DO NOT repeat that again untill its completion.
tboerger commented 4 years ago

You still don't provide all relevant information.

jeeftor commented 4 years ago

I've run into the exact same error unfortunately...

tboerger commented 4 years ago

Just try it again, I have merged https://github.com/drone-plugins/drone-slack/pull/108 2 hours ago.