wantedly / step-pretty-slack-notify

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

Wercker changes the env variables? #19

Closed ptarjan closed 9 years ago

ptarjan commented 9 years ago

I'm now getting:

cd $WERCKER_SOURCE_DIR
$ export WERCKER_STEP_ROOT="/wercker/steps/wantedly/pretty-slack-notify/0.2.11"
$ export WERCKER_STEP_ID="1f86d5ac-c9a9-45cd-91a1-89dca99e244d"
$ 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_WEBHOOK_URL="$SLACK_WEBHOOK_URL"
$ export WERCKER_PRETTY_SLACK_NOTIFY_CHANNEL="eng-tests"
$ source "$WERCKER_STEP_ROOT/run.sh"
Ruby Version: ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
Ruby Path: /usr/bin/ruby
Install User: ubuntu

Installing slack-notifier as root...
Fetching: slack-notifier-1.2.1.gem (100%)
Successfully installed slack-notifier-1.2.1
1 gem installed
/wercker/steps/wantedly/pretty-slack-notify/0.2.11/run.rb:50:in `username_with_status': undefined method `capitalize' for nil:NilClass (NoMethodError)
    from /wercker/steps/wantedly/pretty-slack-notify/0.2.11/run.rb:55:in `<main>'
ptarjan commented 9 years ago

Sorry, PEBKAC. This wasn't in an after-steps

koudaiii commented 9 years ago

Hi @ptarjan :)

Sorry for replying late. step-pretty-slack-notify need ENV["WERCKER_RESULT"]. WERCKER_RESULT is status of build: step in wercker . Therefore, you need to set 'after-steps:' in wercker.yml

For example,

box: wercker/default
build:
  steps:
    - jshint
    - script:
        name: echo
        code: echo 1
  after-steps:
    - wantedly/pretty-slack-notify:
        webhook_url: $SLACK_WEBHOOK_URL

Thanks.