drone-discord icon indicating copy to clipboard operation
drone-discord copied to clipboard

Doesn't seem to run, says step successful?

Open Shyclyde opened this issue 4 years ago • 7 comments

Hey there, somehow I got this to run the first time, but every time after it looks like it just seems to skip the actual step but comes up as a pass. Here's my step:

- name: discord start notification
  image: appleboy/drone-discord
  settings:
    webhook_id:
      from_secret: discord_webhook_id
    webhook_token:
      from_secret: discord_webhook_id
    message: "Rebuilding..."

Something I'm doing wrong maybe? Triple checked the secrets are correct. I can run it in a docker container just fine with something like below with test env variables:

docker run -e WEBHOOK_ID=$HOOK_ID -e WEBHOOK_TOKEN=$HOOK_TOKEN -e MESSAGE=test appleboy/drone-discord

Not sure if this is an issue or if I'm missing something?

Thanks!

Shyclyde avatar May 25 '20 00:05 Shyclyde

Additionally, as a test I had added this to the step:

  commands:
  - echo "test"

Just to see if it was skipping the step entirely, but that seems to run fine. Also tried putting the secrets inline instead of through from_secret:, same result of the step passing with no actions.

Shyclyde avatar May 25 '20 00:05 Shyclyde

Me also. I'm arm64/v8. Did you have any luck?

more-pepsi avatar Mar 30 '22 17:03 more-pepsi

Within this YAML above, he's sharing the same value secret value for both the webhook_id and webhook_token. Without seeing the origin of said secret, I suspect this was the issue.

lukeawyatt avatar Mar 30 '22 17:03 lukeawyatt

- name: Message build status
  image: appleboy/drone-discord
  settings:
    webhook_id:
      from_secret: discord_id
    webhook_token:
      from_secret: discord_token
    message: >
      {{#success build.status}}
      build {{build.number}} succeeded. Good job.
      {{else}}
      build {{build.number}} failed. Fix me please.
      {{/success}}
    when:
      status: [ success, failure ]

image

See nothing. The webhook is set for the general channel. Removing the mesage field has got it working. The issue may be that the step runs for both general builds and pull requests? But I would have expected at least one notification. It will take me little to read the code, i'm a go newbie

more-pepsi avatar Mar 30 '22 18:03 more-pepsi

It has been a bit since I touched this, but my message value looks like this:

message: "{{#success build.status}}✅{{else}}❌{{/success}}  Repository `[{{repo.name}}/{{commit.branch}}]` triggered by event `[{{uppercase build.event}}]` for build.\n    - Commit [[{{commit.sha}}]({{commit.link}})]\n    - Author `[{{commit.author}} / {{commit.email}}]`\n    - Message: {{commit.message}}    - Drone build [[#{{build.number}}]({{build.link}})] reported `[{{uppercase build.status}}]` at `[{{datetime build.finished \"2006.01.02 15:04\" \"\"}}]`\n​"

I have a third value for when as well: changed

It's still in production and seems to be working fine daily for my use cases. Remembering back to the first setup, I think the message field held me up quite a bit. Maybe fill in the pieces above and see if it works as expected, then modify the message value to your need?

lukeawyatt avatar Mar 30 '22 18:03 lukeawyatt

It has been a bit since I touched this, but my message value looks like this:

message: "{{#success build.status}}✅{{else}}❌{{/success}}  Repository `[{{repo.name}}/{{commit.branch}}]` triggered by event `[{{uppercase build.event}}]` for build.\n    - Commit [[{{commit.sha}}]({{commit.link}})]\n    - Author `[{{commit.author}} / {{commit.email}}]`\n    - Message: {{commit.message}}    - Drone build [[#{{build.number}}]({{build.link}})] reported `[{{uppercase build.status}}]` at `[{{datetime build.finished \"2006.01.02 15:04\" \"\"}}]`\n​"

I have a third value for when as well: changed

It's still in production and seems to be working fine daily for my use cases. Remembering back to the first setup, I think the message field held me up quite a bit. Maybe fill in the pieces above and see if it works as expected, then modify the message value to your need?

Thanks man. Just got it working. I added a print of just the status and it worked.

:)

That should be in the docs. I'll add it. Feel free to reject it

more-pepsi avatar Mar 30 '22 19:03 more-pepsi

Glad I could help!

lukeawyatt avatar Mar 31 '22 02:03 lukeawyatt