SVN-Slack Integration31 Jul 2016
Today 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 happen if I wont to notify to everyone who are involved in my project on how I’m working on it? Using just Slack I have to notify manually everyone the states of my work in a particular slack channel or in a private conversion. 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 ,because lot of app in slack need just to be installed. With subversion we have to do some extra-work in the machine who contain 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
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
-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