wantedly / step-pretty-slack-notify

Posts wercker build/deploy status to a Slack channel
MIT License
88 stars 34 forks source link

Build status #7

Closed outrunthewolf closed 9 years ago

outrunthewolf commented 9 years ago

Hi, Could you possibly add in a build status or some kind of CI step for pull requests. I ask because our build steps fail if this box fails.

cd $WERCKER_SOURCE_DIR
$ export WERCKER_STEP_ROOT="/wercker/steps/wantedly/pretty-slack-notify/0.2.2"
$ export WERCKER_STEP_ID="b059e242-d9c9-4dbc-bd90-1062296fb3b9"
$ export WERCKER_STEP_NAME="pretty-slack-notify"
$ export WERCKER_REPORT_NUMBERS_FILE="$WERCKER_REPORT_DIR/$WERCKER_STEP_ID/numbers.ini"
$ export WERCKER_REPORT_MESSAGE_FILE="$WERCKER_REPORT_DIR/$WERCKER_STEP_ID/message.txt"
$ export WERCKER_REPORT_ARTIFACTS_DIR="$WERCKER_REPORT_DIR/$WERCKER_STEP_ID/artifacts"
$ mkdir -p $WERCKER_REPORT_ARTIFACTS_DIR
$ export WERCKER_STEP_TEMP="/tmp/$WERCKER_STEP_ID"
$ source '/wercker/wercker-build-essentials/init.sh'
$ mkdir -p $WERCKER_STEP_TEMP
$ export WERCKER_PRETTY_SLACK_NOTIFY_TEAM="moltin"
$ export WERCKER_PRETTY_SLACK_NOTIFY_WEBHOOK_URL="$SLACK_TOKEN"
$ export WERCKER_PRETTY_SLACK_NOTIFY_CHANNEL="github"
$ export WERCKER_PRETTY_SLACK_NOTIFY_USERNAME="wercker"
$ source "$WERCKER_STEP_ROOT/run.sh"
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
Fetching: slack-notifier-1.0.0.gem (100%)
Successfully installed slack-notifier-1.0.0
1 gem installed
/var/lib/gems/1.9.1/gems/slack-notifier-1.0.0/lib/slack-notifier/default_http_client.rb:26:in `request_obj': undefined method `request_uri' for #<URI::Generic:0x00000001d1d7a0 URL:xxxxxxxxxx> (NoMethodError)
    from /var/lib/gems/1.9.1/gems/slack-notifier-1.0.0/lib/slack-notifier/default_http_client.rb:20:in `call'
    from /var/lib/gems/1.9.1/gems/slack-notifier-1.0.0/lib/slack-notifier/default_http_client.rb:8:in `post'
    from /var/lib/gems/1.9.1/gems/slack-notifier-1.0.0/lib/slack-notifier.rb:23:in `ping'
    from /wercker/steps/wantedly/pretty-slack-notify/0.2.2/run.rb:61:in `<main>'

I'm really grateful for your work though, so thanks.

spesnova commented 9 years ago

Could you possibly add in a build status or some kind of CI step for pull requests

Hi, please let me know example usage about this to understand your request.

And it looks you are passing $SLACK_TOKEN to webhook_url like this:

build:
    after-steps:
        - wantedly/pretty-slack-notify:
            webhook_url: $SLACK_TOKEN

I think this cause this wercker step fail. You have to pass webhook url instead of token since Slack changed webhook style. Here is sample screenshot in "incoming webhook" settng page to get webhook url.

スクリーンショット_2014-11-20_19_33_33.png

outrunthewolf commented 9 years ago

Thank you you're a super star

ptarjan commented 9 years ago

I just ran into this. Can you print a nicer message about this please?

spesnova commented 9 years ago

I just ran into this. Can you print a nicer message about this please?

You mean pretty-slack-notify should print some warning message when user uses slack token or webhook_url is missing? Yep, it make sense.

I'll update this later, thanks!

spesnova commented 9 years ago

I'll update this later, thanks!

Oh, I forgot that I already print a message if webhook_url is missing.

@ptarjan Can you give me your error message about the failed step.