New Slack Plugin for Jenkins

126 views
Skip to first unread message

Tommy Montingelli

unread,
Feb 10, 2016, 5:49:12 AM2/10/16
to Jenkins Developers
Hi,
I want to write a Jenkins Plugin in Java that trigger a new build when a slash command is typed in Slack. When this appen, an HTTP POST request is sent at Jenkins URL.
I know that i should extend the Trigger Extension Point and define an inner static class that extends the corresponding descriptor to show this option in the Job Configuration page.
So, I have some questions:
  1. How I can listen and manage the requests  made by Slack? What are the classes that do this?
  2. How I can run my plugin when this trigger option is checked and stop the execution when this option is not active?
  3. There are similar plugins?
Thanks.

Vincent Latombe

unread,
Feb 10, 2016, 7:58:46 AM2/10/16
to Jenkins Dev
Hi Tommy,

you could take a look at the git plugin which uses an UnprotectedRootAction as entry point for post-receive hook.


Vincent

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/63c52092-396b-4edf-983a-c00f026afb0b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tommy Montingelli

unread,
Feb 10, 2016, 12:49:59 PM2/10/16
to Jenkins Developers
Thanks Vincent. I tried, but nothing. Git is a very large project and it is hard to understand. Other ideas?

Benjamin Lau

unread,
Feb 10, 2016, 7:48:13 PM2/10/16
to jenkin...@googlegroups.com
Hi Tommy,

We don't do this with slack... but we do with HipChat. The trick for this was to enable Jenkins Parameterized Remote Trigger[1] and then setup our command in our hipchat bot[2] to make requests on the appropriate URL. It's super simple and flexible.

Cheers,
Ben

Tommy Montingelli

unread,
Feb 12, 2016, 5:12:04 AM2/12/16
to Jenkins Developers
Hi Vincent,
I was wrong. With UnprotectedRootAction I've created the plugin. Thanks


Il giorno mercoledì 10 febbraio 2016 13:58:46 UTC+1, Vincent Latombe ha scritto:

Vincent Latombe

unread,
Feb 12, 2016, 10:41:30 AM2/12/16
to Jenkins Dev

Michael Neale

unread,
Feb 15, 2016, 8:09:21 PM2/15/16
to Jenkins Developers
Very cool. I have seen people use hubot and scripts to do things like this (but then you have to host hubot somewhere).

Tommy Montingelli

unread,
Feb 26, 2016, 5:27:26 AM2/26/16
to Jenkins Developers
Hi Vincent,
I have a class that extends GlobalConfiguration. When I install my plugin in Jenkins and my class is instantiated, the instance is null. If I restart Jenkins, the instance is not null. What should I do to avoid restarting Jenkins after installation of my Plugin?
Thanks

Vincent Latombe

unread,
Feb 26, 2016, 7:53:24 AM2/26/16
to Jenkins Dev
Without seeing your code it will be difficult to answer.

Vincent

Tommy Montingelli

unread,
Feb 29, 2016, 10:26:31 AM2/29/16
to Jenkins Developers
Hi Vincent,
in this post https://groups.google.com/forum/#!topic/jenkinsci-dev/n8uOjBx1ibA there is my git repository and a description of the problem.
Thanks
Reply all
Reply to author
Forward
0 new messages