SVN-Slack Integration
31 Jul 2016Today I wanna speak about the integration of SVN in Slack. Slack is a really powerful tool and Subversion as well. But in those developer days, everything should be connected and customizable. So what happens if I wont to notify everyone who is involved in my project on how I’m working on it? Using just Slack I have to notify manually everyone of the states of my work in a particular slack channel or a private conversation. So, fortunately, there is a way to integrate Subversion with slack and to send all the commit log directly in a channel of Slack. The reason why I write an article is that is not so simple to integrate this features as you could imagine. A lot of app in slack need just to be installed, this is not the case With subversion, we have to do some extra work in the machine who contains the repo.
Let’s see how to configure everything.
Install Subversion app into Slack
Add a configuration for a single channel of Slack
Keep note of the token
Backend work
Now we have to enter in the folder “hook” inside the main repository In my case I installed my svnserver in a Qnap NAS that’s why I have this strange path /share/MD0_DATA/SVNrepo/SlackIntegrationSample/hooks/
and copy this two file available here
post-commit slack-posthook.py
-EDIT post-commit The first one is a simple bash file that is called when a commit is ended and we have to simply provide this two info The repo location on our server REPOS=”/share/MD0_DATA/UnityRepo/VisitCommodityProject/” and the absolute path to the other file “slack-posthook.py”
/share/MD0_DATA/UnityRepo/ProjectName/hooks/slack-posthook.py "$REPOS" "$REV" >> $LOG 2>&1 || exit 1
EDIT slack-posthook.py Here we have to edit this 3 line
TOKEN = ‘token’ # token like cg3MI88ufdGWwT5RbojoLJCV DOMAIN = ‘example.slack.com’ # for example companyname.slack.com REPO_BASE_URL = ‘svn://example.myqnapcloud.com/share/MD0_DATA/UnityRepo/ProjectName’ # for example http://svn.companyname.com/
And eventually,if you server can not see this comand, we have to give the path of the svnlook command
LOOK=’svnlook’