Giter Site home page Giter Site logo

slack-plugin's Introduction

Slack plugin for Jenkins

Build Status Jenkins Plugin GitHub release Jenkins Plugin Installs

Provides Jenkins notification integration with Slack or Slack compatible applications like RocketChat and Mattermost.

Install Instructions for Slack

  1. Get a Slack account: https://slack.com/

  2. Install this plugin on your Jenkins server:

    1. From the Jenkins homepage navigate to Manage Jenkins
    2. Navigate to Manage Plugins,
    3. Change the tab to Available,
    4. Search for slack,
    5. Check the box next to install.

image

  1. Continue to the next section to create your Slack app.

Creating your app

  1. Go to https://api.slack.com/apps and click "Create New App".
  2. Click From an app manifest
  3. Select your workspace
  4. Delete the example manifest that Slack provides
  5. Click YAML
  6. Paste the following into the text box:
display_information:
  name: Jenkins
features:
  bot_user:
    display_name: Jenkins
    always_online: true
oauth_config:
  scopes:
    bot:
      - channels:read
      - chat:write
      - chat:write.customize
      - files:write
      - reactions:write
      - users:read
      - users:read.email
      - groups:read
settings:
  org_deploy_enabled: false
  socket_mode_enabled: false
  token_rotation_enabled: false
  1. Click "Next"
  2. Click "Create"
  3. Click "Install App to Workspace"
  4. Click "Allow"
  5. Click "OAuth & Permissions" in the sidebar
  6. Copy the "Bot User OAuth Access Token"
  7. On Jenkins: Find the Slack configuration in "Manage Jenkins → System".
    1. On Jenkins: Click "Add" to create a new "Secret text" Credential with the bot user token.
    2. On Jenkins: Select the new "Secret text" in the dropdown.
    3. On Jenkins: Add a default channel (this can be removed after validating the connection works).
    4. On Jenkins: Tick the "Custom slack app bot user" option.
  8. Invite the Jenkins bot user into the Slack channel(s) you wish to be notified in.
  9. On Jenkins: Click test connection. A message will be sent to the default channel / default member.

Notify for all jobs

If you want to configure a notification to be sent to Slack for all jobs, you may want to also consider installing an additional plugin called Global Slack Notifier plugin.

Pipeline job

slackSend color: "good", message: "Message from Jenkins Pipeline"

Additionally you can pass attachments or blocks (requires bot user) in order to send complex messages, for example:

Attachments:

def attachments = [
  [
    text: 'I find your lack of faith disturbing!',
    fallback: 'Hey, Vader seems to be mad at you.',
    color: '#ff0000'
  ]
]

slackSend(channel: "#general", attachments: attachments)

Blocks (this feature requires a 'bot user' and a custom slack app):

blocks = [
	[
		"type": "section",
		"text": [
			"type": "mrkdwn",
			"text": "Hello, Assistant to the Regional Manager Dwight! *Michael Scott* wants to know where you'd like to take the Paper Company investors to dinner tonight.\n\n *Please select a restaurant:*"
		]
	],
    [
		"type": "divider"
	],
	[
		"type": "section",
		"text": [
			"type": "mrkdwn",
			"text": "*Farmhouse Thai Cuisine*\n:star::star::star::star: 1528 reviews\n They do have some vegan options, like the roti and curry, plus they have a ton of salad stuff and noodles can be ordered without meat!! They have something for everyone here"
		],
		"accessory": [
			"type": "image",
			"image_url": "https://s3-media3.fl.yelpcdn.com/bphoto/c7ed05m9lC2EmA3Aruue7A/o.jpg",
			"alt_text": "alt text for image"
		]
	]
]

slackSend(channel: "#general", blocks: blocks)

For more information about slack messages see Slack Messages Api, Slack attachments Api and Block kit

Note: the attachments API is classified as legacy, with blocks as the replacement (but blocks are only supported when using a bot user through a custom slack app).

File upload

You can upload files to slack with this plugin:

node {
  sh "echo hey > blah.txt"
  slackUploadFile filePath: "*.txt", initialComment:  "HEY HEY"
}

This feature requires botUser mode.

File upload to a user channel

You can upload files to a user channel by messaging the user first and then using the channel ID from the message response:

node {
  sh "echo hey > blah.txt"
  def slackResponse = slackSend channel: '$userId', message: 'Hey', sendAsText: true
  slackUploadFile filePath: "*.txt", channel: slackResponse.channelId
}

Threads Support

You can send a message and create a thread on that message using the pipeline step. The step returns an object which you can use to retrieve the thread ID. Send new messages with that thread ID as the target channel to create a thread. All messages of a thread should use the same thread ID.

Example:

def slackResponse = slackSend(channel: "cool-threads", message: "Here is the primary message")
slackSend(channel: slackResponse.threadId, message: "Thread reply #1")
slackSend(channel: slackResponse.threadId, message: "Thread reply #2")

This feature requires botUser mode.

Messages that are posted to a thread can also optionally be broadcasted to the channel. Set replyBroadcast: true to do so. For example:

def slackResponse = slackSend(channel: "ci", message: "Started build")
slackSend(channel: slackResponse.threadId, message: "Build still in progress")
slackSend(
    channel: slackResponse.threadId,
    replyBroadcast: true,
    message: "Build failed. Broadcast to channel for better visibility."
)

If you wish to upload a file to a thread, you can do so by specifying the channel, and the timestamp of the thread you want to add the file to, separated by a colon. For example:

def slackResponse = slackSend(channel: "cool-threads", message: "Here is the primary message")
sh "echo hey > blah.txt"
slackUploadFile(channel: "cool-threads:" + slackResponse.ts, filePath: "*.txt", initialComment:  "A file, inside a thread.")

Update Messages

You can update the content of a previously sent message using the pipeline step. The step returns an object which you can use to retrieve the timestamp and channelId NOTE: The slack API requires the channel ID for chat.update calls.

Example:

def slackResponse = slackSend(channel: "updating-stuff", message: "Here is the primary message")
slackSend(channel: slackResponse.channelId, message: "Update message now", timestamp: slackResponse.ts)

This feature requires botUser mode.

Emoji Reactions

Add an emoji reaction to a previously-sent message like this:

Example:

def slackResponse = slackSend(channel: "emoji-demo", message: "Here is the primary message")
slackResponse.addReaction("thumbsup")

image

You can remove an emoji reaction to a previously-sent message like this:

Example:

def slackResponse = slackSend(channel: "emoji-demo", message: "Here is the primary message")
slackResponse.addReaction("thumbsup")
// ... do some stuff
slackResponse.removeReaction("thumbsup")

This may only work reliably in channels (as opposed to private messages) due to limitations in the Slack API (See "Post to an IM channel").

This does not currently work in a situation where Jenkins is restarted between sending the initial message and adding the reaction. If this is something you need, please file an issue.

This feature requires botUser mode and the reactions:write API scope.

Unfurling Links

You can allow link unfurling if you send the message as text. This only works in a text message, as attachments cannot be unfurled.

Example:

slackSend(channel: "news-update", message: "https://www.nytimes.com", sendAsText: true)

User Id Look Up

There are two pipeline steps available to help with user id look up.

A user id can be resolved from a user's email address with the slackUserIdFromEmail step.

Example:

def userId = slackUserIdFromEmail('[email protected]')
slackSend(color: "good", message: "<@$userId> Message from Jenkins Pipeline")

A list of user ids can be resolved against the set of changeset commit authors with the slackUserIdsFromCommitters step.

Example:

def userIds = slackUserIdsFromCommitters()
def userIdsString = userIds.collect { "<@$it>" }.join(' ')
slackSend(color: "good", message: "$userIdsString Message from Jenkins Pipeline")

This feature requires botUser mode and the users:read and users:read.email API scopes.

Colors

Warning: This functionality is not supported if you are using the blocks layout mode

Any hex triplet (i.e. '#AA1100') can be used for the color of the message. There are also three builtin color options:

Name Color
good green
warning yellow
danger red

Freestyle job

  1. Configure it in your Jenkins job (and optionally as global configuration) and add it as a Post-build action.

Security

Use Jenkins Credentials and a credential ID to configure the Slack integration token. It is a security risk to expose your integration token using the previous Integration Token setting.

Create a new Secret text credential:

image

Select that credential as the value for the Credential field:

image

Direct Message

You can send messages to channels or you can notify individual users via their slackbot. In order to notify an individual user, use the syntax @user_id in place of the project channel. Mentioning users by display name may work, but it is not unique and will not work if it is an ambiguous match.

User Mentions

Use the syntax <@user_id> in a message to mention users directly. See User Id Look Up for pipeline steps to help with user id look up.

Configuration as code

This plugin supports configuration as code Add to your yaml file:

credentials:
  system:
    domainCredentials:
      - credentials:
          - string:
              scope: GLOBAL
              id: slack-token
              secret: '${SLACK_TOKEN}'
              description: Slack token


unclassified:
  slackNotifier:
    teamDomain: <your-slack-workspace-name> # i.e. your-company (just the workspace name not the full url)
    tokenCredentialId: slack-token
    botUser: true

For more details see the configuration as code plugin documentation: https://github.com/jenkinsci/configuration-as-code-plugin#getting-started

Troubleshooting connection failure

When testing the connection, you may see errors like:

    WARNING j.p.slack.StandardSlackService#publish: Response Code: 404

There's a couple of things to try:

Have you enabled bot user mode?

If you've ticked Custom slack app bot user then try unticking it, that mode is for when you've created a custom app and installed it to your workspace instead of the default Jenkins app made by Slack

Have you set the override URL?

If you've entered something into Override url then try clearing it out, that field is only needed for slack compatible apps like mattermost.

Enable additional logging

Add a log recorder for the StandardSlackService class this should give you additional details on what's going on.

If you still can't figure it out please raise an issue with as much information as possible about your config and any relevant logs.

Developer instructions

Install Maven and JDK.

$ mvn -version | grep -v home
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T08:41:47-08:00)
Java version: 1.7.0_79, vendor: Oracle Corporation
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-65-generic", arch: "amd64", family: "unix"

Run unit tests

mvn test

Create an HPI file to install in Jenkins (HPI file will be in target/slack.hpi).

mvn clean package

slack-plugin's People

Contributors

ahippo avatar anderspikas avatar basil avatar batmat avatar daniel-beck avatar dependabot[bot] avatar dpires avatar ericbartusch avatar fgs-dbudwin avatar grantmd avatar gricey432 avatar gurumaia avatar idserda avatar iulianstana avatar jetersen avatar jsoref avatar kei-yamazaki avatar kmadel avatar kreach3r avatar mtyurt avatar ndeloof avatar owenscode avatar peergum avatar philowest avatar randomsync avatar renovate[bot] avatar samrocketman avatar sergk8 avatar sghill avatar timja avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slack-plugin's Issues

"Test Connection" button

I've seen several Jenkins plugins with a "Test Connection" button. See the Gerrit Trigger for an example.

That would definitely be useful in this plugin to make sure you have the correct settings. I was trying to set this up and apparently specified an invalid channel. It took me a while to figure that out, since it is only in the system log, not the build log.

Support for private groups

We have a bunch of private groups where we would like to send Jenkins notifications.
Right now pushing a message to a private group gives:

Aug 04, 2014 1:10:55 AM jenkins.plugins.slack.StandardSlackService publish
WARNING: Slack post may have failed. Response: No active hooks

java.lang.NullPointerException with jenkins 1.560

Have a lot of these in my log after upgrade to 1.560.

Apr 22, 2014 8:26:38 AM hudson.model.listeners.RunListener report
WARNING: RunListener failed
java.lang.NullPointerException
        at jenkins.plugins.slack.ActiveNotifier.completed(ActiveNotifier.java:65)
        at jenkins.plugins.slack.SlackListener.onCompleted(SlackListener.java:26)
        at jenkins.plugins.slack.SlackListener.onCompleted(SlackListener.java:14)
        at hudson.model.listeners.RunListener.fireCompleted(RunListener.java:199)
        at hudson.model.Run.execute(Run.java:1753)
        at hudson.matrix.MatrixRun.run(MatrixRun.java:146)
        at hudson.model.ResourceController.execute(ResourceController.java:88)
        at hudson.model.Executor.run(Executor.java:231)

Release new version of plugin

It was 3 months since color-coding was merged and still from jenkins dashboard only the old version is available.

Automatically setup any post-build steps

As a Jenkins newbie, I want the Slack plugin to automatically setup any post-build steps for me. I don't want to have to explicitly add a Slack post-build step to every job I manage, and I keep forgetting to do this.

Jenkin Slack Notification Plugin Null Pointer Exception

Hi,
We are seeing the occaionaly Null Pointer Execption from the Jenkins Slack Notification plugin:
"
FATAL: null
java.lang.NullPointerException
at java.util.AbstractCollection.addAll(Unknown Source)
at jenkins.plugins.slack.ActiveNotifier.getChanges(ActiveNotifier.java:115)
at jenkins.plugins.slack.ActiveNotifier.started(ActiveNotifier.java:45)
at jenkins.plugins.slack.SlackNotifier$SlackJobProperty.prebuild(SlackNotifier.java:280)
at hudson.model.AbstractBuild$AbstractBuildExecution.preBuild(AbstractBuild.java:804)
at hudson.model.AbstractBuild$AbstractBuildExecution.preBuild(AbstractBuild.java:799)
at hudson.model.AbstractBuild$AbstractBuildExecution.preBuild(AbstractBuild.java:795)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:530)
at hudson.model.Run.execute(Run.java:1745)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
"
Slack Notification Plugin 1.7

Fails to notice build transition when last build was cancelled?

I have "Notify Back To Normal" enabled.

I had a build that was failing. I started a new build in jenkins and then cancelled the build while it was in progress.

I then tweaked the build configuration in jenkins.

I did a new build and it succeeded. I received no slack notification that the build had gone from broken to working. I suspect that's because the last build had been cancelled.

Turn on slack-plugin Logging?

I installed your plugin and it seems to do nothing. There are no logs generated on my jenkins box. Is there a way to turn on logging for this plugin, so I can debug the problem?

Support for messaging individual users

When configuring the Slack integration, you can select particular users instead of channels. But this option is not anywhere in the Jenkins plugin configuration. Is it supported at all? If so, how is it used?

I've tried <username> & @<username> on the Project Channel setting but none of them worked (ie. no messages at all posted).

Call to contributors: more unit testing

Currently, I accept pull requests with no unit testing. It would be good if more unit tests were written to exercise the code base. It would certainly make me more confident when merging contributions. Although I do, and will continue to, manually test the plugin when merging. It is generally accepted as a software development best practice.

For those who don't know me, I don't actively develop this plugin. I do maintain pull requests and releases.

Job configuration not inheriting global

The info/tooltip of team domain/token on the job configuration page mentions that it inherits the values from global. This doesn't appear to be case. With empty fields (except for channel) the test says "success" but no messages are delivered.

After filling in the domain and token it does properly send the message.

Call to contributors: document options

This is a request to Jenkins Slack Plugin contributors to create jelly documentation for the plugin options. I believe this would improve the overall user experience if some or all options included a help doc explaining what that option does.

The expected behavior is to be able to click the help button next to the option. Here's a screen shot showing an example.

jenkins_slack3

All contributions welcome. If you would like to be invited to the Jenkins plugin slack then let me know. That slack org is meant to assist contributors with testing changes.

Having trouble performing plugin release

I'm currently having issues releasing the plugin. Here's an excerpt from slack...

21:01 < sag47> kohsuke: I'm having trouble releasing a plugin. My GitHub username is samrocketman and my jenkins-ci.org ID is sag47. I have added my credentials to ~/.m2/settings.xml from this article
https://wiki.jenkins-ci.org/display/JENKINS/Hosting+Plugins
21:02 < sag47> kohsuke: Do I have the capability to release if I'm able to be a contributor for a plugin? If not, what do I need to do in order to be able to release?
21:02 < sag47> kohsuke: I have taken over maintaining this as it was previously abandoned.
21:03 < sag47> kohsuke: Plugin in question: https://github.com/jenkinsci/slack-plugin

I'll be working through this and keep any followers for the next release updated via this issue.

New value for buildServerUrl does not take effect

Jenkins: 1.549
Java: 1.7.0_51-b13
OS: OSX 10.7.5
Slack plugin: 1.2

Changing the buildServerUrl in my Jenkins config was not having any effect: all build notifications in Slack still referred to the URL that I entered when I first configured the plugin.

I realized that this is because, while jenkins.plugins.slack.SlackNotifier.xml was being updated properly, my job-specific config was not.

However, there is no field in the project configuration frontend to set the buildServerUrl parameter.

Removing and re-adding the "Slack Notifications" post-build action resolved the issue for me, in the end.

More flexible channel separator syntax

The first time I used the Jenkins Slack plugin, I experienced trouble finding the right syntax for configuring a job to notify multiple Slack channels. In the future, could we increase flexibility?

  • Comma separation (the current, undocumented syntax: #chan1,#chan2,...)
  • Space separation (#chan1 #chan2 ...)
  • Comma with space separation (#chan1, #chan2, ...)

Programmatically modifying global Slack plugin settings

I was just curious if there's any interest (aside from just me) in adding some way to modify the instance variables inside SlackNotifier.DescriptorImpl?
https://github.com/jenkinsci/slack-plugin/blob/master/src/main/java/jenkins/plugins/slack/SlackNotifier.java#L81

I'm using Chef to manage my Jenkins instance, and I'd like to have Chef set the appropriate values for Slack as well. Most of these are managed via Groovy scripts submitted via the jenkins-cli.jar. Unfortunately, it looks like the only way to modify the Slack values would be by creating a RequestImpl to "fake out" the form submission. That's not really too desirable. Instead, this could be resolved by adding setters for those values (or some other method to modify them) similar to the mailer-plugin: https://github.com/jenkinsci/mailer-plugin/blob/master/src/main/java/hudson/tasks/Mailer.java#L201

I'd be happy to do this work and issue a pull request if there's any interest. Thoughts?

Option to notify only on the first failed build

We have some jobs that run on a timed schedule. If they fail, we get notifications each time. So our #jenkins channel fills up with lots of fail messages.

It would be nice to have an option like “Notify First Failure”. That way we could get notified (once!) when the job fails, and once when the job is back to normal, using the “Notify Back To Normal” option.

SSL Error

"Failed to initialize campfire notifier - check your global campfire notifier configuration settings: javax.net.ssl.SSLProtocolException: Server returned wrong cipher suite for session"

See related info here -> https://issues.jenkins-ci.org/browse/JENKINS-19590

Essentially, the plugin installs fine, but when I go to set up the org name and key in "Configure System", I get the error above.

Invalid channel specified

I get this error in my Jenkins log whenever the plugin attempts to send a message to Slack:

Slack post may have failed. Response: Invalid channel specified

I've followed the steps in the setup page and believe everything is as it should be. Team domain and token are set, channel name is blank (tried using 'builds' and '#builds' as well), build server URL is /

Jan 13, 2015 10:34:44 AM WARNING jenkins.plugins.slack.StandardSlackService publish
Slack post may have failed. Response: Invalid channel specified

Not sure if this is a Slack problem or a plugin problem.

Job "Test Connection" throws false positive

In Jenkins Manage configuration , set global values for Slack; however, when going in to a Job that uses Slack, hitting the "Test Connection" is says "Success" BUT the Jenkins logs show:

Feb 23, 2015 10:03:17 PM INFO jenkins.plugins.slack.StandardSlackService publish
Posting: to on  using https://.slack.com/services/hooks/jenkins-ci?token=: Slack/Jenkins plugin: you're all set. green
Feb 23, 2015 10:03:17 PM WARNING jenkins.plugins.slack.StandardSlackService publish
Error posting to Slack
java.net.UnknownHostException: .slack.com
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:579)
    at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:618)
    at sun.security.ssl.SSLSocketImpl.<init>(SSLSocketImpl.java:451)
    at sun.security.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:140)
    at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket(SSLProtocolSocketFactory.java:82)
    at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket(SSLProtocolSocketFactory.java:127)
    at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
    at jenkins.plugins.slack.StandardSlackService.publish(StandardSlackService.java:66)
    at jenkins.plugins.slack.SlackNotifier$SlackJobProperty$DescriptorImpl.doTestConnection(SlackNotifier.java:358)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:298)
    at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:161)
    at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:96)
    at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:121)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
    at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:249)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
    at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:249)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
    at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:249)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
    at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:249)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
    at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1494)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:96)
    at hudson.plugins.audit_trail.AuditTrailFilter.doFilter(AuditTrailFilter.java:95)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:99)
    at hudson.plugins.scm_sync_configuration.extensions.ScmSyncConfigurationFilter$1.call(ScmSyncConfigurationFilter.java:46)
    at hudson.plugins.scm_sync_configuration.ScmSyncConfigurationDataProvider.provideRequestDuring(ScmSyncConfigurationDataProvider.java:103)
    at hudson.plugins.scm_sync_configuration.extensions.ScmSyncConfigurationFilter.doFilter(ScmSyncConfigurationFilter.java:42)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:99)
    at hudson.plugins.greenballs.GreenBallFilter.doFilter(GreenBallFilter.java:58)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:99)
    at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:88)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
    at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:48)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
    at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
    at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
    at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
    at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:46)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
    at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
    at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1474)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:533)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
    at org.eclipse.jetty.server.Server.handle(Server.java:370)
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
    at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:960)
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1021)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
    at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

Feb 23, 2015 10:03:17 PM INFO jenkins.plugins.slack.StandardSlackService publish
Posting succeeded

On latest 1.7 release

Build Server URL > Jenkins URL

Instead of using a custom 'Build Server URL' parameter, we can't use the built in 'Jenkins URL'(Manage Jenkins > Jenkins Location)?

related #3

Global config change doesn't apply to existing config

If I update the global configuration of the slack-plugin, say the API key, then the slack configuration that exists in current jobs isn't updated.

I basically had to do a massive search replace to get around this. It would be nice if I didn't have to remove and add the slack post commit task to each job just to change global config.

work arounds:

find . -name 'config.xml' -exec sed  -i 's/<teamDomain>mydomain.com<\/teamDomain>/<teamDomain>mydomain<\/teamDomain>/g' "{}" \;
find . -name 'config.xml' -exec sed  -i 's,<authToken>1234578901234567u693453</authToken>,<authToken>11111111111111111111111</authToken>,g' "{}" \;

Changing bot name and icon in post-build action

It would be great to enable admins to set the bot name (and its icon) in post-build action preferences.

These parameters could be send in each message payload using username and icon_url fields.

Configure page messed up

Slack Plugin simply inserts its configuration options somewhere in the middle of the top section of the Jenkins Configure page.

There is no visible separator at the end of its section, making it quite difficult to find out which options belong to the plugin and which don't.

Post jenkins build output (console output) to slack

Jenkins generate some outputs for each build, which is shown in "Console output" panel for each build.
Can I make the slack-plugin post that output to slack? Is this feature already available?

I tried checking the box " Include Test Summary" in the slack notification configuration. However, what I got on slack is "No Tests found."

Customize message

It would be cool to allow for customizing the message a bit. Specifically I'd like to include the branch name. But maybe there are other tokens people would include or exclude.

One jenkins multiple teams

Hi,

we have one Jenkins instance and multiple Slack teams (projects). Current plugin in global settings defines Slack "secrets" so you can't configure it for multiple teams.
So either put this to the build configuration or enable definition of Teams in th global settings where a value can be than picked for a specific build.
This is quite a showstopper for our case.

Can I expect the fix in a reasonable time or do we have to make a change ourselves?

thanks in advance

Peter

build notification format specifiers

We configure Jenkins to build any git branch pushed to our review repository. It would be nice to see the branch name in the build notification through the use of format specifiers. At the moment, you need to click through to see what job actually finished.

Better customization for slack messages

Including the branch name in the slack notifications.

Also, not sure how to provide better customization of the slack notifications.

Contributions are welcome.

Slack plugin does not post to Slack, no logs available

I installed the Slack integration plugin 1.2 on a Jenkins server (v1.555, have also tried on 1.566 with same result). Followed all relevant instructions for installation and configuration, but the plugin is either not functioning or its updates are not being posted by our Slack instance.

To troubleshoot I boosted the Jenkins log levels to 'all', but the Slack plugin appears to have no logging whatsoever which could help me to deduce what the root cause could be. I have successfully installed a Slack plugin on another one of our Jenkins servers and it's posting without any problems.

Configuration looks good, Test Connection passes, no notifications occur

In Jenkins "Configure System" I've setup appropriate slack settings. Test Connection returns SUCCESS, although on further testing that seems to be the case no matter what nonsense I enter.

Some jobs are also configured to use the Slack Notifier but when running the console log has no mention of slack and slack is not notified.

How am I supposed to debug what's going on so that I can diagnose and resolve the problem?

Jenkins 1.580.3 + Slack Notifier 1.7.

Some jobs do not trigger the notification

Two (probably the first I've configured) jobs keep pushing notifications, but others seem to just not trigger the plugin at all. Here is how I now configured the "FFFFFFFF" job, that successfully pushes notification, and the "slack_test" job in configured in the same way.

2015-03-17 20 19 29

Both of them have exit 1 in shell script to be executed, but only the "FFFFFFFF" job pushed notification.

мар 17, 2015 6:13:40 PM INFO hudson.model.Run execute
FFFFFFFF_Selenium_Tests #45 main build action completed: FAILURE
мар 17, 2015 6:13:40 PM INFO jenkins.plugins.slack.StandardSlackService publish
Posting: to #jenkins-ci on ******** using https://********.slack.com/services/hooks/jenkins-ci?token=********: FFFFFFFF_Selenium_Tests - #45 Failure after 0,12 секунд (<https://********/job/FFFFFFFF_Selenium_Tests/45/|Open>) danger
мар 17, 2015 6:13:40 PM INFO jenkins.plugins.slack.StandardSlackService publish
Posting succeeded

мар 17, 2015 6:23:56 PM INFO hudson.model.Run execute
slack_test #3 main build action completed: FAILURE

Failed build notifications aren't being sent

We are using Ivy for dependency management. This results in there being module builds for each jenkins project. For some reason build failures aren't going to slack. Only "back to normal" messages are being sent there.

Optional based on build parameter

We've got Jenkins setup to deploy to a "dev" lane when an option boolean is checked. It'd be nice if we could set notifications to only happen when that checkbox is toggled.

Not working

Hi,

I did everything the guideline says to make this work. But it's not working.
I have a http proxy on my environment.. do you guys know or someone has already tested it behind a proxy?

My logs says:

Apr 16, 2014 1:42:41 PM INFO jenkins.plugins.slack.StandardSlackService publish
Posting: to on walmartbr using https://xyz.slack.com/services/hooks/jenkins-ci?token=[TOKEN]: python_scripts-code_pull_test_build - #84 Success after 2 sec (</job/python_scripts-code_pull_test_build/84/|Open>) green

Apr 16, 2014 1:42:56 PM INFO jenkins.plugins.slack.StandardSlackService publish
Posting: to on walmartbr using https://xyz.slack.com/services/hooks/jenkins-ci?token=[TOKEN]: python_scripts-deploy-dev - #125 Success after 1.3 sec (</job/python_scripts-deploy-dev/125/|Open>) green

Plugin does not send notification when a build flow job starts

I have a a job that is using the build flow plugin to run several jobs in parallel. While aborts and build complete notifications are sent, the initial job started notification never is sent to slack, it appears. All the child jobs send notifications that they were started by the build flow job.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.