Mobile CI & Slack
I like Slack, rather a lot. I also like CI, so how do we merge them.
Our existing system is based on Jenkins and Fastlane, both of which are excellent.
But wouldn’t it be nice if I could type /build feature/checkout
into Slack & have a full build / test cycle run.
Stream any log file to Slack using curl
You’ll need a Slack Incomming WebHook for this.
tailSlack.sh
Usage
./tail-slack.sh "file.log" "https://hooks.slack.com/services/...";
./tail-slack.sh "/var/log/ngix/access.log" \
"https://hooks.slack.com/services/..." " 404 ";
Don’t forget nohup
so will run post logout from ssh
or whatever.
#ios_notifications
webhook (It’s in 1password, Rik)
See here to modify.
In Jenkins, using ` ~/.slack.conf`
# Try to read the configuration from:
# 1. the working directory
# 2. The user's home directory
# (in that order)
config_file=".slack.conf"
if [ -f "$(pwd)/$config_file" ]; then
source "$(pwd)/$config_file"
elif [ -f "$HOME/$config_file" ]; then
source "$HOME/$config_file"
fi
#export PAYLOAD='payload={"channel": "#ios_notifications", "username": "webhookbot ", "text": "This is posted to #ios_notifications and comes from Jenkins - please ignore.", "icon_emoji": ":slack:"}'
export PAYLOAD='payload={"channel": "#ios_notifications", "username": "webhookbot", "text": "This is posted to #ios_notifications and comes from Jenkins - please ignore." }'
curl -X POST --data-urlencode \
'payload={"channel": "#ios_notifications", "username": "webhookbot ", "text": "This is posted to #ios_notifications and comes from Jenkins, please ignore.", "icon_emoji": ":slack:"}' \
$SLACK_HOOK_URL
cat ~/.slack.conf
# Your Slack hook URL
SLACK_HOOK_URL=https://hooks.slack.com/services/T0FFFFUP4/B21FFFF30/hoKFFFFI4lbaMjR6zQ8FoWr