Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Job "Test Connection" throws false positive #51

Closed
Brantone opened this issue Feb 24, 2015 · 13 comments
Closed

Job "Test Connection" throws false positive #51

Brantone opened this issue Feb 24, 2015 · 13 comments
Labels

Comments

@Brantone
Copy link
Contributor

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

@peergum
Copy link
Contributor

peergum commented Feb 24, 2015

I believe you didn't fill the team name since it seems to be missing in the URL: https://.slack.com...
Note that for the Test button to work in the specific job configuration, ALL settings have to be informed. Still the message should say failed, that's for sure :-)

@Brantone
Copy link
Contributor Author

Yup, so actually 2 things ... first is the message should say failed.
Second, is in the "Advanced" button, all 3 text boxes have "This overrides the global setting." ... which I take to mean "if not provided, global setting will be used" ... which is obviously incorrect.

So the "Test Connection" button for a Job is at odds with the global configs it seems.

@peergum
Copy link
Contributor

peergum commented Feb 24, 2015

I added the specific job button to test a configuration that is fully specified there. Thing is, the global settings ARE indeed used when no specific job setting is informed, but - because of my lack of specific knowledge of jenkins AND java - I couldn't get the test to work accordingly. If you or anyone knows how and want to correct that test, please do it. If the current situation is not acceptable, I can remove that specific test button - I think the request for a test button was mostly to see if the plugin and slack were communicating properly, which the main button confirms.

@samrocketman
Copy link
Member

all 3 text boxes have "This overrides the global setting." ... which I take to mean "if not provided, global setting will be used" ... which is obviously incorrect.

Last time I tested, that was the behavior. I configured the following testing environment.

  • Jenkins with global slack configured.
  • A job without slack settings configured (no overrides).
  • A job with slack settings configured (with overrides).

The above worked for me. That is in practice when it comes to jobs actually posting to slack.

However, I did not test the Test Connection button at all. I'll see if I can verify the bug this evening.

@samrocketman
Copy link
Member

I have tested this and verified the bug.

Cases tested:

  • Jenkins configured with global settings slack config and job config without slack configured.
    • Pressing global slack test connection works.
    • Pressing job slack test connection fails (false positive success).
  • Jenkins with configured global settings slack config and job config with slack configued.
    • Pressing global slack test connection works.
    • Pressing job slack test connection succeeds.
  • Jenkins without configured global settings slack config and job config with slack configured.
    • Pressing global slack test connection fails (false positive success).
    • Pressing job slack test connection succeeds.
  • Jenkins without configured global settings slack config and job config without slack configured.
    • Pressing global slack test connection fails (false positive success).
    • Pressing job slack test connection fails (false positive success).
  • Jenkins job slack settings configured with an existing slack domain but no credentials.
    • Pressing job slack test connection succeeds (false positive success).
INFO: Posting: to #slack-plugin-testing on jenkins-slack-plugin using https://jenkins-slack-plugin.slack.com/services/hooks/jenkins-ci?token=: Slack/Jenkins plugin: you're all set. green
Feb 24, 2015 7:26:32 PM jenkins.plugins.slack.StandardSlackService publish
WARNING: Slack post may have failed. Response: No token
Feb 24, 2015 7:26:32 PM jenkins.plugins.slack.StandardSlackService publish
INFO: Posting succeeded
  • Jenkins job slack settings configured with an existing slack domain but bad credentials.
    • Pressing job slack test connection succeeds (false positive success).
Feb 24, 2015 7:26:36 PM jenkins.plugins.slack.StandardSlackService publish
INFO: Posting: to #slack-plugin-testing on jenkins-slack-plugin using https://jenkins-slack-plugin.slack.com/services/hooks/jenkins-ci?token=derp: Slack/Jenkins plugin: you're all set. green
Feb 24, 2015 7:26:36 PM jenkins.plugins.slack.StandardSlackService publish
WARNING: Slack post may have failed. Response: No hooks
Feb 24, 2015 7:26:36 PM jenkins.plugins.slack.StandardSlackService publish
INFO: Posting succeeded
  • Jenkins global slack settings configured with an existing slack domain but bad credentials.
    • Pressing global slack test connection fails (false positive success).
Feb 24, 2015 7:28:51 PM jenkins.plugins.slack.StandardSlackService publish
INFO: Posting: to #slack-plugin-testing on jenkins-slack-plugin using https://jenkins-slack-plugin.slack.com/services/hooks/jenkins-ci?token=derp: Slack/Jenkins plugin: you're all set on http://localhost:8080/ green
Feb 24, 2015 7:28:51 PM jenkins.plugins.slack.StandardSlackService publish
WARNING: Slack post may have failed. Response: No hooks
Feb 24, 2015 7:28:51 PM jenkins.plugins.slack.StandardSlackService publish
INFO: Posting succeeded

I have verified that this is a bug and that the test connection button throws a false positives. In fact, in all test cases I was not actually able to make the connection test fail.

@samrocketman
Copy link
Member

It would be desirable to keep the test connection button and resolve this bug. Since I don't actively develop this plugin I welcome the community to provide a contribution! If you would like to be invited to https://jenkins-slack-plugin.slack.com/ for testing then just ask.

@samrocketman
Copy link
Member

Contributions are welcome to fix this issue.

@aioue
Copy link

aioue commented Apr 10, 2015

+1

Fix candidate PR for merging:
#81

@samrocketman
Copy link
Member

Hello, 1.8 has been released. Can you please confirm that this bug is fixed for you? My testing shows that it has.

@BBI-YggyKing
Copy link

We are using the 1.8 version of the Slack Notification plugin, and I have the opposite problem -- the "Test Connection" button from a project configuration page indicates a failed connect, even on a project which is successfully posting notifications. The project does not override the global slack config. "Test Connection" from global config succeeds.

@samrocketman
Copy link
Member

Please file a new issue. This one has been closed.

@BBI-YggyKing
Copy link

Roger that, see #132

@samrocketman
Copy link
Member

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants