Jump to content


Slack Integration for Swarm

Slack Swarm

  • Please log in to reply
4 replies to this topic

#1 rtande

rtande

    Member

  • Members
  • PipPip
  • 19 posts
  • LocationBay Area, California

Posted 06 March 2016 - 02:13 AM

I'm trying the Slack integration for Swarm and I think I have everything setup correctly. I'm using the instructions from https://swarm.worksh...software-slack/ but I'm not seeing anything in the Slack channel that I've created to receive updates from Swarm.

I've done the following

- copied across the files mentioned in the instructions to the relevant locations in my Swarm install
- changed the file permissions on the files and directories to ensure that they are writeable and executable as required
- set up the webhook in my Slack channel
- copied that webhook into the settings for the Swarm project that I'm using


I don't see any error messages in my Swarm error log or any POSTs from Swarm to the Slack webhook URL in my Swarm access log.

Any help or pointers gratefully accepted.

Thanks

#2 trask

trask

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 26 September 2016 - 06:32 PM

What ever came of this?  I am having the exact same behavior (which is to say: no messages or errors of any kind either in Slack or Swarm logs).  I'm running Swarm 2016.1 and just pulled the Slack module files this morning.

I see some related chatter here: https://swarm.worksh...000478#comments

Any tips to diagnose or fix this issue would be appreciated.

#3 P4Paul

P4Paul

    Newbie

  • Staff
  • 7 posts

Posted 30 September 2016 - 12:19 PM

The webhook uses HTTPS and Swarm might be rejecting Slack's Certificate.  You can either ignore all cert checks (sslverifypeer=false) or specify the CA path location and add the cert if needed.  I would turn up the logging and then submit/shelve a change for review to trigger Slack.  Here is a snippet from my config file:

<?php
	return array(
	   ...
	   'log' => array(
		  'priority'  => 6, // 7 for max, defaults to 3
	   ),
	   'http_client_options' => array(
		  'sslverifypeer'	 => false,
		  'timeout'		   => 5,
		  'sslcapath'		 => '/etc/ssl/certs',
		  'sslallowselfsigned'	=> true,
	   ),
	   ....


#4 trask

trask

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 04 October 2016 - 07:13 PM

Hi Paul,Thanks for the update.  That's helped me make some progress.  I'm having two issues but I think it's best to focus on one at a time right now.  The main issue seems to be in the Module.php code for the plugin here:
 $impacted = Project::getAffectedByChange($change, $p4Admin); if ($impacted) { $logger->info("Slack: impacted..."); $projects = Project::fetchAll(array(Project::FETCH_BY_IDS => array_keys($impacted)), $p4Admin); foreach ($projects as $projectId => $project) { $logger->info("Slack: impacted: $projectId"); // URL to POST messages to Slack $enabled = $project->slack['enabled']; $url = $project->slack['url']; // Skip projects with no Slack URL if(!$enabled || !isset($url) || trim($url)==='') { $logger->info("Slack: Slack webook disabled or empty url"); continue;
(I added the logging line "webhook disable or empty url")  It ends up that none of that data is filled out.  I assume the "$project->slack" call isn't returning anything.  My PHP debugging skills are pretty non-existant so I'm not sure where to go from here.  Trying to get logging output of "$project->slack" causes the web server to never load Swarm.I've also verified that my project seems to be getting it's settings correctly by dialing up the logging to "7".  

Quote

2016-10-04T20:56:47+02:00 DEBUG (7): P4 (00000000541c179400007ff510b8c71f) start command: counter -u swarm-project-dashing {"slack":{"enabled":true,"url":"https:\/\/hooks.slack.com\/services\/XXXXX9U4R\/B2G3GXXXX\/YZ1GXXXXXXSdlkIjMsxxxxx"},"name":"Dashing","description":"Dashing is a NERD day project which allows you to create interesting dashboard widgits.","owners":["joe","schmoe"],"branches":[{"id":"master","name":"MASTER","paths":["\/\/asdf\/etc\/Dashing\/MASTER\/..."],"moderators":[]}],"jobview":"","emailFlags":{"change_email_project_users":"0","review_email_project_members":"0"},"tests":{"enabled":false,"url":"http:\/\/192.168.8.18\/job\/test\/job\/swarm-test\/review\/build?status={status}\u0026review={review}\u0026change={change}\u0026pass={pass}\u0026fail={fail}","postBody":"","postFormat":"URL"},"deploy":{"enabled":false,"url":""},"deleted":null,"private":null}2016-10-04T20:56:47+02:00 DEBUG (7): P4 (00000000541c179400007ff510b8c71f) sta
I'm not sure where to go from here.  I could probably learn to debug PHP more but I given this is low priority I've probably spent too much time as it is...

#5 trask

trask

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 05 October 2016 - 07:54 PM

For the record: the problem was I was using an old development branch instead of the "official" Slack module from here:

https://swarm.worksh...software-slack/



Also tagged with one or more of these keywords: Slack, Swarm

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users